1 class AddJoinTableBetweenUsersAndDiaryEntries < ActiveRecord::Migration[4.2]
3 create_table :diary_entry_subscriptions, :id => false do |t|
4 t.column :user_id, :bigint, :null => false
5 t.column :diary_entry_id, :bigint, :null => false
8 add_primary_key :diary_entry_subscriptions, [:user_id, :diary_entry_id]
9 add_index :diary_entry_subscriptions, [:diary_entry_id]
10 add_foreign_key :diary_entry_subscriptions, :diary_entries, :name => "diary_entry_subscriptions_diary_entry_id_fkey"
11 add_foreign_key :diary_entry_subscriptions, :users, :name => "diary_entry_subscriptions_user_id_fkey"
15 drop_table :diary_entry_subscriptions