Class: RoleMakingCreateRoles

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/templates/migrate.rb

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/generators/templates/migrate.rb', line 2

def change
  create_table(:roles) do |t|
    t.string :name
    t.string :display_name

    t.timestamps
  end

  create_table(:users_roles, :id => false) do |t|
    t.integer :user_id
    t.integer :role_id
  end

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