class CreateRoyce

Public Instance Methods

change() click to toggle source
# 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