From c74125df6ae4ff74b54388c4d046c07820326031 Mon Sep 17 00:00:00 2001 From: ThibG Date: Sat, 11 Aug 2018 18:00:41 +0200 Subject: [PATCH] Make some migration script more robust (fixes #8007) (#8170) Include a dummy Account class in the migration script containing only the attributes relevant to the migration in order to not rely as much on the codebase being in sync with the database schema. --- db/migrate/20180528141303_fix_accounts_unique_index.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/db/migrate/20180528141303_fix_accounts_unique_index.rb b/db/migrate/20180528141303_fix_accounts_unique_index.rb index 96cee37f9c..624ea229e4 100644 --- a/db/migrate/20180528141303_fix_accounts_unique_index.rb +++ b/db/migrate/20180528141303_fix_accounts_unique_index.rb @@ -1,4 +1,13 @@ class FixAccountsUniqueIndex < ActiveRecord::Migration[5.2] + class Account < ApplicationRecord + # Dummy class, to make migration possible across version changes + has_one :user, inverse_of: :account + + def local? + domain.nil? + end + end + disable_ddl_transaction! def up