class CreateUserPermissions < ActiveRecord::Migration def change create_table :user_permissions do |t| t.references :account, index: true t.references :user, index: true t.string :email t.string :permissions t.timestamps null: false end add_foreign_key :user_permissions, :accounts add_foreign_key :user_permissions, :users end end