Closed slashdotdash closed 5 years ago
The EventStore mix tasks, such as mix event_store.create, delegate the actual work to corresponding task modules defined inside EventStore (in lib/mix/tasks) so you can use them directly:
mix event_store.create
lib/mix/tasks
Tasks.EventStore.Create
Tasks.EventStore.Init
Tasks.EventStore.Migrate
Mix releases support running one-off commands and using a helper module to define these commands, example below.
defmodule MyApp.ReleaseTasks do def init_event_store do {:ok, _} = Application.ensure_all_started(:postgrex) {:ok, _} = Application.ensure_all_started(:ssl) :ok = Application.load(:eventstore) config = EventStore.Config.parsed() EventStore.Tasks.Create.exec(config, []) EventStore.Tasks.Init.exec(config, []) end end
Run a release task:
bin/RELEASE_NAME eval "MyApp.ReleaseTasks.init_event_store()"
Just wanted to note here that you now (version 1.0) have to do Your.EventStore.config() instead of EventStore.Config.parsed().
Your.EventStore.config()
EventStore.Config.parsed()
The EventStore mix tasks, such as
mix event_store.create
, delegate the actual work to corresponding task modules defined inside EventStore (inlib/mix/tasks
) so you can use them directly:Tasks.EventStore.Create
Tasks.EventStore.Init
Tasks.EventStore.Migrate
Mix releases support running one-off commands and using a helper module to define these commands, example below.
Run a release task: