Class: CreatePermissions

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

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/generators/templates/migrations/create_permissions.rb', line 2

def change
  create_table :permissions do |t|
    t.integer :role_id
    t.integer :action_id

    t.timestamps
  end

  add_index :permissions, :role_id
  add_index :permissions, :action_id
  add_index :permissions, [:role_id, :action_id], unique: true
end