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 ->
|
||||
-- Major changes happend to the structure of exams without appropriate
|
||||
-- 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"
|
||||
| otherwise ->
|
||||
[executeQQ|
|
||||
@ -570,7 +576,7 @@ tableIsEmpty table = do
|
||||
return $ unSingle rows == (0 :: Int64)
|
||||
|
||||
tableDropEmpty :: MonadIO m => Text -> ReaderT SqlBackend m ()
|
||||
tableDropEmpty table = do
|
||||
tableDropEmpty table = whenM (tableExists table) $ do
|
||||
isEmpty <- tableIsEmpty table
|
||||
if
|
||||
| isEmpty -> rawExecute [st|DROP TABLE "#{table}" CASCADE|] []
|
||||
|
||||
Loading…
Reference in New Issue
Block a user