Getting started

EventStore is available in Hex and can be installed as follows:

  1. Add eventstore to your list of dependencies in mix.exs:

      def deps do
        [{:eventstore, "~> 0.13"}]
      end
  2. Add an eventstore config entry containing the PostgreSQL database connection details to each environment’s mix config file (e.g. config/dev.exs):

      config :eventstore, EventStore.Storage,
        serializer: EventStore.TermSerializer,
        username: "postgres",
        password: "postgres",
        database: "eventstore_dev",
        hostname: "localhost",
        pool_size: 10,
        pool_overflow: 5

    The database connection pool configuration options are:

  • :pool_size - The number of connections (default: 10).
  • :pool_overflow - The maximum number of overflow connections to start if all connections are checked out (default: 0).
  1. Create the EventStore database and tables using the mix task:

      $ mix do event_store.create, event_store.init

Initialize an existing database

You can use an existing PostgreSQL database with EventStore by running the mix task:

$ mix event_store.init

Reset an existing database

To drop an existing EventStore database and recreate it you can run the mix task:

$ mix event_store.reset

Warning this will delete all EventStore data.