Skip to content

Commit 9596e31

Browse files
author
Albert Lai
committed
Fix migration ordering
1 parent fbc31aa commit 9596e31

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/ragtime/cli/duct.clj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,19 @@
2929

3030
(defmethod cc/prepare-options :duct
3131
[{:keys [database-url config-file resources-dir reporter] :as ins}]
32-
(let [config (-> (get-config config-file resources-dir)
32+
(let [raw-config (get-config config-file resources-dir)
33+
migration-order (get-in raw-config [:duct.profile/base :duct.migrator/ragtime :migrations])
34+
config (-> raw-config
3335
(remove-duct-module)
3436
(duct/prep-config [:duct.profile/prod])
3537
(ig/init [:duct.migrator.ragtime/sql]))]
3638
(merge
3739
ins
3840
{:database {:spec {:connection-uri database-url}}
3941
:reporter (cc/get-reporter reporter)
40-
:migrations (map second config)})))
42+
:migrations (map (fn [{:keys [key]}]
43+
(get config [:duct.migrator.ragtime/sql key]))
44+
migration-order)})))
4145

4246
(defmethod cc/migrate-all :duct
4347
[opts]

0 commit comments

Comments
 (0)