Sha256: 3009096efb16df5effcd148f9a7824dbad4f84f080e0388f1bb95a5cb693ecd2

Contents?: true

Size: 705 Bytes

Versions: 17

Compression:

Stored size: 705 Bytes

Contents

# frozen_string_literal: true

class Create<%= model_name.camelize %>Events < ActiveRecord::Migration[7.0]
  def change
    create_table :<%= model_name.underscore %>_events do |t|
      # Change this to string if your aggregates primary key is a string type
      t.bigint :aggregate_id, null: false, index: true
      t.string :idempotency_key, null: true
      t.string :type, null: false
      t.json :data, null: false, default: {}
      t.json :metadata, null: false, default: {}

      t.timestamps

      t.index :idempotency_key, unique: true
    end

    # Enables optimistic locking on the evented table
    add_column :<%= model_name.underscore.pluralize %>, :lock_version, :integer
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
eventsimple-1.4.3 lib/eventsimple/generators/templates/create_events.erb
eventsimple-1.4.2 lib/eventsimple/generators/templates/create_events.erb
eventsimple-1.4.1 lib/eventsimple/generators/templates/create_events.erb
eventsimple-1.4.0 lib/eventsimple/generators/templates/create_events.erb
eventsimple-1.3.3 lib/eventsimple/generators/templates/create_events.erb
eventsimple-1.3.2 lib/eventsimple/generators/templates/create_events.erb
eventsimple-1.3.1 lib/eventsimple/generators/templates/create_events.erb
eventsimple-1.3.0 lib/eventsimple/generators/templates/create_events.erb
eventsimple-1.2.3 lib/eventsimple/generators/templates/create_events.erb
eventsimple-1.2.2 lib/eventsimple/generators/templates/create_events.erb
eventsimple-1.2.1 lib/eventsimple/generators/templates/create_events.erb
eventsimple-1.2.0 lib/eventsimple/generators/templates/create_events.erb
eventsimple-1.1.3 lib/eventsimple/generators/templates/create_events.erb
eventsimple-1.1.2 lib/eventsimple/generators/templates/create_events.erb
eventsimple-1.1.1 lib/eventsimple/generators/templates/create_events.erb
eventsimple-1.1.0 lib/eventsimple/generators/templates/create_events.erb
eventsimple-1.0.0 lib/eventsimple/generators/templates/create_events.erb