Skip to content

Commit ea4069e

Browse files
committed
Add initial test to highlight issue
1 parent a4b4890 commit ea4069e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

persistent-test/src/MigrationTest.hs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
3946
specsWith :: (MonadUnliftIO m) => RunDb SqlBackend m -> Spec
4047
specsWith 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"]

0 commit comments

Comments
 (0)