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-03 15:13:59 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-04-03 15:13:59 +0300
commit6e228f38c37c4c7b6d6be648ae2664ebfb5c3c80 (patch)
tree0c7abe13728c198df556d04143dc624a67aaad85 /db
parentf6a4346585dcc6cc564cb4974a0ea49d2ac0531d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/docs/ci_namespace_mirrors.yml2
-rw-r--r--db/docs/ci_project_mirrors.yml2
-rw-r--r--db/docs/loose_foreign_keys_deleted_records.yml2
-rw-r--r--db/docs/namespaces_sync_events.yml2
-rw-r--r--db/docs/projects_sync_events.yml2
-rw-r--r--db/post_migrate/20230208125736_schedule_migration_for_links.rb11
-rw-r--r--db/post_migrate/20230314144640_reschedule_migration_for_links.rb32
-rw-r--r--db/post_migrate/20230321163947_backfill_ml_candidates_project_id.rb23
-rw-r--r--db/post_migrate/20230321170823_backfill_ml_candidates_internal_id.rb21
-rw-r--r--db/schema_migrations/202303141446401
-rw-r--r--db/schema_migrations/202303211639471
-rw-r--r--db/schema_migrations/202303211708231
12 files changed, 86 insertions, 14 deletions
diff --git a/db/docs/ci_namespace_mirrors.yml b/db/docs/ci_namespace_mirrors.yml
index 1566f043a0e..29e79c065c6 100644
--- a/db/docs/ci_namespace_mirrors.yml
+++ b/db/docs/ci_namespace_mirrors.yml
@@ -3,7 +3,7 @@ table_name: ci_namespace_mirrors
classes:
- Ci::NamespaceMirror
feature_categories:
-- pods
+- cell
description: Mirrors some data from the `main` database into the `ci` database so that we can join directly in a single query
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75621
milestone: '14.6'
diff --git a/db/docs/ci_project_mirrors.yml b/db/docs/ci_project_mirrors.yml
index 8e332a10194..af7ce4f3017 100644
--- a/db/docs/ci_project_mirrors.yml
+++ b/db/docs/ci_project_mirrors.yml
@@ -3,7 +3,7 @@ table_name: ci_project_mirrors
classes:
- Ci::ProjectMirror
feature_categories:
-- pods
+- cell
description: Mirrors some data from the `main` database into the `ci` database so that we can join directly in a single query
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75621
milestone: '14.6'
diff --git a/db/docs/loose_foreign_keys_deleted_records.yml b/db/docs/loose_foreign_keys_deleted_records.yml
index 8ce8d4e52b3..24de9b85e4c 100644
--- a/db/docs/loose_foreign_keys_deleted_records.yml
+++ b/db/docs/loose_foreign_keys_deleted_records.yml
@@ -3,7 +3,7 @@ table_name: loose_foreign_keys_deleted_records
classes:
- LooseForeignKeys::DeletedRecord
feature_categories:
-- pods
+- cell
description: Used by the loose foreign keys feature as a queue of parent records whose child records (via foreign keys) need to be deleted/nullified
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70152
milestone: '14.3'
diff --git a/db/docs/namespaces_sync_events.yml b/db/docs/namespaces_sync_events.yml
index f089ca85789..fdac8accd7f 100644
--- a/db/docs/namespaces_sync_events.yml
+++ b/db/docs/namespaces_sync_events.yml
@@ -3,7 +3,7 @@ table_name: namespaces_sync_events
classes:
- Namespaces::SyncEvent
feature_categories:
-- pods
+- cell
description: Used as a queue of data that needs to be synchronized between the `ci` and `main` database
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75517
milestone: '14.6'
diff --git a/db/docs/projects_sync_events.yml b/db/docs/projects_sync_events.yml
index 70e325d1c0a..84b99fe6080 100644
--- a/db/docs/projects_sync_events.yml
+++ b/db/docs/projects_sync_events.yml
@@ -3,7 +3,7 @@ table_name: projects_sync_events
classes:
- Projects::SyncEvent
feature_categories:
-- pods
+- cell
description: Used as a queue of data that needs to be synchronized between the `ci` and `main` database
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75517
milestone: '14.6'
diff --git a/db/post_migrate/20230208125736_schedule_migration_for_links.rb b/db/post_migrate/20230208125736_schedule_migration_for_links.rb
index c1bd1bbbe51..78b83bbb502 100644
--- a/db/post_migrate/20230208125736_schedule_migration_for_links.rb
+++ b/db/post_migrate/20230208125736_schedule_migration_for_links.rb
@@ -9,17 +9,10 @@ class ScheduleMigrationForLinks < 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 is rescheduled via db/post_migrate/20230314144640_reschedule_migration_for_links.rb
end
def down
- delete_batched_background_migration(MIGRATION, :vulnerability_occurrences, :id, [])
+ # no-op as it is rescheduled via db/post_migrate/20230314144640_reschedule_migration_for_links.rb
end
end
diff --git a/db/post_migrate/20230314144640_reschedule_migration_for_links.rb b/db/post_migrate/20230314144640_reschedule_migration_for_links.rb
new file mode 100644
index 00000000000..311420f4f37
--- /dev/null
+++ b/db/post_migrate/20230314144640_reschedule_migration_for_links.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+# rubocop: disable BackgroundMigration/MissingDictionaryFile
+
+class RescheduleMigrationForLinks < Gitlab::Database::Migration[2.1]
+ MIGRATION = 'MigrateLinksForVulnerabilityFindings'
+ DELAY_INTERVAL = 2.minutes
+ SUB_BATCH_SIZE = 500
+ BATCH_SIZE = 10000
+
+ disable_ddl_transaction!
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ 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/post_migrate/20230321163947_backfill_ml_candidates_project_id.rb b/db/post_migrate/20230321163947_backfill_ml_candidates_project_id.rb
new file mode 100644
index 00000000000..cfcc8a4978d
--- /dev/null
+++ b/db/post_migrate/20230321163947_backfill_ml_candidates_project_id.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class BackfillMlCandidatesProjectId < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ sql = <<-SQL
+ UPDATE ml_candidates
+ SET project_id = temp.project_id
+ FROM (
+ SELECT ml_candidates.id AS id, ml_experiments.project_id AS project_id
+ FROM ml_candidates INNER JOIN ml_experiments ON ml_candidates.experiment_id = ml_experiments.id
+ ) AS temp
+ WHERE ml_candidates.id = temp.id
+ SQL
+
+ execute(sql)
+ end
+
+ def down; end
+end
diff --git a/db/post_migrate/20230321170823_backfill_ml_candidates_internal_id.rb b/db/post_migrate/20230321170823_backfill_ml_candidates_internal_id.rb
new file mode 100644
index 00000000000..b66f846bddb
--- /dev/null
+++ b/db/post_migrate/20230321170823_backfill_ml_candidates_internal_id.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class BackfillMlCandidatesInternalId < Gitlab::Database::Migration[2.1]
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ sql = <<-SQL
+ UPDATE ml_candidates
+ SET internal_id = temp.internal_id_num
+ FROM (
+ SELECT id, ROW_NUMBER() OVER (PARTITION BY project_id ORDER BY internal_id, id ASC) AS internal_id_num
+ FROM ml_candidates
+ ) AS temp
+ WHERE ml_candidates.id = temp.id
+ SQL
+
+ execute(sql)
+ end
+
+ def down; end
+end
diff --git a/db/schema_migrations/20230314144640 b/db/schema_migrations/20230314144640
new file mode 100644
index 00000000000..66dececa044
--- /dev/null
+++ b/db/schema_migrations/20230314144640
@@ -0,0 +1 @@
+143b8fca03dd42fcf7ee9af733901e16df2bbc3ce29e76e8e442536a17186fdf \ No newline at end of file
diff --git a/db/schema_migrations/20230321163947 b/db/schema_migrations/20230321163947
new file mode 100644
index 00000000000..7fe48192693
--- /dev/null
+++ b/db/schema_migrations/20230321163947
@@ -0,0 +1 @@
+f70305536912db6a726b2e371970a322f9b8f2a3efb5570860e57b4196c85d3d \ No newline at end of file
diff --git a/db/schema_migrations/20230321170823 b/db/schema_migrations/20230321170823
new file mode 100644
index 00000000000..86dfe823473
--- /dev/null
+++ b/db/schema_migrations/20230321170823
@@ -0,0 +1 @@
+5517993d733b91c924c06ac616902108d7d709045296e3c2e44de5e8ed78e10f \ No newline at end of file