Skip to content

Commit

Permalink
patch: Allow passing migrations to dev component
Browse files Browse the repository at this point in the history
  • Loading branch information
julienvincent committed Jan 22, 2024
1 parent abf0368 commit 1f3133d
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions packages/mallard/src/k16/mallard/dev.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,30 @@
(:require
[k16.mallard.api :as api]
[k16.mallard.datastore :as datastore.api]
[k16.mallard.loaders.fs :as loaders.fs]))
[k16.mallard.loaders.fs :as loaders.fs]
[k16.mallard.executor :as executor]))

(set! *warn-on-reflection* true)

(def ?Props
[:map
[:migrations-dir :string]
[:store datastore.api/?DataStore]
[:context :any]])
[:and
[:map
[:store datastore.api/?DataStore]
[:context :any]]

[:or
[:map
[:migrations executor/?Migrations]]

[:map
[:migrations-dir :string]]]])

(def run-migrations-component!
{:gx/start
{:gx/processor (fn [{:keys [props]}]
(let [{:keys [store context migrations-dir]} props]
(let [{:keys [store context migrations migrations-dir]} props]
(api/run-up! {:store store
:context context
:migrations (loaders.fs/load-migrations! migrations-dir)})))
:migrations (or migrations
(loaders.fs/load-migrations! migrations-dir))})))
:gx/props-schema ?Props}})

0 comments on commit 1f3133d

Please sign in to comment.