fix(migration): drop more tables in w.a. for inconsistent 21→22
This commit is contained in:
parent
e97cd5616b
commit
d79dca6be9
@ -530,6 +530,12 @@ customMigrations = Map.fromListWith (>>)
|
|||||||
| oldVersion ->
|
| oldVersion ->
|
||||||
-- Major changes happend to the structure of exams without appropriate
|
-- Major changes happend to the structure of exams without appropriate
|
||||||
-- migration, try to remedy that here
|
-- migration, try to remedy that here
|
||||||
|
tableDropEmpty "exam_part_corrector"
|
||||||
|
tableDropEmpty "exam_corrector"
|
||||||
|
tableDropEmpty "exam_result"
|
||||||
|
tableDropEmpty "exam_registration"
|
||||||
|
tableDropEmpty "exam_occurrence"
|
||||||
|
tableDropEmpty "exam_part"
|
||||||
tableDropEmpty "exam"
|
tableDropEmpty "exam"
|
||||||
| otherwise ->
|
| otherwise ->
|
||||||
[executeQQ|
|
[executeQQ|
|
||||||
@ -570,7 +576,7 @@ tableIsEmpty table = do
|
|||||||
return $ unSingle rows == (0 :: Int64)
|
return $ unSingle rows == (0 :: Int64)
|
||||||
|
|
||||||
tableDropEmpty :: MonadIO m => Text -> ReaderT SqlBackend m ()
|
tableDropEmpty :: MonadIO m => Text -> ReaderT SqlBackend m ()
|
||||||
tableDropEmpty table = do
|
tableDropEmpty table = whenM (tableExists table) $ do
|
||||||
isEmpty <- tableIsEmpty table
|
isEmpty <- tableIsEmpty table
|
||||||
if
|
if
|
||||||
| isEmpty -> rawExecute [st|DROP TABLE "#{table}" CASCADE|] []
|
| isEmpty -> rawExecute [st|DROP TABLE "#{table}" CASCADE|] []
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user