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>2022-05-27 00:08:54 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-27 00:08:54 +0300
commit1c47c8e2d613829993eafb59a903223389389d86 (patch)
tree93178fb6e59e731ab7d1c1261e99457a06e8aa73 /db
parentf52b15b6398075127f4c583823fd72d4a6ec5e59 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/docs/vulnerability_state_transitions.yml9
-rw-r--r--db/migrate/20220517182529_create_vulnerability_state_transition.rb18
-rw-r--r--db/schema_migrations/202205171825291
-rw-r--r--db/structure.sql28
4 files changed, 56 insertions, 0 deletions
diff --git a/db/docs/vulnerability_state_transitions.yml b/db/docs/vulnerability_state_transitions.yml
new file mode 100644
index 00000000000..908b4120b47
--- /dev/null
+++ b/db/docs/vulnerability_state_transitions.yml
@@ -0,0 +1,9 @@
+---
+table_name: vulnerability_state_transitions
+classes:
+ - Vulnerabilities::VulnerabilityStateTransition
+feature_categories:
+ - vulnerability_management
+description: Stores state transitions of a Vulnerability
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/87957
+milestone: '15.1'
diff --git a/db/migrate/20220517182529_create_vulnerability_state_transition.rb b/db/migrate/20220517182529_create_vulnerability_state_transition.rb
new file mode 100644
index 00000000000..6ffa10ae597
--- /dev/null
+++ b/db/migrate/20220517182529_create_vulnerability_state_transition.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class CreateVulnerabilityStateTransition < Gitlab::Database::Migration[2.0]
+ enable_lock_retries!
+
+ def up
+ create_table :vulnerability_state_transitions do |t|
+ t.references :vulnerability, index: true, null: false, foreign_key: { on_delete: :cascade }
+ t.integer :to_state, limit: 2, null: false
+ t.integer :from_state, limit: 2, null: false
+ t.timestamps_with_timezone null: false
+ end
+ end
+
+ def down
+ drop_table :vulnerability_state_transitions
+ end
+end
diff --git a/db/schema_migrations/20220517182529 b/db/schema_migrations/20220517182529
new file mode 100644
index 00000000000..29afb5009d5
--- /dev/null
+++ b/db/schema_migrations/20220517182529
@@ -0,0 +1 @@
+b47c2ddd218df29117d3c69d59819eed67b83a6d687547a44c1b31b302c005a5 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index b251176673c..ef434682dba 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -22160,6 +22160,24 @@ CREATE SEQUENCE vulnerability_scanners_id_seq
ALTER SEQUENCE vulnerability_scanners_id_seq OWNED BY vulnerability_scanners.id;
+CREATE TABLE vulnerability_state_transitions (
+ id bigint NOT NULL,
+ vulnerability_id bigint NOT NULL,
+ to_state smallint NOT NULL,
+ from_state smallint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL
+);
+
+CREATE SEQUENCE vulnerability_state_transitions_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE vulnerability_state_transitions_id_seq OWNED BY vulnerability_state_transitions.id;
+
CREATE TABLE vulnerability_statistics (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -23419,6 +23437,8 @@ ALTER TABLE ONLY vulnerability_remediations ALTER COLUMN id SET DEFAULT nextval(
ALTER TABLE ONLY vulnerability_scanners ALTER COLUMN id SET DEFAULT nextval('vulnerability_scanners_id_seq'::regclass);
+ALTER TABLE ONLY vulnerability_state_transitions ALTER COLUMN id SET DEFAULT nextval('vulnerability_state_transitions_id_seq'::regclass);
+
ALTER TABLE ONLY vulnerability_statistics ALTER COLUMN id SET DEFAULT nextval('vulnerability_statistics_id_seq'::regclass);
ALTER TABLE ONLY vulnerability_user_mentions ALTER COLUMN id SET DEFAULT nextval('vulnerability_user_mentions_id_seq'::regclass);
@@ -25706,6 +25726,9 @@ ALTER TABLE ONLY vulnerability_remediations
ALTER TABLE ONLY vulnerability_scanners
ADD CONSTRAINT vulnerability_scanners_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY vulnerability_state_transitions
+ ADD CONSTRAINT vulnerability_state_transitions_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY vulnerability_statistics
ADD CONSTRAINT vulnerability_statistics_pkey PRIMARY KEY (id);
@@ -29784,6 +29807,8 @@ CREATE UNIQUE INDEX index_vulnerability_remediations_on_project_id_and_checksum
CREATE UNIQUE INDEX index_vulnerability_scanners_on_project_id_and_external_id ON vulnerability_scanners USING btree (project_id, external_id);
+CREATE INDEX index_vulnerability_state_transitions_on_vulnerability_id ON vulnerability_state_transitions USING btree (vulnerability_id);
+
CREATE INDEX index_vulnerability_statistics_on_latest_pipeline_id ON vulnerability_statistics USING btree (latest_pipeline_id);
CREATE INDEX index_vulnerability_statistics_on_letter_grade ON vulnerability_statistics USING btree (letter_grade);
@@ -32764,6 +32789,9 @@ ALTER TABLE ONLY incident_management_oncall_participants
ALTER TABLE ONLY work_item_parent_links
ADD CONSTRAINT fk_rails_601d5bec3a FOREIGN KEY (work_item_id) REFERENCES issues(id) ON DELETE CASCADE;
+ALTER TABLE ONLY vulnerability_state_transitions
+ ADD CONSTRAINT fk_rails_60e4899648 FOREIGN KEY (vulnerability_id) REFERENCES vulnerabilities(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY user_highest_roles
ADD CONSTRAINT fk_rails_60f6c325a6 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;