diff options
author | Thibaut Girka <thib@sitedethib.com> | 2020-06-24 15:33:41 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2020-06-24 15:33:41 +0200 |
commit | aae60a2366d6dadbcc4a0197d4dd17afc931c8a0 (patch) | |
tree | 0bbbc278809d9990365a2d79abeaf02891990d51 /db/migrate | |
parent | 5d12b63e79953a7596ae473706985b774d4e51a6 (diff) | |
parent | bb9ca8a587ee5a3ec8778e72828aca0ba8871327 (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - `app/controllers/concerns/sign_in_token_authentication_concern.rb`: Conflict due to glitch-soc's theming system. Ported upstream changes. - `app/controllers/concerns/two_factor_authentication_concern.rb`: Conflict due to glitch-soc's theming system. Ported upstream changes.
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20200620164023_add_fixed_lowercase_index_to_accounts.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/db/migrate/20200620164023_add_fixed_lowercase_index_to_accounts.rb b/db/migrate/20200620164023_add_fixed_lowercase_index_to_accounts.rb new file mode 100644 index 000000000..c5688681f --- /dev/null +++ b/db/migrate/20200620164023_add_fixed_lowercase_index_to_accounts.rb @@ -0,0 +1,15 @@ +class AddFixedLowercaseIndexToAccounts < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + + def up + rename_index :accounts, 'index_accounts_on_username_and_domain_lower', 'old_index_accounts_on_username_and_domain_lower' unless index_name_exists?(:accounts, 'old_index_accounts_on_username_and_domain_lower') + add_index :accounts, "lower (username), COALESCE(lower(domain), '')", name: 'index_accounts_on_username_and_domain_lower', unique: true, algorithm: :concurrently + remove_index :accounts, name: 'old_index_accounts_on_username_and_domain_lower' + end + + def down + add_index :accounts, 'lower (username), lower(domain)', name: 'old_index_accounts_on_username_and_domain_lower', unique: true, algorithm: :concurrently + remove_index :accounts, name: 'index_accounts_on_username_and_domain_lower' + rename_index :accounts, 'old_index_accounts_on_username_and_domain_lower', 'index_accounts_on_username_and_domain_lower' + end +end |