diff --git a/db/docs/batched_background_migrations/backup_and_remove_notes_with_null_noteable_type.yml b/db/docs/batched_background_migrations/backup_and_remove_notes_with_null_noteable_type.yml index b842b1fdaab51bdc9fc8a867b0722cd24325c649..1ce1b2b4fef126205941d3b6b5b4692c8660d7fd 100644 --- a/db/docs/batched_background_migrations/backup_and_remove_notes_with_null_noteable_type.yml +++ b/db/docs/batched_background_migrations/backup_and_remove_notes_with_null_noteable_type.yml @@ -6,4 +6,4 @@ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/146023 milestone: '16.10' queued_migration_version: 20240226143323 finalize_after: '2024-03-15' -finalized_by: # version of the migration that finalized this BBM +finalized_by: 20240514210445 diff --git a/db/post_migrate/20240514210445_finalize_backup_and_remove_notes_with_null_noteable_type.rb b/db/post_migrate/20240514210445_finalize_backup_and_remove_notes_with_null_noteable_type.rb new file mode 100644 index 0000000000000000000000000000000000000000..7ad46e1208d2873b3ec4c889df6c7e849776de1c --- /dev/null +++ b/db/post_migrate/20240514210445_finalize_backup_and_remove_notes_with_null_noteable_type.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class FinalizeBackupAndRemoveNotesWithNullNoteableType < Gitlab::Database::Migration[2.2] + MIGRATION = 'BackupAndRemoveNotesWithNullNoteableType' + + disable_ddl_transaction! + restrict_gitlab_migration gitlab_schema: :gitlab_main_cell + milestone '17.1' + + def up + ensure_batched_background_migration_is_finished( + job_class_name: MIGRATION, + table_name: :notes, + column_name: :id, + job_arguments: [] + ) + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20240514214517_async_validate_notes_noteable_type_not_null_constraint.rb b/db/post_migrate/20240514214517_async_validate_notes_noteable_type_not_null_constraint.rb new file mode 100644 index 0000000000000000000000000000000000000000..779e80c6d2a8714e65ef46111f7aa4e85a1431f5 --- /dev/null +++ b/db/post_migrate/20240514214517_async_validate_notes_noteable_type_not_null_constraint.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AsyncValidateNotesNoteableTypeNotNullConstraint < Gitlab::Database::Migration[2.2] + milestone '17.1' + + CONSTRAINT_NAME = 'check_1244cbd7d0' + + def up + prepare_async_check_constraint_validation :notes, name: CONSTRAINT_NAME + end + + def down + unprepare_async_check_constraint_validation :notes, name: CONSTRAINT_NAME + end +end diff --git a/db/schema_migrations/20240514210445 b/db/schema_migrations/20240514210445 new file mode 100644 index 0000000000000000000000000000000000000000..f76ef5499f6c1a211853fe58b93769af2843d284 --- /dev/null +++ b/db/schema_migrations/20240514210445 @@ -0,0 +1 @@ +89358eb2216e9ab4a763faf903028d840017349bbd1b0a9e2dbe64b31ab7df0f \ No newline at end of file diff --git a/db/schema_migrations/20240514214517 b/db/schema_migrations/20240514214517 new file mode 100644 index 0000000000000000000000000000000000000000..48fe39e43e262be5deca3d8d3274cb8ca9a9753a --- /dev/null +++ b/db/schema_migrations/20240514214517 @@ -0,0 +1 @@ +92736183b5831da66a0b5689ad026520e147c2be21dd2abc82fb1f4c8e7b12dd \ No newline at end of file