Sha256: 99d88cbbbd135a47cb4e3eb649230f40aa3252610c22583153b7cf5a04a84ee8

Contents?: true

Size: 798 Bytes

Versions: 52

Compression:

Stored size: 798 Bytes

Contents

class UserRoles < ActiveRecord::Migration
  def self.up
    create_table :user_roles do |t|
      t.string :name
      t.string :display_name
      t.integer :priority

      t.references :roleable, :polymorphic => true
      t.timestamps
    end

    create_table :user_role_mappings do |t|
      t.belongs_to :user
      t.belongs_to :user_role
      t.timestamps
    end

    add_index :user_roles, [:roleable_id, :roleable_type]
    add_index :user_roles, [:roleable_id, :roleable_type, :name]
    add_index :user_role_mappings, [:user_id]
    add_index :user_role_mappings, [:user_role_id]

    public_access = UserRole.create(:name => "public", :display_name => "Public Access", :priority => 600)
  end

  def self.down
    drop_table :user_roles
    drop_table :user_role_mappings
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
role_authorization-0.9.6 migrations/01_user_roles.rb
role_authorization-0.9.5 migrations/01_user_roles.rb
role_authorization-0.9.4 migrations/01_user_roles.rb
role_authorization-0.9.3 migrations/01_user_roles.rb
role_authorization-0.9.2 migrations/01_user_roles.rb
role_authorization-0.9.1 migrations/01_user_roles.rb
role_authorization-0.9.0 migrations/01_user_roles.rb
role_authorization-0.6.2 migrations/01_user_roles.rb
role_authorization-0.6.1 migrations/01_user_roles.rb
role_authorization-0.6.0 migrations/01_user_roles.rb
role_authorization-0.5.9 migrations/01_user_roles.rb
role_authorization-0.5.8 migrations/01_user_roles.rb
role_authorization-0.5.7 migrations/01_user_roles.rb
role_authorization-0.5.6 migrations/01_user_roles.rb
role_authorization-0.5.5 migrations/01_user_roles.rb
role_authorization-0.5.4 migrations/01_user_roles.rb
role_authorization-0.5.3 migrations/01_user_roles.rb
role_authorization-0.5.2 migrations/01_user_roles.rb
role_authorization-0.5.1 migrations/01_user_roles.rb
role_authorization-0.5.0 migrations/01_user_roles.rb