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.13.3 spec/dummy/db/migrate/20150523010837_rolify_create_roles.rb
paid_up-0.13.2 spec/dummy/db/migrate/20150523010837_rolify_create_roles.rb
paid_up-0.13.1 spec/dummy/db/migrate/20150523010837_rolify_create_roles.rb
paid_up-0.13.0 spec/dummy/db/migrate/20150523010837_rolify_create_roles.rb
paid_up-0.12.4 spec/dummy/db/migrate/20150523010837_rolify_create_roles.rb
paid_up-0.12.3 spec/dummy/db/migrate/20150523010837_rolify_create_roles.rb
paid_up-0.11.7 spec/dummy/db/migrate/20150523010837_rolify_create_roles.rb
paid_up-0.11.6 spec/dummy/db/migrate/20150523010837_rolify_create_roles.rb
paid_up-0.11.5 spec/dummy/db/migrate/20150523010837_rolify_create_roles.rb
paid_up-0.11.4 spec/dummy/db/migrate/20150523010837_rolify_create_roles.rb
paid_up-0.11.3 spec/dummy/db/migrate/20150523010837_rolify_create_roles.rb
paid_up-0.11.2 spec/dummy/db/migrate/20150523010837_rolify_create_roles.rb
paid_up-0.11.1 spec/dummy/db/migrate/20150523010837_rolify_create_roles.rb
paid_up-0.11.0 spec/dummy/db/migrate/20150523010837_rolify_create_roles.rb
paid_up-0.10.4 spec/dummy/db/migrate/20150523010837_rolify_create_roles.rb
paid_up-0.10.3 spec/dummy/db/migrate/20150523010837_rolify_create_roles.rb
paid_up-0.10.2 spec/dummy/db/migrate/20150523010837_rolify_create_roles.rb
paid_up-0.10.1 spec/dummy/db/migrate/20150523010837_rolify_create_roles.rb
paid_up-0.10.0 spec/dummy/db/migrate/20150523010837_rolify_create_roles.rb
paid_up-0.9.16 spec/dummy/db/migrate/20150523010837_rolify_create_roles.rb