Sha256: 97aa8655eb85269ab7669f0524ce7b89c2ec42ebf552f270eee8842ee5154f39

Contents?: true

Size: 538 Bytes

Versions: 5

Compression:

Stored size: 538 Bytes

Contents

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

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

      t.string :name
      t.<% if options["database"] == "postgresql" %>json<% 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.1.1 lib/generators/ahoy/stores/templates/active_record_events_migration.rb
ahoy_matey-1.1.0 lib/generators/ahoy/stores/templates/active_record_events_migration.rb
ahoy_matey-1.0.2 lib/generators/ahoy/stores/templates/active_record_events_migration.rb
ahoy_matey-1.0.1 lib/generators/ahoy/stores/templates/active_record_events_migration.rb
ahoy_matey-1.0.0 lib/generators/ahoy/stores/templates/active_record_events_migration.rb