From 3b2d4820ccd1586973a321832d6b0a2352f5dce6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sat, 18 Jan 2020 13:59:02 +0100 Subject: [PATCH] Don't audit Globalize data migrations There's a conflict between the data migrations Globalize uses and the audited configuration. Since Globalize uses the model to run the migrations, it might try to run code that wasn't available when the migration was created. In this case, when migrating data it tries to audit the translations table for budget investments. However, the migration creating the table for audits hasn't been run at this point, since it was added after the migration to add translations to investments was. On the other hand, this data migration isn't really a change in the model attibutes, so it shouldn't be audited anyway. So we're disabling auditing during the migration in order to avoid these issues. --- ...4094002_add_budget_investment_translations.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/db/migrate/20181214094002_add_budget_investment_translations.rb b/db/migrate/20181214094002_add_budget_investment_translations.rb index a2da96021..51b9fd048 100644 --- a/db/migrate/20181214094002_add_budget_investment_translations.rb +++ b/db/migrate/20181214094002_add_budget_investment_translations.rb @@ -1,12 +1,14 @@ class AddBudgetInvestmentTranslations < ActiveRecord::Migration[4.2] def self.up - Budget::Investment.create_translation_table!( - { - title: :string, - description: :text - }, - { migrate_data: true } - ) + Budget::Investment::Translation.without_auditing do + Budget::Investment.create_translation_table!( + { + title: :string, + description: :text + }, + { migrate_data: true } + ) + end end def self.down