diff options
author | ThibG <thib@sitedethib.com> | 2018-08-11 18:00:41 +0200 |
---|---|---|
committer | ThibG <thib@sitedethib.com> | 2018-08-13 18:17:20 +0200 |
commit | 2a9950b2e2ad6c55f39409b023d5373f4ea604e1 (patch) | |
tree | aff306da4e35b4dfdc5e181dbc10b1a38a82209a /db/migrate/20180528141303_fix_accounts_unique_index.rb | |
parent | d215c43cdae0e7f5b8b682c42334bc8f5e8ce19f (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.
Diffstat (limited to 'db/migrate/20180528141303_fix_accounts_unique_index.rb')
-rw-r--r-- | db/migrate/20180528141303_fix_accounts_unique_index.rb | 9 |
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 |