Skip to content

Instantly share code, notes, and snippets.

@kousuke-takeuchi
Created October 14, 2013 17:10
Show Gist options
  • Save kousuke-takeuchi/6978841 to your computer and use it in GitHub Desktop.
Save kousuke-takeuchi/6978841 to your computer and use it in GitHub Desktop.
class CreateRelationships < ActiveRecord::Migration
def change
create_table :relationships do |t|
t.integer :follower_id
t.integer :followed_id
t.timestamps
end
add_index :relationships, :follower_id
add_index :relationships, :followed_id
add_index :relationships, [:follower_id, :followed_id], unique: true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment