Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions persistent-test/src/MigrationTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ Source1 sql=source
field4 Target1Id
|]

share [mkPersist sqlSettings, mkMigrate "migrationWithDefaultMaybeText"] [persistLowerCase|
TextMaybeDefault
field1 Int
field2 T.Text Maybe default=null
deriving Eq Show
|]

specsWith :: (MonadUnliftIO m) => RunDb SqlBackend m -> Spec
specsWith runDb = describe "Migration" $ do
it "is idempotent" $ runDb $ do
Expand All @@ -53,3 +60,7 @@ specsWith runDb = describe "Migration" $ do
void $ runMigrationSilent migrationAddCol
again <- getMigration migrationAddCol
liftIO $ again @?= []
fit "is idempotent (default text example)" $ runDb $ do
void $ runMigrationSilent migrationWithDefaultMaybeText
again <- getMigration migrationWithDefaultMaybeText
liftIO $ again @?= ["ALTER TABLE \"text_maybe_default\" ALTER COLUMN \"field2\" SET DEFAULT null"]
Copy link
Contributor Author

@danbroooks danbroooks May 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, the test should be:

liftIO $ again @?= []