Class: CreateMentions

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/socialization/templates/active_record/migration_mentions.rb

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/generators/socialization/templates/active_record/migration_mentions.rb', line 2

def change
  create_table :mentions do |t|
    t.string  :mentioner_type
    t.integer :mentioner_id
    t.string  :mentionable_type
    t.integer :mentionable_id
    t.datetime :created_at
  end

  add_index :mentions, ["mentioner_id", "mentioner_type"],   :name => "fk_mentions"
  add_index :mentions, ["mentionable_id", "mentionable_type"], :name => "fk_mentionables"
end