Sha256: 978dad01063f445ea90aa9f2fa00760ca2492bbb6eec1789f4dbc82c41812e8f

Contents?: true

Size: 455 Bytes

Versions: 22

Compression:

Stored size: 455 Bytes

Contents

class RolifyCreateRoles < ActiveRecord::Migration
  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

22 entries across 22 versions & 1 rubygems

Version Path
paid_up-0.9.15 spec/dummy/db/migrate/20150523010837_rolify_create_roles.rb
paid_up-0.9.14 spec/dummy/db/migrate/20150523010837_rolify_create_roles.rb