Sha256: 68feaa396df0f5b64b03ab91a4c12a675cde9848e9b0bb6c6256b154a91658dd

Contents?: true

Size: 466 Bytes

Versions: 5

Compression:

Stored size: 466 Bytes

Contents

class RolifyCreateRoles < ActiveRecord::Migration[5.1]
  def change
    create_table(:roles) do |t|
      t.string :name
      t.references :resource, :polymorphic => true

      t.timestamps
    end

    create_table(:users_roles, :id => false) do |t|
      t.references :user
      t.references :role
    end

    add_index(:roles, :name)
    add_index(:roles, [ :name, :resource_type, :resource_id ])
    add_index(:users_roles, [ :user_id, :role_id ])
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
date_book-0.0.6 spec/dummy/db/migrate/20170807134128_rolify_create_roles.rb
date_book-0.0.5 spec/dummy/db/migrate/20170807134128_rolify_create_roles.rb
date_book-0.0.3 spec/dummy/db/migrate/20170807134128_rolify_create_roles.rb
date_book-0.0.2 spec/dummy/db/migrate/20170807134128_rolify_create_roles.rb
date_book-0.0.1 spec/dummy/db/migrate/20170807134128_rolify_create_roles.rb