1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-19 13:54:25 +01:00

fix invalid footprints after regeneration in migrations

This commit is contained in:
Sylvain 2021-06-07 14:38:47 +02:00
parent 5d7c024056
commit fda942d386
3 changed files with 25 additions and 0 deletions

View File

@ -190,6 +190,11 @@ class MigrateStripeIdsToPaymentGatewayObjects < ActiveRecord::Migration[5.2]
end
end
InvoiceItem.connection.schema_cache.clear!
InvoiceItem.reset_column_information
Invoice.connection.schema_cache.clear!
Invoice.reset_column_information
# chain all records
InvoiceItem.order(:id).all.each(&:chain_record)
Invoice.order(:id).all.each(&:chain_record)

View File

@ -67,6 +67,11 @@ class AddObjectToInvoiceItem < ActiveRecord::Migration[5.2]
remove_column :invoice_items, :subscription_id
remove_reference :invoices, :invoiced, polymorphic: true
InvoiceItem.connection.schema_cache.clear!
InvoiceItem.reset_column_information
Invoice.connection.schema_cache.clear!
Invoice.reset_column_information
# chain records
puts 'Chaining all record. This may take a while...'
InvoiceItem.order(:id).all.each(&:chain_record)
@ -110,6 +115,11 @@ class AddObjectToInvoiceItem < ActiveRecord::Migration[5.2]
remove_column :invoice_items, :main
remove_reference :invoice_items, :object, polymorphic: true
InvoiceItem.connection.schema_cache.clear!
InvoiceItem.reset_column_information
Invoice.connection.schema_cache.clear!
Invoice.reset_column_information
# chain records
puts 'Chaining all record. This may take a while...'
InvoiceItem.order(:id).all.each(&:chain_record)

View File

@ -42,6 +42,11 @@ class CreatePaymentScheduleObjects < ActiveRecord::Migration[5.2]
remove_column :payment_schedules, :scheduled_type
PaymentScheduleItem.update_all("details = details - 'subscription_id'")
PaymentScheduleItem.connection.schema_cache.clear!
PaymentScheduleItem.reset_column_information
PaymentSchedule.connection.schema_cache.clear!
PaymentSchedule.reset_column_information
# chain records
puts 'Chaining all record. This may take a while...'
PaymentScheduleItem.order(:id).all.each(&:chain_record)
@ -76,6 +81,11 @@ class CreatePaymentScheduleObjects < ActiveRecord::Migration[5.2]
drop_table :payment_schedule_objects
PaymentScheduleItem.connection.schema_cache.clear!
PaymentScheduleItem.reset_column_information
PaymentSchedule.connection.schema_cache.clear!
PaymentSchedule.reset_column_information
# chain records
puts 'Chaining all record. This may take a while...'
PaymentScheduleItem.order(:id).all.each(&:chain_record)