Class: AddIndexesToDuctworkTransitions
- Inherits:
-
Ductwork::Migration
- Object
- Ductwork::Migration
- AddIndexesToDuctworkTransitions
- Defined in:
- lib/generators/ductwork/update/templates/db/add_indexes_to_ductwork_transitions.rb
Instance Method Summary collapse
Methods included from Ductwork::MigrationHelper
#belongs_to, #create_ductwork_table, #mysql?, #postgresql?, #uuid_column_type
Instance Method Details
#change ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/generators/ductwork/update/templates/db/add_indexes_to_ductwork_transitions.rb', line 4 def change if mysql? add_index :ductwork_transitions, %i[branch_id completed_at started_at], name: "index_ductwork_transitions_on_latest_open" else add_index :ductwork_transitions, %i[branch_id started_at], where: "completed_at IS NULL", name: "index_ductwork_transitions_on_latest_open" end end |