commanded / eventstore

Event store using PostgreSQL for persistence
MIT License
1.06k stars 146 forks source link

Support Postgres schemas #182

Closed slashdotdash closed 4 years ago

slashdotdash commented 5 years ago

Allow an event store to specify a Postgres schema. By default the public schema will be used.

defmodule MyApp.EventStore do
  use EventStore, otp_app: :my_app, schema: "example"
end

Or define it in environment config when configuring the database connection settings:

# config/config.exs
config :my_app, MyApp.EventStore, schema: "example"

This feature allows you to define and start multiple event stores sharing a single Postgres database, but with their data isolated and segregated by schema.

Note the mix event_store.<task> tasks to create, initialize, and drop an event store database will also handle creating and/or dropping the schema.