summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20211129151155_add_migrated_to_new_structure_column_to_vulnerability_occurrences.rb7
-rw-r--r--db/migrate/20211129151832_add_index_on_vulnerability_occurrences_migrated_to_new_structure_column.rb15
-rw-r--r--db/post_migrate/20211201101541_drop_clusters_applications_runners_ci_runners_fk.rb15
-rw-r--r--db/schema_migrations/202111291511551
-rw-r--r--db/schema_migrations/202111291518321
-rw-r--r--db/schema_migrations/202112011015411
-rw-r--r--db/structure.sql6
7 files changed, 43 insertions, 3 deletions
diff --git a/db/migrate/20211129151155_add_migrated_to_new_structure_column_to_vulnerability_occurrences.rb b/db/migrate/20211129151155_add_migrated_to_new_structure_column_to_vulnerability_occurrences.rb
new file mode 100644
index 00000000000..8c3cf82d7c7
--- /dev/null
+++ b/db/migrate/20211129151155_add_migrated_to_new_structure_column_to_vulnerability_occurrences.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddMigratedToNewStructureColumnToVulnerabilityOccurrences < Gitlab::Database::Migration[1.0]
+ def change
+ add_column :vulnerability_occurrences, :migrated_to_new_structure, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20211129151832_add_index_on_vulnerability_occurrences_migrated_to_new_structure_column.rb b/db/migrate/20211129151832_add_index_on_vulnerability_occurrences_migrated_to_new_structure_column.rb
new file mode 100644
index 00000000000..4cf8263f8f0
--- /dev/null
+++ b/db/migrate/20211129151832_add_index_on_vulnerability_occurrences_migrated_to_new_structure_column.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddIndexOnVulnerabilityOccurrencesMigratedToNewStructureColumn < Gitlab::Database::Migration[1.0]
+ INDEX_NAME = 'index_vulnerability_occurrences_on_migrated_to_new_structure'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :vulnerability_occurrences, [:migrated_to_new_structure, :id], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :vulnerability_occurrences, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20211201101541_drop_clusters_applications_runners_ci_runners_fk.rb b/db/post_migrate/20211201101541_drop_clusters_applications_runners_ci_runners_fk.rb
new file mode 100644
index 00000000000..9a02f64e350
--- /dev/null
+++ b/db/post_migrate/20211201101541_drop_clusters_applications_runners_ci_runners_fk.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class DropClustersApplicationsRunnersCiRunnersFk < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ remove_foreign_key_if_exists(:clusters_applications_runners, :ci_runners, name: 'fk_02de2ded36')
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key(:clusters_applications_runners, :ci_runners, name: 'fk_02de2ded36', column: :runner_id, target_column: :id, on_delete: 'set null')
+ end
+end
diff --git a/db/schema_migrations/20211129151155 b/db/schema_migrations/20211129151155
new file mode 100644
index 00000000000..4aa3e56bae6
--- /dev/null
+++ b/db/schema_migrations/20211129151155
@@ -0,0 +1 @@
+c1ba97f01fca6330628090010abb54220c0d057514386c6bb867c1b6f13f252c \ No newline at end of file
diff --git a/db/schema_migrations/20211129151832 b/db/schema_migrations/20211129151832
new file mode 100644
index 00000000000..fdfc464d136
--- /dev/null
+++ b/db/schema_migrations/20211129151832
@@ -0,0 +1 @@
+c6d257f635049f88cd6efba903c9384a0a1af23b3c8fe6fa7f0842dcdf9f7e39 \ No newline at end of file
diff --git a/db/schema_migrations/20211201101541 b/db/schema_migrations/20211201101541
new file mode 100644
index 00000000000..52f43ddcd2f
--- /dev/null
+++ b/db/schema_migrations/20211201101541
@@ -0,0 +1 @@
+277cfcd1002e32c6cd664d6c0b6a7cbdf2ed7e5242e46dbddc4f99b0e8422361 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index c431c35af89..d57b66ad602 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -20828,6 +20828,7 @@ CREATE TABLE vulnerability_occurrences (
cve text,
location jsonb,
detection_method smallint DEFAULT 0 NOT NULL,
+ migrated_to_new_structure boolean DEFAULT false NOT NULL,
CONSTRAINT check_4a3a60f2ba CHECK ((char_length(solution) <= 7000)),
CONSTRAINT check_ade261da6b CHECK ((char_length(description) <= 15000)),
CONSTRAINT check_df6dd20219 CHECK ((char_length(message) <= 3000)),
@@ -27780,6 +27781,8 @@ CREATE INDEX index_vulnerability_occurrences_on_location_cluster_id ON vulnerabi
CREATE INDEX index_vulnerability_occurrences_on_location_image ON vulnerability_occurrences USING gin (((location -> 'image'::text))) WHERE (report_type = ANY (ARRAY[2, 7]));
+CREATE INDEX index_vulnerability_occurrences_on_migrated_to_new_structure ON vulnerability_occurrences USING btree (migrated_to_new_structure, id);
+
CREATE INDEX index_vulnerability_occurrences_on_primary_identifier_id ON vulnerability_occurrences USING btree (primary_identifier_id);
CREATE INDEX index_vulnerability_occurrences_on_project_fingerprint ON vulnerability_occurrences USING btree (project_fingerprint);
@@ -28891,9 +28894,6 @@ ALTER TABLE ONLY deployments
ALTER TABLE ONLY epics
ADD CONSTRAINT fk_013c9f36ca FOREIGN KEY (due_date_sourcing_epic_id) REFERENCES epics(id) ON DELETE SET NULL;
-ALTER TABLE ONLY clusters_applications_runners
- ADD CONSTRAINT fk_02de2ded36 FOREIGN KEY (runner_id) REFERENCES ci_runners(id) ON DELETE SET NULL;
-
ALTER TABLE ONLY incident_management_escalation_rules
ADD CONSTRAINT fk_0314ee86eb FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;