I've created table
create_table :friendships , :force => true, :id => false do |t|
t.integer :person_id
t.integer :friend_id
end
Now i need to create id for that table. how can i do that in migration?
I've created table
create_table :friendships , :force => true, :id => false do |t|
t.integer :person_id
t.integer :friend_id
end
Now i need to create id for that table. how can i do that in migration?
The command to add a primary key in a migration is:
add_column :my_table, :id, :primary_key