diff options
Diffstat (limited to 'db')
6 files changed, 58 insertions, 1 deletions
diff --git a/db/docs/batched_background_migrations/update_workspaces_config_version3.yml b/db/docs/batched_background_migrations/update_workspaces_config_version3.yml new file mode 100644 index 00000000000..253feea0469 --- /dev/null +++ b/db/docs/batched_background_migrations/update_workspaces_config_version3.yml @@ -0,0 +1,9 @@ +--- +migration_job_name: UpdateWorkspacesConfigVersion3 +description: Update config_version to 3 and force_include_all_resources to true for existing workspaces +feature_category: remote_development +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/140972 +milestone: '16.8' +queued_migration_version: 20240104085448 +finalize_after: "2024-02-15" +finalized_by: # version of the migration that finalized this BBM diff --git a/db/post_migrate/20240102101409_validate_finding_id_on_vulnerabilities.rb b/db/post_migrate/20240102101409_validate_finding_id_on_vulnerabilities.rb new file mode 100644 index 00000000000..deed2462f93 --- /dev/null +++ b/db/post_migrate/20240102101409_validate_finding_id_on_vulnerabilities.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class ValidateFindingIdOnVulnerabilities < Gitlab::Database::Migration[2.2] + # obtained by running `\d vulnerabilities` on https://console.postgres.ai + FK_NAME = :fk_4e64972902 + + milestone '16.8' + + # validated asynchronously in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/131979 + def up + validate_foreign_key :vulnerabilities, :finding_id, name: FK_NAME + end + + def down + # Can be safely a no-op if we don't roll back the inconsistent data. + # https://docs.gitlab.com/ee/development/database/add_foreign_key_to_existing_column.html#add-a-migration-to-validate-the-fk-synchronously + end +end diff --git a/db/post_migrate/20240104085448_queue_update_workspaces_config_version3.rb b/db/post_migrate/20240104085448_queue_update_workspaces_config_version3.rb new file mode 100644 index 00000000000..574b6cdb4c2 --- /dev/null +++ b/db/post_migrate/20240104085448_queue_update_workspaces_config_version3.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class QueueUpdateWorkspacesConfigVersion3 < Gitlab::Database::Migration[2.2] + milestone '16.8' + + MIGRATION = "UpdateWorkspacesConfigVersion3" + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 1000 + SUB_BATCH_SIZE = 100 + + restrict_gitlab_migration gitlab_schema: :gitlab_main + disable_ddl_transaction! + + def up + queue_batched_background_migration( + MIGRATION, + :workspaces, + :config_version, + job_interval: DELAY_INTERVAL, + batch_size: BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :workspaces, :config_version, []) + end +end diff --git a/db/schema_migrations/20240102101409 b/db/schema_migrations/20240102101409 new file mode 100644 index 00000000000..b125c4f6cb8 --- /dev/null +++ b/db/schema_migrations/20240102101409 @@ -0,0 +1 @@ +6b9244a1ef9a87f192548bde7346e1b6b18d036ca14dcbde04046842d461dc36
\ No newline at end of file diff --git a/db/schema_migrations/20240104085448 b/db/schema_migrations/20240104085448 new file mode 100644 index 00000000000..a73b6a090a3 --- /dev/null +++ b/db/schema_migrations/20240104085448 @@ -0,0 +1 @@ +57e5c890ac0ebb837a5894b09717322c2053694cc4a91270508a652f091e457c
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index b0bd513e601..950792e9d52 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -37651,7 +37651,7 @@ ALTER TABLE ONLY namespace_commit_emails ADD CONSTRAINT fk_4d6ba63ba5 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; ALTER TABLE ONLY vulnerabilities - ADD CONSTRAINT fk_4e64972902 FOREIGN KEY (finding_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE NOT VALID; + ADD CONSTRAINT fk_4e64972902 FOREIGN KEY (finding_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE; ALTER TABLE ONLY ml_model_versions ADD CONSTRAINT fk_4e8b59e7a8 FOREIGN KEY (model_id) REFERENCES ml_models(id) ON DELETE CASCADE; |