summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-05 15:09:46 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-05 15:09:46 +0000
commit01034c2c457bad1933e954ba01e5f21cdf546168 (patch)
tree26770a101ba1afad20aa10cbd1a0e52c0e88a05a /db/migrate
parent5147cd60f141434f82ce95cc9039afddf415f02b (diff)
downloadgitlab-ce-01034c2c457bad1933e954ba01e5f21cdf546168.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20210712052519_add_label_applied_issuable_closed_to_issuable_sla.rb8
-rw-r--r--db/migrate/20210714043818_add_index_for_label_applied_to_issuable_sla.rb17
-rw-r--r--db/migrate/20210729123101_confirm_security_bot.rb18
3 files changed, 43 insertions, 0 deletions
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