Class: UpdateProcessAssociations
- Inherits:
-
Ductwork::Migration
- Object
- Ductwork::Migration
- UpdateProcessAssociations
- Defined in:
- lib/generators/ductwork/update/templates/db/update_process_associations.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 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/generators/ductwork/update/templates/db/update_process_associations.rb', line 4 def change remove_column :ductwork_availabilities, :process_id, :integer = if postgresql? { type: uuid_column_type, index: true, null: true, foreign_key: { to_table: :ductwork_processes }, } else { type: uuid_column_type, limit: 36, index: true, null: true, foreign_key: { to_table: :ductwork_processes }, } end add_reference :ductwork_availabilities, :process, ** add_index :ductwork_availabilities, %i[id process_id] remove_column :ductwork_executions, :process_id, :integer end |