From 5bfb8d1fad825eec90b0af688c7cd1b352c9056e Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 18 Mar 2020 18:09:35 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- ...00212052620_readd_template_column_to_services.rb | 2 ++ ...le_type_and_noteable_id_to_sent_notifications.rb | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 db/post_migrate/20200311192351_add_index_on_noteable_type_and_noteable_id_to_sent_notifications.rb (limited to 'db/post_migrate') diff --git a/db/post_migrate/20200212052620_readd_template_column_to_services.rb b/db/post_migrate/20200212052620_readd_template_column_to_services.rb index e54b9e39277..2b0d26b2ad4 100644 --- a/db/post_migrate/20200212052620_readd_template_column_to_services.rb +++ b/db/post_migrate/20200212052620_readd_template_column_to_services.rb @@ -7,6 +7,7 @@ class ReaddTemplateColumnToServices < ActiveRecord::Migration[6.0] disable_ddl_transaction! + # rubocop:disable Migration/UpdateLargeTable def up return if column_exists? :services, :template @@ -16,6 +17,7 @@ class ReaddTemplateColumnToServices < ActiveRecord::Migration[6.0] # of `template`, we would look for entries with `project_id IS NULL`. add_column_with_default :services, :template, :boolean, default: false, allow_null: true end + # rubocop:enable Migration/UpdateLargeTable def down # NOP since the column is expected to exist diff --git a/db/post_migrate/20200311192351_add_index_on_noteable_type_and_noteable_id_to_sent_notifications.rb b/db/post_migrate/20200311192351_add_index_on_noteable_type_and_noteable_id_to_sent_notifications.rb new file mode 100644 index 00000000000..fa0246218c3 --- /dev/null +++ b/db/post_migrate/20200311192351_add_index_on_noteable_type_and_noteable_id_to_sent_notifications.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class AddIndexOnNoteableTypeAndNoteableIdToSentNotifications < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_sent_notifications_on_noteable_type_noteable_id' + + disable_ddl_transaction! + + def up + add_concurrent_index :sent_notifications, + [:noteable_id], + name: INDEX_NAME, + where: "noteable_type = 'Issue'" + end + + def down + remove_concurrent_index_by_name :sent_notifications, INDEX_NAME + end +end -- cgit v1.2.1