Sha256: 66c8e58626635ad0877dccdcc0d473a3e4b6bc7c79d13abe69493d23086c687a

Contents?: true

Size: 1019 Bytes

Versions: 5

Compression:

Stored size: 1019 Bytes

Contents

class CreateEcomModelMenus < ActiveRecord::Migration[6.0]
  def change
    create_table :ecom_model_menus do |t|
      t.string :label, null: false
      t.string :icon
      t.string :route, null: false
      t.references :parent, index: { name: 'menus_on_menus_indx' }
      t.references :application_module, index: { name: 'menus_on_am_indx' }

      t.timestamps
    end

    add_foreign_key :ecom_model_menus, :ecom_model_menus, column: :parent_id
    add_foreign_key :ecom_model_menus, :ecom_model_application_modules, column: :application_module_id

    create_table :ecom_model_menus_user_roles, id: false do |t|
      t.references :menu, index: false
      t.references :user_role, index: false
    end

    add_index :ecom_model_menus_user_roles, %i[menu_id user_role_id], unique: true, name: 'menus_user_roles_indx'
    add_foreign_key :ecom_model_menus_user_roles, :ecom_model_menus, column: :menu_id
    add_foreign_key :ecom_model_menus_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/20191202221423_create_ecom_model_menus.rb
ecom_model-2.0.3 db/migrate/20191202221423_create_ecom_model_menus.rb
ecom_model-2.0.2 db/migrate/20191202221423_create_ecom_model_menus.rb
ecom_model-2.0.1 db/migrate/20191202221423_create_ecom_model_menus.rb
ecom_model-2.0.0 db/migrate/20191202221423_create_ecom_model_menus.rb