retrospring/db/migrate/20141130130221_create_relationships.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
383 B
Ruby
Raw Normal View History

2023-10-20 01:37:34 +02:00
# frozen_string_literal: true
class CreateRelationships < ActiveRecord::Migration[4.2]
2014-11-30 14:06:05 +01:00
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
2023-10-20 01:37:34 +02:00
add_index :relationships, %i[source_id target_id], unique: true
2014-11-30 14:06:05 +01:00
end
end