2023-10-19 16:37:34 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-04-19 09:10:31 -07:00
|
|
|
class CreateRelationships < ActiveRecord::Migration[4.2]
|
2014-11-30 05:06:05 -08: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-19 16:37:34 -07:00
|
|
|
add_index :relationships, %i[source_id target_id], unique: true
|
2014-11-30 05:06:05 -08:00
|
|
|
end
|
|
|
|
end
|