Files
astuto/db/migrate/20220512184400_create_follows.rb

13 lines
309 B
Ruby
Raw Normal View History

class CreateFollows < ActiveRecord::Migration[6.0]
def change
create_table :follows do |t|
t.references :user, null: false, foreign_key: true
t.references :post, null: false, foreign_key: true
t.timestamps
end
add_index :follows, [:user_id, :post_id], unique: true
end
end