Skip to content

Commit

Permalink
Fix direction choice while migration (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
abogoyavlensky authored Jan 11, 2024
1 parent bc08db9 commit 9a14843
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/automigrate/migrations.clj
Original file line number Diff line number Diff line change
Expand Up @@ -941,9 +941,9 @@
(get-detailed-migrations-to-migrate all-migrations-detailed migrated number)]
(if (seq to-migrate)
(doseq [{:keys [migration-name file-name migration-type number-int]} to-migrate]
(if (= direction FORWARD-DIRECTION)
(println (str "Applying " migration-name "..."))
(println (str "Reverting " migration-name "...")))
(condp = direction
FORWARD-DIRECTION (println (str "Applying " migration-name "..."))
BACKWARD-DIRECTION (println (str "Reverting " migration-name "...")))
(jdbc/with-transaction [tx db]
(let [actions (migration->actions {:file-name file-name
:migrations-dir migrations-dir
Expand Down
3 changes: 2 additions & 1 deletion test/automigrate/testing_util.clj
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@
(defn perform-make-and-migrate!
[{:keys [jdbc-url existing-actions existing-models direction]
:or {existing-actions []
existing-models {}}}]
existing-models {}
direction :forward}}]
(bond/with-spy [migrations/make-next-migration]
; Generate new actions
(make-migration! {:existing-models existing-models
Expand Down

0 comments on commit 9a14843

Please sign in to comment.