Class: CreateResoEnumerationAssignments

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/reso/install/templates/create_reso_enumeration_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/reso/install/templates/create_reso_enumeration_assignments.rb', line 2

def change
  create_table :reso_enumeration_assignments do |t|
    t.string :type
    t.references :enumerable, polymorphic: true, index: false
    t.references :enumeration, index: true
    t.timestamps
  end
  add_index :reso_enumeration_assignments, :type
  add_index :reso_enumeration_assignments,
    [:enumerable_type, :enumerable_id],
    {name: "index_on_enumerable_type_and_id"}
end