fix(build): migration needs to check for table existens first
This commit is contained in:
parent
de45731a9b
commit
f439ea45af
@ -179,7 +179,7 @@ customMigrations = mapF $ \case
|
|||||||
|]
|
|]
|
||||||
|
|
||||||
Migration20240124UniquenessCompanyAvsNr ->
|
Migration20240124UniquenessCompanyAvsNr ->
|
||||||
unlessM (indexExists "unique_company_avs_id") $ do -- companies with avs_id == 0 can be deleted; company users are deleted automatically by cascade
|
whenM (tableExists "company" `and2M` notM (indexExists "unique_company_avs_id")) $ do -- companies with avs_id == 0 can be deleted; company users are deleted automatically by cascade
|
||||||
[executeQQ|
|
[executeQQ|
|
||||||
DELETE FROM "company" WHERE avs_id = 0;
|
DELETE FROM "company" WHERE avs_id = 0;
|
||||||
ALTER TABLE "company" DROP CONSTRAINT IF EXISTS "unique_company_shorthand";
|
ALTER TABLE "company" DROP CONSTRAINT IF EXISTS "unique_company_shorthand";
|
||||||
|
|||||||
@ -1196,6 +1196,9 @@ ifM c x y = c >>= bool y x
|
|||||||
ifNotM :: Monad m => m Bool -> m a -> m a -> m a
|
ifNotM :: Monad m => m Bool -> m a -> m a -> m a
|
||||||
ifNotM c = flip $ ifM c
|
ifNotM c = flip $ ifM c
|
||||||
|
|
||||||
|
notM :: Functor f => f Bool -> f Bool
|
||||||
|
notM = fmap not
|
||||||
|
|
||||||
-- | Short-circuiting monadic boolean function, copied from Andreas Abel's utility function
|
-- | Short-circuiting monadic boolean function, copied from Andreas Abel's utility function
|
||||||
and2M, or2M :: Monad m => m Bool -> m Bool -> m Bool
|
and2M, or2M :: Monad m => m Bool -> m Bool -> m Bool
|
||||||
and2M ma mb = ifM ma mb (return False)
|
and2M ma mb = ifM ma mb (return False)
|
||||||
|
|||||||
Reference in New Issue
Block a user