mirror of
https://github.com/astuto/astuto.git
synced 2025-12-15 11:17:49 +01:00
13 lines
303 B
Ruby
13 lines
303 B
Ruby
|
|
class CreateLikes < ActiveRecord::Migration[6.0]
|
||
|
|
def change
|
||
|
|
create_table :likes do |t|
|
||
|
|
t.references :user, null: false, foreign_key: true
|
||
|
|
t.references :post, null: false, foreign_key: true
|
||
|
|
|
||
|
|
t.timestamps
|
||
|
|
end
|
||
|
|
|
||
|
|
add_index :likes, [:user_id, :post_id], unique: true
|
||
|
|
end
|
||
|
|
end
|