class ActsAsContextableMigration

Public Class Methods

down() click to toggle source
# File lib/generators/acts_as_contextable/migration/templates/active_record/migration.rb, line 15
def self.down
  drop_table :context_references
end
up() click to toggle source
# File lib/generators/acts_as_contextable/migration/templates/active_record/migration.rb, line 2
def self.up
  create_table :context_references do |t|
    t.references :contextable, :polymorphic => true
    t.references :context, :polymorphic => true
    t.timestamps
  end

  if ActiveRecord::VERSION::MAJOR < 4
    add_index :context_references, [:contextable_id, :contextable_type]
    add_index :context_references, [:context_id, :context_type]
  end
end