class CreateEventStoreEvents < ActiveRecord::Migration
  def change
    create_table(:event_store_events) do |t|
      t.string      :stream,      null: false
      t.string      :event_type,  null: false
      t.string      :event_id,    null: false
      t.text        :metadata
      t.text        :data,        null: false
      t.datetime    :created_at,  null: false
    end
    add_index :event_store_events, :stream
    add_index :event_store_events, :event_id, unique: true
  end
end

class CreateEventStoreEvents < ActiveRecord::Migration
  def change
    create_table(:event_store_events) do |t|
      t.string      :stream,      null: false
      t.string      :event_type,  null: false
      t.string      :event_id,    null: false
      t.text        :metadata
      t.text        :data,        null: false
      t.datetime    :created_at,  null: false
    end
    add_index :event_store_events, :stream
    add_index :event_store_events, :created_at
    add_index :event_store_events, :event_type
    add_index :event_store_events, :event_id, unique: true
  end
end

Index commonly searched fields: time and type.
Index commonly searched fields: time and type.

* while working on another event store implementation it has proven very
  useful (and frequent) to filter by time and type of events recorded in
  store
* however there are no methods in EventRepository that would currently
  benefit from this change

What do you think?
