diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-03 12:15:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-03 12:15:44 +0300 |
commit | 7d297faa51b362b48c39fe966ff4afac1029ba7c (patch) | |
tree | 424e612f5e5d883dafd6a3c476ccc267f00fb115 /db/post_migrate | |
parent | 27a12ac52d8f27af0ec84c516dc1eebbbc74a6b0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/post_migrate')
-rw-r--r-- | db/post_migrate/20231220115201_add_color_work_item_widget.rb | 44 | ||||
-rw-r--r-- | db/post_migrate/20231220130725_remove_last_edited_at_column_from_vulnerabilities.rb | 15 |
2 files changed, 59 insertions, 0 deletions
diff --git a/db/post_migrate/20231220115201_add_color_work_item_widget.rb b/db/post_migrate/20231220115201_add_color_work_item_widget.rb new file mode 100644 index 00000000000..eb410cb8b0b --- /dev/null +++ b/db/post_migrate/20231220115201_add_color_work_item_widget.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +class AddColorWorkItemWidget < Gitlab::Database::Migration[2.2] + milestone '16.8' + + class WorkItemType < MigrationRecord + self.table_name = 'work_item_types' + end + + class WidgetDefinition < MigrationRecord + self.table_name = 'work_item_widget_definitions' + end + + restrict_gitlab_migration gitlab_schema: :gitlab_main + disable_ddl_transaction! + + WIDGET_NAME = 'Color' + WIDGET_ENUM_VALUE = 18 + WORK_ITEM_TYPE = 'Epic' + + def up + type = WorkItemType.find_by_name_and_namespace_id(WORK_ITEM_TYPE, nil) + + unless type + Gitlab::AppLogger.warn("type #{WORK_ITEM_TYPE} is missing, not adding widget") + return + end + + widget = { + work_item_type_id: type.id, + name: WIDGET_NAME, + widget_type: WIDGET_ENUM_VALUE + } + + WidgetDefinition.upsert_all( + [widget], + unique_by: :index_work_item_widget_definitions_on_default_witype_and_name + ) + end + + def down + WidgetDefinition.where(name: WIDGET_NAME).delete_all + end +end diff --git a/db/post_migrate/20231220130725_remove_last_edited_at_column_from_vulnerabilities.rb b/db/post_migrate/20231220130725_remove_last_edited_at_column_from_vulnerabilities.rb new file mode 100644 index 00000000000..e3e963ee0c0 --- /dev/null +++ b/db/post_migrate/20231220130725_remove_last_edited_at_column_from_vulnerabilities.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class RemoveLastEditedAtColumnFromVulnerabilities < Gitlab::Database::Migration[2.2] + milestone '16.8' + + enable_lock_retries! + + def up + remove_column :vulnerabilities, :last_edited_at + end + + def down + add_column :vulnerabilities, :last_edited_at, :datetime_with_timezone + end +end |