diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-03-12 20:54:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-12 20:54:13 +0100 |
commit | 988f5bf0266483659b03f1b0926d0b9ff9e85a8f (patch) | |
tree | 1e0a0011a890729f45c0d364641c266864e78d02 /db/post_migrate/20220310060653_optimize_null_index_users_created_by_application_id.rb | |
parent | 2c8bb1745359a3bf200d37383dc56d5951e2b6bc (diff) | |
parent | 8d4b5ee3ef5e8df3a92e19f2c3f3a4560341eef3 (diff) |
Merge pull request #1716 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'db/post_migrate/20220310060653_optimize_null_index_users_created_by_application_id.rb')
-rw-r--r-- | db/post_migrate/20220310060653_optimize_null_index_users_created_by_application_id.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/db/post_migrate/20220310060653_optimize_null_index_users_created_by_application_id.rb b/db/post_migrate/20220310060653_optimize_null_index_users_created_by_application_id.rb new file mode 100644 index 000000000..364939d3a --- /dev/null +++ b/db/post_migrate/20220310060653_optimize_null_index_users_created_by_application_id.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +require Rails.root.join('lib', 'mastodon', 'migration_helpers') + +class OptimizeNullIndexUsersCreatedByApplicationId < ActiveRecord::Migration[5.2] + include Mastodon::MigrationHelpers + + disable_ddl_transaction! + + def up + update_index :users, 'index_users_on_created_by_application_id', :created_by_application_id, where: 'created_by_application_id IS NOT NULL' + end + + def down + update_index :users, 'index_users_on_created_by_application_id', :created_by_application_id + end +end |