diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-16 13:42:19 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-16 13:42:19 +0300 |
commit | 84d1bd786125c1c14a3ba5f63e38a4cc736a9027 (patch) | |
tree | f550fa965f507077e20dbb6d61a8269a99ef7107 /db/post_migrate/20231217053910_remove_due_date_sourcing_milestone_id_column_from_vulnerabilities.rb | |
parent | 3a105e36e689f7b75482236712f1a47fd5a76814 (diff) |
Add latest changes from gitlab-org/gitlab@16-8-stable-eev16.8.0-rc42
Diffstat (limited to 'db/post_migrate/20231217053910_remove_due_date_sourcing_milestone_id_column_from_vulnerabilities.rb')
-rw-r--r-- | db/post_migrate/20231217053910_remove_due_date_sourcing_milestone_id_column_from_vulnerabilities.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/db/post_migrate/20231217053910_remove_due_date_sourcing_milestone_id_column_from_vulnerabilities.rb b/db/post_migrate/20231217053910_remove_due_date_sourcing_milestone_id_column_from_vulnerabilities.rb new file mode 100644 index 00000000000..5cd41dff0ef --- /dev/null +++ b/db/post_migrate/20231217053910_remove_due_date_sourcing_milestone_id_column_from_vulnerabilities.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class RemoveDueDateSourcingMilestoneIdColumnFromVulnerabilities < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + + milestone '16.8' + + def up + with_lock_retries do + remove_column :vulnerabilities, :due_date_sourcing_milestone_id + end + end + + def down + unless column_exists?(:vulnerabilities, :due_date_sourcing_milestone_id) + add_column :vulnerabilities, :due_date_sourcing_milestone_id, :bigint + end + + # Add back index and constraint that were dropped in `up` + add_concurrent_index(:vulnerabilities, :due_date_sourcing_milestone_id) + add_concurrent_foreign_key(:vulnerabilities, :milestones, column: :due_date_sourcing_milestone_id, + on_delete: :nullify) + end +end |