Skip to content

Commit

Permalink
Same thing
Browse files Browse the repository at this point in the history
  • Loading branch information
mostlyobvious committed Mar 29, 2024
1 parent fe9b7e4 commit 982a402
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ class CreateEventStoreEvents < ActiveRecord::Migration[<%= migration_version %>]
create_table(:event_store_events_in_streams, force: false) do |t|
t.string :stream, null: false
t.integer :position, null: true
t.references :event, null: false, type: :string, limit: 36, index: false
t.references :event, null: false, type: :string, limit: 36, index: true
t.datetime :created_at, null: false, precision: 6, index: true

t.index [:stream, :position], unique: true
t.index [:stream, :event_id], unique: true
end
add_index :event_store_events_in_streams, [:stream, :position], unique: true
add_index :event_store_events_in_streams, [:stream, :event_id], unique: true
add_index :event_store_events_in_streams, [:event_id]

create_table(:event_store_events, force: false) do |t|
t.references :event, null: false, type: :string, limit: 36, index: { unique: true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ class CreateEventStoreEvents < ActiveRecord::Migration[<%= migration_version %>]
create_table(:event_store_events_in_streams, force: false) do |t|
t.string :stream, null: false
t.integer :position, null: true
t.references :event, null: false, type: :string, limit: 36, index: false
t.references :event, null: false, type: :string, limit: 36, index: true
t.datetime :created_at, null: false, precision: 6, index: true

t.index [:stream, :position], unique: true
t.index [:stream, :event_id], unique: true
end
add_index :event_store_events_in_streams, [:stream, :position], unique: true
add_index :event_store_events_in_streams, [:stream, :event_id], unique: true
add_index :event_store_events_in_streams, [:event_id]

create_table(:event_store_events, force: false) do |t|
t.references :event, null: false, type: :string, limit: 36, index: { unique: true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ class CreateEventStoreEvents < ActiveRecord::Migration[<%= migration_version %>]
create_table(:event_store_events_in_streams, id: :bigserial, force: false) do |t|
t.string :stream, null: false
t.integer :position, null: true
t.references :event, null: false, type: :uuid, index: false
t.references :event, null: false, type: :uuid, index: true
t.datetime :created_at, null: false, type: :timestamp, precision: 6, index: true

t.index [:stream, :position], unique: true
t.index [:stream, :event_id], unique: true
end
add_index :event_store_events_in_streams, [:stream, :position], unique: true
add_index :event_store_events_in_streams, [:stream, :event_id], unique: true
add_index :event_store_events_in_streams, [:event_id]

create_table(:event_store_events, id: :bigserial, force: false) do |t|
t.references :event, null: false, type: :uuid, index: { unique: true }
Expand Down
4 changes: 2 additions & 2 deletions ruby_event_store-active_record/spec/migration_test_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ module ActiveRecord
PRIMARY KEY (`id`),
UNIQUE KEY `index_event_store_events_in_streams_on_stream_and_event_id` (`stream`,`event_id`),
UNIQUE KEY `index_event_store_events_in_streams_on_stream_and_position` (`stream`,`position`),
KEY `index_event_store_events_in_streams_on_created_at` (`created_at`),
KEY `index_event_store_events_in_streams_on_event_id` (`event_id`),
KEY `index_event_store_events_in_streams_on_created_at` (`created_at`),
CONSTRAINT `fk_rails_c8d52b5857` FOREIGN KEY (`event_id`) REFERENCES `event_store_events` (`event_id`)
) ENGINE=InnoDB DEFAULT CHARSET=#{charset}#{collation}
SCHEMA
Expand All @@ -129,10 +129,10 @@ module ActiveRecord
FOREIGN KEY ("event_id")
REFERENCES "event_store_events" ("event_id")
)
CREATE INDEX "index_event_store_events_in_streams_on_event_id" ON "event_store_events_in_streams" ("event_id")
CREATE INDEX "index_event_store_events_in_streams_on_created_at" ON "event_store_events_in_streams" ("created_at")
CREATE UNIQUE INDEX "index_event_store_events_in_streams_on_stream_and_position" ON "event_store_events_in_streams" ("stream", "position")
CREATE UNIQUE INDEX "index_event_store_events_in_streams_on_stream_and_event_id" ON "event_store_events_in_streams" ("stream", "event_id")
CREATE INDEX "index_event_store_events_in_streams_on_event_id" ON "event_store_events_in_streams" ("event_id")
SCHEMA
end

Expand Down

0 comments on commit 982a402

Please sign in to comment.