From 01034c2c457bad1933e954ba01e5f21cdf546168 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 5 Aug 2021 15:09:46 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- ...dd_label_applied_issuable_closed_to_issuable_sla.rb | 8 ++++++++ ...3818_add_index_for_label_applied_to_issuable_sla.rb | 17 +++++++++++++++++ db/migrate/20210729123101_confirm_security_bot.rb | 18 ++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 db/migrate/20210712052519_add_label_applied_issuable_closed_to_issuable_sla.rb create mode 100644 db/migrate/20210714043818_add_index_for_label_applied_to_issuable_sla.rb create mode 100644 db/migrate/20210729123101_confirm_security_bot.rb (limited to 'db/migrate') diff --git a/db/migrate/20210712052519_add_label_applied_issuable_closed_to_issuable_sla.rb b/db/migrate/20210712052519_add_label_applied_issuable_closed_to_issuable_sla.rb new file mode 100644 index 00000000000..216d43dd62d --- /dev/null +++ b/db/migrate/20210712052519_add_label_applied_issuable_closed_to_issuable_sla.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +class AddLabelAppliedIssuableClosedToIssuableSla < ActiveRecord::Migration[6.1] + def change + add_column :issuable_slas, :label_applied, :boolean, default: false, null: false + add_column :issuable_slas, :issuable_closed, :boolean, default: false, null: false + end +end diff --git a/db/migrate/20210714043818_add_index_for_label_applied_to_issuable_sla.rb b/db/migrate/20210714043818_add_index_for_label_applied_to_issuable_sla.rb new file mode 100644 index 00000000000..5931941a95e --- /dev/null +++ b/db/migrate/20210714043818_add_index_for_label_applied_to_issuable_sla.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexForLabelAppliedToIssuableSla < ActiveRecord::Migration[6.1] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + INDEX_NAME = 'index_issuable_slas_on_due_at_id_label_applied_issuable_closed' + + def up + add_concurrent_index :issuable_slas, [:due_at, :id], name: INDEX_NAME, where: 'label_applied = FALSE AND issuable_closed = FALSE' + end + + def down + remove_concurrent_index_by_name :issuable_slas, INDEX_NAME + end +end diff --git a/db/migrate/20210729123101_confirm_security_bot.rb b/db/migrate/20210729123101_confirm_security_bot.rb new file mode 100644 index 00000000000..2184cc4e193 --- /dev/null +++ b/db/migrate/20210729123101_confirm_security_bot.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class ConfirmSecurityBot < ActiveRecord::Migration[6.0] + class User < ActiveRecord::Base + self.table_name = 'users' + SECURITY_BOT_TYPE = 8 + end + + def up + User.where(user_type: User::SECURITY_BOT_TYPE, confirmed_at: nil) + .update_all(confirmed_at: Time.current) + end + + # no-op + # Security Bot should be always confirmed + def down + end +end -- cgit v1.2.1