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>2023-04-05 03:16:56 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-04-05 03:16:56 +0300
commit92a2c36b8cbbe4a7c0991312c28aa088a15201e6 (patch)
treec7545328646a92d8ddbf0798bd6f86301deb8fe7 /db
parent269e52662aceba62b91424e87f4def90ecc81e6c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20230330101438_create_fk_ml_candidate_params_on_candidate_id.rb29
-rw-r--r--db/migrate/20230330101439_validate_fk_ml_candidate_params_on_candidate_id.rb13
-rw-r--r--db/migrate/20230330101440_remove_old_fk_ml_candidate_params_on_candidate_id.rb21
-rw-r--r--db/migrate/20230330101441_create_fk_ml_candidate_metrics_on_candidate_id.rb29
-rw-r--r--db/migrate/20230330101442_validate_fk_ml_candidate_metrics_on_candidate_id.rb13
-rw-r--r--db/migrate/20230330101443_remove_old_fk_ml_candidate_metrics_on_candidate_id.rb21
-rw-r--r--db/post_migrate/20230224144233_migrate_evidences_from_raw_metadata.rb11
-rw-r--r--db/post_migrate/20230330103104_reschedule_migrate_evidences.rb30
-rw-r--r--db/schema_migrations/202303301014381
-rw-r--r--db/schema_migrations/202303301014391
-rw-r--r--db/schema_migrations/202303301014401
-rw-r--r--db/schema_migrations/202303301014411
-rw-r--r--db/schema_migrations/202303301014421
-rw-r--r--db/schema_migrations/202303301014431
-rw-r--r--db/schema_migrations/202303301031041
-rw-r--r--db/structure.sql12
16 files changed, 171 insertions, 15 deletions
diff --git a/db/migrate/20230330101438_create_fk_ml_candidate_params_on_candidate_id.rb b/db/migrate/20230330101438_create_fk_ml_candidate_params_on_candidate_id.rb
new file mode 100644
index 00000000000..8273ffc27e2
--- /dev/null
+++ b/db/migrate/20230330101438_create_fk_ml_candidate_params_on_candidate_id.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class CreateFkMlCandidateParamsOnCandidateId < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ NEW_CONSTRAINT_NAME = 'fk_ml_candidate_params_on_candidate_id'
+
+ def up
+ add_concurrent_foreign_key(
+ :ml_candidate_params,
+ :ml_candidates,
+ column: :candidate_id,
+ on_delete: :cascade,
+ validate: false,
+ name: NEW_CONSTRAINT_NAME
+ )
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists(
+ :ml_candidate_params,
+ column: :candidate_id,
+ on_delete: :cascade,
+ name: NEW_CONSTRAINT_NAME
+ )
+ end
+ end
+end
diff --git a/db/migrate/20230330101439_validate_fk_ml_candidate_params_on_candidate_id.rb b/db/migrate/20230330101439_validate_fk_ml_candidate_params_on_candidate_id.rb
new file mode 100644
index 00000000000..912380ac3b7
--- /dev/null
+++ b/db/migrate/20230330101439_validate_fk_ml_candidate_params_on_candidate_id.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class ValidateFkMlCandidateParamsOnCandidateId < Gitlab::Database::Migration[2.1]
+ NEW_CONSTRAINT_NAME = 'fk_ml_candidate_params_on_candidate_id'
+
+ def up
+ validate_foreign_key(:ml_candidate_params, :candidate_id, name: NEW_CONSTRAINT_NAME)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/migrate/20230330101440_remove_old_fk_ml_candidate_params_on_candidate_id.rb b/db/migrate/20230330101440_remove_old_fk_ml_candidate_params_on_candidate_id.rb
new file mode 100644
index 00000000000..8e143cd3ed2
--- /dev/null
+++ b/db/migrate/20230330101440_remove_old_fk_ml_candidate_params_on_candidate_id.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class RemoveOldFkMlCandidateParamsOnCandidateId < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ OLD_CONSTRAINT_NAME = 'fk_rails_d4a51d1185'
+
+ def up
+ remove_foreign_key_if_exists(:ml_candidate_params, column: :candidate_id, name: OLD_CONSTRAINT_NAME)
+ end
+
+ def down
+ add_concurrent_foreign_key(
+ :ml_candidate_params,
+ :ml_candidates,
+ column: :candidate_id,
+ validate: false,
+ name: OLD_CONSTRAINT_NAME
+ )
+ end
+end
diff --git a/db/migrate/20230330101441_create_fk_ml_candidate_metrics_on_candidate_id.rb b/db/migrate/20230330101441_create_fk_ml_candidate_metrics_on_candidate_id.rb
new file mode 100644
index 00000000000..0ef0075127d
--- /dev/null
+++ b/db/migrate/20230330101441_create_fk_ml_candidate_metrics_on_candidate_id.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class CreateFkMlCandidateMetricsOnCandidateId < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ NEW_CONSTRAINT_NAME = 'fk_ml_candidate_metrics_on_candidate_id'
+
+ def up
+ add_concurrent_foreign_key(
+ :ml_candidate_metrics,
+ :ml_candidates,
+ column: :candidate_id,
+ on_delete: :cascade,
+ validate: false,
+ name: NEW_CONSTRAINT_NAME
+ )
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists(
+ :ml_candidate_metrics,
+ column: :candidate_id,
+ on_delete: :cascade,
+ name: NEW_CONSTRAINT_NAME
+ )
+ end
+ end
+end
diff --git a/db/migrate/20230330101442_validate_fk_ml_candidate_metrics_on_candidate_id.rb b/db/migrate/20230330101442_validate_fk_ml_candidate_metrics_on_candidate_id.rb
new file mode 100644
index 00000000000..5180c6582cf
--- /dev/null
+++ b/db/migrate/20230330101442_validate_fk_ml_candidate_metrics_on_candidate_id.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class ValidateFkMlCandidateMetricsOnCandidateId < Gitlab::Database::Migration[2.1]
+ NEW_CONSTRAINT_NAME = 'fk_ml_candidate_metrics_on_candidate_id'
+
+ def up
+ validate_foreign_key(:ml_candidate_metrics, :candidate_id, name: NEW_CONSTRAINT_NAME)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/migrate/20230330101443_remove_old_fk_ml_candidate_metrics_on_candidate_id.rb b/db/migrate/20230330101443_remove_old_fk_ml_candidate_metrics_on_candidate_id.rb
new file mode 100644
index 00000000000..2e9153cb9d9
--- /dev/null
+++ b/db/migrate/20230330101443_remove_old_fk_ml_candidate_metrics_on_candidate_id.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class RemoveOldFkMlCandidateMetricsOnCandidateId < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ OLD_CONSTRAINT_NAME = 'fk_rails_efb613a25a'
+
+ def up
+ remove_foreign_key_if_exists(:ml_candidate_metrics, column: :candidate_id, name: OLD_CONSTRAINT_NAME)
+ end
+
+ def down
+ add_concurrent_foreign_key(
+ :ml_candidate_metrics,
+ :ml_candidates,
+ column: :candidate_id,
+ validate: false,
+ name: OLD_CONSTRAINT_NAME
+ )
+ end
+end
diff --git a/db/post_migrate/20230224144233_migrate_evidences_from_raw_metadata.rb b/db/post_migrate/20230224144233_migrate_evidences_from_raw_metadata.rb
index 5d72a46f3c4..7c2a43443df 100644
--- a/db/post_migrate/20230224144233_migrate_evidences_from_raw_metadata.rb
+++ b/db/post_migrate/20230224144233_migrate_evidences_from_raw_metadata.rb
@@ -9,17 +9,10 @@ class MigrateEvidencesFromRawMetadata < Gitlab::Database::Migration[2.1]
BATCH_SIZE = 10000
def up
- queue_batched_background_migration(
- MIGRATION,
- :vulnerability_occurrences,
- :id,
- job_interval: DELAY_INTERVAL,
- batch_size: BATCH_SIZE,
- sub_batch_size: SUB_BATCH_SIZE
- )
+ # no-op as it has been rescheduled via db/post_migrate/20230330103104_reschedule_migrate_evidences.rb
end
def down
- delete_batched_background_migration(MIGRATION, :vulnerability_occurrences, :id, [])
+ # no-op as it has been rescheduled via db/post_migrate/20230330103104_reschedule_migrate_evidences.rb
end
end
diff --git a/db/post_migrate/20230330103104_reschedule_migrate_evidences.rb b/db/post_migrate/20230330103104_reschedule_migrate_evidences.rb
new file mode 100644
index 00000000000..1b59b9a4344
--- /dev/null
+++ b/db/post_migrate/20230330103104_reschedule_migrate_evidences.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+# rubocop:disable BackgroundMigration/MissingDictionaryFile
+
+class RescheduleMigrateEvidences < Gitlab::Database::Migration[2.1]
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ MIGRATION = 'MigrateEvidencesForVulnerabilityFindings'
+ DELAY_INTERVAL = 2.minutes
+ SUB_BATCH_SIZE = 500
+ BATCH_SIZE = 10000
+
+ def up
+ delete_batched_background_migration(MIGRATION, :vulnerability_occurrences, :id, [])
+
+ queue_batched_background_migration(
+ MIGRATION,
+ :vulnerability_occurrences,
+ :id,
+ job_interval: DELAY_INTERVAL,
+ batch_size: BATCH_SIZE,
+ sub_batch_size: SUB_BATCH_SIZE
+ )
+ end
+
+ def down
+ delete_batched_background_migration(MIGRATION, :vulnerability_occurrences, :id, [])
+ end
+end
+# rubocop:enable BackgroundMigration/MissingDictionaryFile
diff --git a/db/schema_migrations/20230330101438 b/db/schema_migrations/20230330101438
new file mode 100644
index 00000000000..0e479e7b28f
--- /dev/null
+++ b/db/schema_migrations/20230330101438
@@ -0,0 +1 @@
+ff2658630f5877b94536653994d211344210e10c0d3ef19d6052ca606bf8ea56 \ No newline at end of file
diff --git a/db/schema_migrations/20230330101439 b/db/schema_migrations/20230330101439
new file mode 100644
index 00000000000..64ccb9de3ee
--- /dev/null
+++ b/db/schema_migrations/20230330101439
@@ -0,0 +1 @@
+b388e3de152fda4ec4590fad5ffd503df85e474e807232e2afdacd51a4eebef9 \ No newline at end of file
diff --git a/db/schema_migrations/20230330101440 b/db/schema_migrations/20230330101440
new file mode 100644
index 00000000000..470fc0189d2
--- /dev/null
+++ b/db/schema_migrations/20230330101440
@@ -0,0 +1 @@
+f20a1df2650018debf7b84f90c0459e4fac7120c90aa23f184bbb5a96ab6e62c \ No newline at end of file
diff --git a/db/schema_migrations/20230330101441 b/db/schema_migrations/20230330101441
new file mode 100644
index 00000000000..fb69231b91a
--- /dev/null
+++ b/db/schema_migrations/20230330101441
@@ -0,0 +1 @@
+29c035a58df131daff23434a57999f04fbafde5a661e35bdc8556238c5822b5c \ No newline at end of file
diff --git a/db/schema_migrations/20230330101442 b/db/schema_migrations/20230330101442
new file mode 100644
index 00000000000..ba0def5c784
--- /dev/null
+++ b/db/schema_migrations/20230330101442
@@ -0,0 +1 @@
+f2037e8c082b2355c7b004bc2f006f99f738c48e277b0013872c77d1347a0d14 \ No newline at end of file
diff --git a/db/schema_migrations/20230330101443 b/db/schema_migrations/20230330101443
new file mode 100644
index 00000000000..4c0c0bc4b0a
--- /dev/null
+++ b/db/schema_migrations/20230330101443
@@ -0,0 +1 @@
+75bbf5ead4cec9bd425d056c9bbdc0e090721caa74c143533a30afedf90047ca \ No newline at end of file
diff --git a/db/schema_migrations/20230330103104 b/db/schema_migrations/20230330103104
new file mode 100644
index 00000000000..804fb366310
--- /dev/null
+++ b/db/schema_migrations/20230330103104
@@ -0,0 +1 @@
+e52fa4a4736346c3c03e9386be1f25cf8a2cf006c63432181afcf27473dce90a \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 8b02dc32711..98b006c0ac3 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -35231,6 +35231,12 @@ ALTER TABLE ONLY geo_event_log
ALTER TABLE ONLY issue_user_mentions
ADD CONSTRAINT fk_issue_user_mentions_note_id_convert_to_bigint FOREIGN KEY (note_id_convert_to_bigint) REFERENCES notes(id) ON DELETE CASCADE NOT VALID;
+ALTER TABLE ONLY ml_candidate_metrics
+ ADD CONSTRAINT fk_ml_candidate_metrics_on_candidate_id FOREIGN KEY (candidate_id) REFERENCES ml_candidates(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY ml_candidate_params
+ ADD CONSTRAINT fk_ml_candidate_params_on_candidate_id FOREIGN KEY (candidate_id) REFERENCES ml_candidates(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY note_diff_files
ADD CONSTRAINT fk_note_diff_files_diff_note_id_convert_to_bigint FOREIGN KEY (diff_note_id_convert_to_bigint) REFERENCES notes(id) ON DELETE CASCADE NOT VALID;
@@ -36683,9 +36689,6 @@ ALTER TABLE ONLY alert_management_alert_assignees
ALTER TABLE ONLY geo_hashed_storage_attachments_events
ADD CONSTRAINT fk_rails_d496b088e9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
-ALTER TABLE ONLY ml_candidate_params
- ADD CONSTRAINT fk_rails_d4a51d1185 FOREIGN KEY (candidate_id) REFERENCES ml_candidates(id);
-
ALTER TABLE ONLY packages_rpm_repository_files
ADD CONSTRAINT fk_rails_d545cfaed2 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -36863,9 +36866,6 @@ ALTER TABLE ONLY project_relation_exports
ALTER TABLE ONLY label_priorities
ADD CONSTRAINT fk_rails_ef916d14fa FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
-ALTER TABLE ONLY ml_candidate_metrics
- ADD CONSTRAINT fk_rails_efb613a25a FOREIGN KEY (candidate_id) REFERENCES ml_candidates(id);
-
ALTER TABLE ONLY fork_network_members
ADD CONSTRAINT fk_rails_efccadc4ec FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;