Class: CreateRoyce

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

Instance Method Summary collapse

Instance Method Details

#changeObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/generators/royce/templates/create_royce.rb', line 3

def change

  create_table :royce_connector do |t|
    t.references :roleable, polymorphic: true, null: false
    t.references :role, null: false
    t.timestamps
  end

  add_index :royce_connector, [:roleable_id, :roleable_type]
  add_index :royce_connector, :role_id

  create_table :royce_role do |t|
    t.string :name, null: false
    t.timestamps
  end

  add_index :royce_role, :name

end