Sha256: 9418598d10033ea74e637a2d68f6460a6b6242388f0cdab5b42ea61c04b8c201

Contents?: true

Size: 604 Bytes

Versions: 5

Compression:

Stored size: 604 Bytes

Contents

class <%= migration_class_name %> < ActiveRecord::Migration
  def change
    create_table :ahoy_events, id: false do |t|
      t.uuid :id, default: nil, primary_key: true
      t.uuid :visit_id, default: nil

      # user
      t.integer :user_id
      # add t.string :user_type if polymorphic

      t.string :name
      t.<% case options["database"] when "postgresql" %>json<% when "postgresql-jsonb" %>jsonb<% else %>text<% end %> :properties
      t.timestamp :time
    end

    add_index :ahoy_events, [:visit_id]
    add_index :ahoy_events, [:user_id]
    add_index :ahoy_events, [:time]
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ahoy_matey-1.3.1 lib/generators/ahoy/stores/templates/active_record_events_migration.rb
ahoy_matey-1.3.0 lib/generators/ahoy/stores/templates/active_record_events_migration.rb
ahoy_matey-1.2.2 lib/generators/ahoy/stores/templates/active_record_events_migration.rb
ahoy_matey-1.2.1 lib/generators/ahoy/stores/templates/active_record_events_migration.rb
ahoy_matey-1.2.0 lib/generators/ahoy/stores/templates/active_record_events_migration.rb