From ea4069e1aad338a62ce5386233b8a7d3a66a5a1d Mon Sep 17 00:00:00 2001 From: Dan Brooks Date: Wed, 22 May 2024 19:43:40 +0100 Subject: [PATCH] Add initial test to highlight issue --- persistent-test/src/MigrationTest.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/persistent-test/src/MigrationTest.hs b/persistent-test/src/MigrationTest.hs index 7ee8255e0..640b287c5 100644 --- a/persistent-test/src/MigrationTest.hs +++ b/persistent-test/src/MigrationTest.hs @@ -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 @@ -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"]