Retrospring/db/migrate/20141130130221_create_relat...

15 lines
348 B
Ruby
Raw Normal View History

2014-11-30 05:06:05 -08:00
class CreateRelationships < ActiveRecord::Migration
def change
create_table :relationships do |t|
t.integer :source_id
t.integer :target_id
t.timestamps
end
add_index :relationships, :source_id
add_index :relationships, :target_id
add_index :relationships, [:source_id, :target_id], unique: true
end
end