diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-21 09:11:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-21 09:11:50 +0300 |
commit | a293ae1ab5e4253f6003123c79c00bf7b953a7e5 (patch) | |
tree | fd85a2f53f245787b3190d31b4e31f17b3dc2444 /db | |
parent | e3ecb7dc093db47b9491e20d9f20de02b4ac2b6d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20231218121131_remove_start_date_sourcing_milestone_id_column_from_vulnerabilities.rb | 24 | ||||
-rw-r--r-- | db/schema_migrations/20231218121131 | 1 | ||||
-rw-r--r-- | db/structure.sql | 6 |
3 files changed, 25 insertions, 6 deletions
diff --git a/db/post_migrate/20231218121131_remove_start_date_sourcing_milestone_id_column_from_vulnerabilities.rb b/db/post_migrate/20231218121131_remove_start_date_sourcing_milestone_id_column_from_vulnerabilities.rb new file mode 100644 index 00000000000..1ca04e5aed1 --- /dev/null +++ b/db/post_migrate/20231218121131_remove_start_date_sourcing_milestone_id_column_from_vulnerabilities.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class RemoveStartDateSourcingMilestoneIdColumnFromVulnerabilities < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + + milestone '16.8' + + def up + with_lock_retries do + remove_column :vulnerabilities, :start_date_sourcing_milestone_id + end + end + + def down + unless column_exists?(:vulnerabilities, :start_date_sourcing_milestone_id) + add_column :vulnerabilities, :start_date_sourcing_milestone_id, :bigint + end + + # Add back index and constraint that were dropped in `up` + add_concurrent_index(:vulnerabilities, :start_date_sourcing_milestone_id) + add_concurrent_foreign_key(:vulnerabilities, :milestones, column: :start_date_sourcing_milestone_id, + on_delete: :nullify) + end +end diff --git a/db/schema_migrations/20231218121131 b/db/schema_migrations/20231218121131 new file mode 100644 index 00000000000..3d262967705 --- /dev/null +++ b/db/schema_migrations/20231218121131 @@ -0,0 +1 @@ +39fe9d82ebdfb8cb16d4ccb3704d0866aba63ff1bfe4087c6ce44f3c98afd0a0
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 775df880e1b..c80f58a666b 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -24888,7 +24888,6 @@ CREATE TABLE vulnerabilities ( title_html text, description text, description_html text, - start_date_sourcing_milestone_id bigint, state smallint DEFAULT 1 NOT NULL, severity smallint NOT NULL, severity_overridden boolean DEFAULT false, @@ -35087,8 +35086,6 @@ CREATE INDEX index_vulnerabilities_on_project_id_and_state_and_severity ON vulne CREATE INDEX index_vulnerabilities_on_resolved_by_id ON vulnerabilities USING btree (resolved_by_id); -CREATE INDEX index_vulnerabilities_on_start_date_sourcing_milestone_id ON vulnerabilities USING btree (start_date_sourcing_milestone_id); - CREATE INDEX index_vulnerabilities_on_updated_by_id ON vulnerabilities USING btree (updated_by_id); CREATE INDEX index_vulnerabilities_project_id_and_id_on_default_branch ON vulnerabilities USING btree (project_id, id) WHERE (present_on_default_branch IS TRUE); @@ -37817,9 +37814,6 @@ ALTER TABLE p_ci_builds ALTER TABLE ONLY approval_group_rules_users ADD CONSTRAINT fk_888a0df3b7 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; -ALTER TABLE ONLY vulnerabilities - ADD CONSTRAINT fk_88b4d546ef FOREIGN KEY (start_date_sourcing_milestone_id) REFERENCES milestones(id) ON DELETE SET NULL; - ALTER TABLE ONLY bulk_import_entities ADD CONSTRAINT fk_88c725229f FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; |