Sha256: 599f5e19be6373f23cf9840bf44373dcb2ab0337426d510b8a8c7a0cd659a480

Contents?: true

Size: 954 Bytes

Versions: 5

Compression:

Stored size: 954 Bytes

Contents

class CreateEcomModelUserRoles < ActiveRecord::Migration[6.0]
  def change
    create_table :ecom_model_user_roles do |t|
      t.string :name, index: false
      t.references :application_module, index: { name: 'ur_on_am_indx' }

      t.timestamps
    end
    add_index :ecom_model_user_roles, %i[name application_module_id], unique: true, name: 'am_name_indx'
    add_foreign_key :ecom_model_user_roles, :ecom_model_application_modules,
                    column: :application_module_id

    create_table :ecom_model_users_user_roles, id: false do |t|
      t.references :user, index: false
      t.references :user_role, index: false
    end

    add_index :ecom_model_users_user_roles, %i[user_id user_role_id], unique: true, name: 'users_user_roles_indx'
    add_foreign_key :ecom_model_users_user_roles, :ecom_model_users, column: :user_id
    add_foreign_key :ecom_model_users_user_roles, :ecom_model_user_roles, column: :user_role_id
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ecom_model-2.0.4 db/migrate/20191202220953_create_ecom_model_user_roles.rb
ecom_model-2.0.3 db/migrate/20191202220953_create_ecom_model_user_roles.rb
ecom_model-2.0.2 db/migrate/20191202220953_create_ecom_model_user_roles.rb
ecom_model-2.0.1 db/migrate/20191202220953_create_ecom_model_user_roles.rb
ecom_model-2.0.0 db/migrate/20191202220953_create_ecom_model_user_roles.rb