class CreateEcomModelUsers < ActiveRecord::Migration[6.0] def change create_table :ecom_model_users do |t| t.string :first_name, null: false t.string :last_name, null: false t.string :email, null: false t.boolean :active, null: false, default: true t.string :password_digest t.timestamps end create_table :ecom_model_application_modules_users, id: false do |t| t.references :user, index: false t.references :application_module, index: false end add_index :ecom_model_application_modules_users, %i[user_id application_module_id], name: 'am_on_users_indx' add_foreign_key :ecom_model_application_modules_users, :ecom_model_users, column: :user_id add_foreign_key :ecom_model_application_modules_users, :ecom_model_application_modules, column: :application_module_id end end