retrospring/db/migrate/20141130130221_create_relationships.rb
2020-04-19 18:10:31 +02:00

14 lines
353 B
Ruby

class CreateRelationships < ActiveRecord::Migration[4.2]
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