Class: CreateAssignments

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

Instance Method Summary collapse

Instance Method Details

#changeObject



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

def change
  create_table :assignments do |t|
    t.references :human, polymorphic: true
    t.references :role, null: false
    t.string :source
  end

  add_index :assignments, :human_id
  add_index :assignments, :role_id
  add_index :assignments, :source
  add_index :assignments, [:human_id, :role_id]
end