Skip to content

Commit

Permalink
Merge pull request #100 from maksar/order
Browse files Browse the repository at this point in the history
Changing the order to operations
  • Loading branch information
lykahb authored Mar 28, 2022
2 parents 1f82260 + 887bd28 commit 0849c19
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions groundhog/Database/Groundhog/Generic/Migration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,13 @@ getAlters m@MigrationPack {..} (TableInfo oldColumns oldUniques oldRefs) (TableI
colAlters = mapMaybe (\(a, b) -> mkAlterColumn b $ migrateColumn m a b) (filter ((`notElem` primaryColumns) . colName . fst) commonColumns)
mkAlterColumn col alters = if null alters then Nothing else Just $ AlterColumn col alters
tableAlters =
map (DropColumn . colName) oldOnlyColumns
map dropUnique oldOnlyUniques
++ map (DropReference . fromMaybe (error "getAlters: old reference does not have name") . fst) oldOnlyRefs
++ map (DropColumn . colName) oldOnlyColumns
++ map AddColumn newOnlyColumns
++ colAlters
++ map dropUnique oldOnlyUniques
++ map AddUnique newOnlyUniques
++ concatMap (uncurry migrateUniq) commonUniques
++ map (DropReference . fromMaybe (error "getAlters: old reference does not have name") . fst) oldOnlyRefs
++ map (AddReference . snd) newOnlyRefs

-- from database, from datatype
Expand Down

0 comments on commit 0849c19

Please sign in to comment.