From 2f8e48e4b2a4edc50423b95c93e2be3c5d660526 Mon Sep 17 00:00:00 2001 From: Michael Becker <11881043-wandering_person@users.noreply.gitlab.com> Date: Wed, 13 Dec 2023 21:05:12 +0700 Subject: [PATCH] Drop `due_date` Column From Vulnerabilities `due_date` is an ignored column ([source][0]) This commit drops the column for step 2 of the [3-MR drop column process][1] Using the command `\d+ vulnerabilities` on [postgres.ai][2] indicates **there are NOT indexes and constraints** Related to https://gitlab.com/gitlab-org/gitlab/-/issues/268154 [0]:https://gitlab.com/gitlab-org/gitlab/-/blob/0ef7ab245a0952c68232b3a3418b673b912b5115/app/models/vulnerability.rb#L8-11 [1]:https://docs.gitlab.com/ee/development/database/avoiding_downtime_in_migrations.html#the-removed-column-has-no-indexes-or-constraints-that-belong-to-it [2]:https://console.postgres.ai Changelog: removed --- ...remove_due_date_column_from_vulnerabilities.rb | 15 +++++++++++++++ db/schema_migrations/20231225133628 | 1 + db/structure.sql | 1 - ee/spec/models/ee/vulnerability_spec.rb | 2 +- 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 db/post_migrate/20231225133628_remove_due_date_column_from_vulnerabilities.rb create mode 100644 db/schema_migrations/20231225133628 diff --git a/db/post_migrate/20231225133628_remove_due_date_column_from_vulnerabilities.rb b/db/post_migrate/20231225133628_remove_due_date_column_from_vulnerabilities.rb new file mode 100644 index 00000000000000..2f77a5a82f46dd --- /dev/null +++ b/db/post_migrate/20231225133628_remove_due_date_column_from_vulnerabilities.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class RemoveDueDateColumnFromVulnerabilities < Gitlab::Database::Migration[2.2] + milestone '16.8' + + enable_lock_retries! + + def up + remove_column :vulnerabilities, :due_date + end + + def down + add_column :vulnerabilities, :due_date, :date + end +end diff --git a/db/schema_migrations/20231225133628 b/db/schema_migrations/20231225133628 new file mode 100644 index 00000000000000..9206474b25879c --- /dev/null +++ b/db/schema_migrations/20231225133628 @@ -0,0 +1 @@ +6d00c9672b913437f6e4afaef24c32b46d189e34502659dc3f92b1b6b13cff2a \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 2ce0b1daa76c79..206abc52ce8f99 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -24865,7 +24865,6 @@ CREATE TABLE vulnerabilities ( updated_by_id bigint, last_edited_by_id bigint, start_date date, - due_date date, last_edited_at timestamp with time zone, created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, diff --git a/ee/spec/models/ee/vulnerability_spec.rb b/ee/spec/models/ee/vulnerability_spec.rb index bc1b17d30cebe5..aef6efd4799901 100644 --- a/ee/spec/models/ee/vulnerability_spec.rb +++ b/ee/spec/models/ee/vulnerability_spec.rb @@ -29,7 +29,7 @@ let_it_be(:vulnerability) { create(:vulnerability, :sast, :confirmed, :low, :with_state_transition, project: project) } let_it_be(:finding) { create(:vulnerabilities_finding, vulnerability: vulnerability) } - it { is_expected.to have_locked_schema('669e44a7050fb809ab322ace933868498d6636bd8e11b8bbb959befc53ea082a').reference('https://gitlab.com/gitlab-org/gitlab/-/issues/349315') } + it { is_expected.to have_locked_schema('aeb78a130abaae6d526c87dc265c987b23074746d7fb1912de7e6969e93090d1').reference('https://gitlab.com/gitlab-org/gitlab/-/issues/349315') } it_behaves_like 'vulnerability and finding shared examples' do let(:transformer_method) { :itself } -- GitLab