about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-08-11 18:00:41 +0200
committerEugen Rochko <eugen@zeonfederated.com>2018-08-11 18:00:41 +0200
commitcbc2e6bd4094bf2e9d3bf71d7150b8a46cba171b (patch)
treea93356ad3e3fb6901366a93008e90969ea92f695
parent44680c46ed55065d73f6fc64e349b39fa57673e9 (diff)
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.
-rw-r--r--db/migrate/20180528141303_fix_accounts_unique_index.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/db/migrate/20180528141303_fix_accounts_unique_index.rb b/db/migrate/20180528141303_fix_accounts_unique_index.rb
index 96cee37f9..624ea229e 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