Skip to content

Instantly share code, notes, and snippets.

@bergmark
Last active December 22, 2015 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bergmark/6539373 to your computer and use it in GitHub Desktop.
Save bergmark/6539373 to your computer and use it in GitHub Desktop.
failing persistent migration
{-# LANGUAGE EmptyDataDecls, FlexibleContexts, GADTs, OverloadedStrings, QuasiQuotes, TemplateHaskell, TypeFamilies #-}
module A where
import Database.Persist.TH
share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase|
A
|]
{-# LANGUAGE EmptyDataDecls, FlexibleContexts, GADTs, OverloadedStrings, QuasiQuotes, TemplateHaskell, TypeFamilies #-}
module B where
import Database.Persist.TH
import A
share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase|
B
aId AId
|]
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad.Trans
import Database.Persist.Sqlite
import qualified A
import qualified B
main :: IO ()
main = runSqlite ":memory:" $ do
runMigration A.migrateAll
liftIO $ putStrLn "Migrated A"
runMigration B.migrateAll
liftIO $ putStrLn "Migrated B"
Migrating: CREATE TABLE "a"("id" INTEGER PRIMARY KEY)
Migrated A
persist-test: Table not found: A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment