Skip to content

Instantly share code, notes, and snippets.

@rodloboz
Created April 27, 2019 02:47
Show Gist options
  • Save rodloboz/38f4c07cc0e5e727d838a1c77a6110f9 to your computer and use it in GitHub Desktop.
Save rodloboz/38f4c07cc0e5e727d838a1c77a6110f9 to your computer and use it in GitHub Desktop.
class CreateFollows < ActiveRecord::Migration[6.0]
def change
create_table 'follows' do |t|
t.integer 'following_id', null: false
t.integer 'follower_id', null: false
t.timestamps null: false
end
add_index :follows, :following_id
add_index :follows, :follower_id
add_index :follows, [:following_id, :follower_id], unique: true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment