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.4.5 migrations/01_user_roles.rb
role_authorization-0.4.4 migrations/01_user_roles.rb
role_authorization-0.4.3 migrations/01_user_roles.rb
role_authorization-0.4.2 migrations/01_user_roles.rb
role_authorization-0.4.1 migrations/01_user_roles.rb
role_authorization-0.4.0 migrations/01_user_roles.rb
role_authorization-0.3.9 migrations/01_user_roles.rb
role_authorization-0.3.8 migrations/01_user_roles.rb
role_authorization-0.3.7 migrations/01_user_roles.rb
role_authorization-0.3.6 migrations/01_user_roles.rb
role_authorization-0.3.5 migrations/01_user_roles.rb
role_authorization-0.3.4 migrations/01_user_roles.rb
role_authorization-0.3.3 migrations/01_user_roles.rb
role_authorization-0.3.2 migrations/01_user_roles.rb
role_authorization-0.3.1 migrations/01_user_roles.rb
role_authorization-0.3.0 migrations/01_user_roles.rb
role_authorization-0.2.8 migrations/01_user_roles.rb
role_authorization-0.2.7 migrations/01_user_roles.rb
role_authorization-0.2.6 migrations/01_user_roles.rb
role_authorization-0.2.5 migrations/01_user_roles.rb