Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2024-01-17 18:10:08 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2024-01-17 18:10:08 +0300
commit78a5f872de316860ccd7a983c10805bf6c6b771c (patch)
tree29c394a4114d012cf9dcef37037e1992ef15105d /db
parent14c3ebc6364f7d5eb31cbf2e66a79ec574e88b70 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20240105121755_add_participants_widget_definition_to_work_item_types.rb41
-rw-r--r--db/schema_migrations/202401051217551
2 files changed, 42 insertions, 0 deletions
diff --git a/db/post_migrate/20240105121755_add_participants_widget_definition_to_work_item_types.rb b/db/post_migrate/20240105121755_add_participants_widget_definition_to_work_item_types.rb
new file mode 100644
index 00000000000..7313e14c44e
--- /dev/null
+++ b/db/post_migrate/20240105121755_add_participants_widget_definition_to_work_item_types.rb
@@ -0,0 +1,41 @@
+# frozen_string_literal: true
+
+class AddParticipantsWidgetDefinitionToWorkItemTypes < Gitlab::Database::Migration[2.2]
+ milestone '16.9'
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ WIDGET_NAME = 'Participants'
+ WIDGET_ENUM_VALUE = 20
+
+ def up
+ widgets = []
+
+ work_item_types = define_batchable_model('work_item_types')
+ work_item_types.each_batch do |work_item_types|
+ work_item_types.each do |type|
+ widgets << {
+ work_item_type_id: type.id,
+ name: WIDGET_NAME,
+ widget_type: WIDGET_ENUM_VALUE
+ }
+ end
+ end
+
+ return if widgets.empty?
+
+ work_item_widget_definitions.upsert_all(
+ widgets,
+ unique_by: :index_work_item_widget_definitions_on_default_witype_and_name
+ )
+ end
+
+ def down
+ work_item_widget_definitions.where(name: WIDGET_NAME).delete_all
+ end
+
+ private
+
+ def work_item_widget_definitions
+ define_batchable_model('work_item_widget_definitions')
+ end
+end
diff --git a/db/schema_migrations/20240105121755 b/db/schema_migrations/20240105121755
new file mode 100644
index 00000000000..a476a0ea694
--- /dev/null
+++ b/db/schema_migrations/20240105121755
@@ -0,0 +1 @@
+c4cd2bb2b69cf75a00ae68517d5464a123d7c96bde4665b5c2187cdb8465bc48 \ No newline at end of file