Class: CreateActsAsAliasedTable

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/acts_as_aliased/templates/migration.rb

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/generators/acts_as_aliased/templates/migration.rb', line 2

def change
  create_table :aliases do |t|
    t.integer :aliased_id,    null: false
    t.string  :aliased_type,  null: false
    t.string  :name,          null: false
    t.timestamps
  end

  add_index :aliases, [:aliased_id, :aliased_type]
  add_index :aliases, :name
end