File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,13 @@ Source1 sql=source
3636 field4 Target1Id
3737|]
3838
39+ share [mkPersist sqlSettings, mkMigrate " migrationWithDefaultMaybeText" ] [persistLowerCase |
40+ TextMaybeDefault
41+ field1 Int
42+ field2 T.Text Maybe default=null
43+ deriving Eq Show
44+ |]
45+
3946specsWith :: (MonadUnliftIO m ) => RunDb SqlBackend m -> Spec
4047specsWith runDb = describe " Migration" $ do
4148 it " is idempotent" $ runDb $ do
@@ -53,3 +60,7 @@ specsWith runDb = describe "Migration" $ do
5360 void $ runMigrationSilent migrationAddCol
5461 again <- getMigration migrationAddCol
5562 liftIO $ again @?= []
63+ fit " is idempotent (default text example)" $ runDb $ do
64+ void $ runMigrationSilent migrationWithDefaultMaybeText
65+ again <- getMigration migrationWithDefaultMaybeText
66+ liftIO $ again @?= [" ALTER TABLE \" text_maybe_default\" ALTER COLUMN \" field2\" SET DEFAULT null" ]
You can’t perform that action at this time.
0 commit comments