diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-13 16:26:31 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-13 16:26:31 +0300 |
commit | b7dfe2ae4054aa40e15182fd3c6cb7dd39f131db (patch) | |
tree | 5ab080ca9cadeb6cd9578bf301e4e9e8810bed9e /db/migrate/20190910103144_replace_events_index_on_group_id_with_partial_index.rb | |
parent | 25cb337cf12438169f1b14bc5dace8a06a7356e3 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/migrate/20190910103144_replace_events_index_on_group_id_with_partial_index.rb')
-rw-r--r-- | db/migrate/20190910103144_replace_events_index_on_group_id_with_partial_index.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/db/migrate/20190910103144_replace_events_index_on_group_id_with_partial_index.rb b/db/migrate/20190910103144_replace_events_index_on_group_id_with_partial_index.rb new file mode 100644 index 00000000000..40a7454fd20 --- /dev/null +++ b/db/migrate/20190910103144_replace_events_index_on_group_id_with_partial_index.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class ReplaceEventsIndexOnGroupIdWithPartialIndex < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index(:events, :group_id, where: 'group_id IS NOT NULL', name: 'index_events_on_group_id_partial') + remove_concurrent_index_by_name(:events, 'index_events_on_group_id') + end + + def down + add_concurrent_index(:events, :group_id, name: 'index_events_on_group_id') + remove_concurrent_index_by_name(:events, 'index_events_on_group_id_partial') + end +end |