diff options
Diffstat (limited to 'db')
6 files changed, 39 insertions, 0 deletions
diff --git a/db/post_migrate/20221002234454_finalize_group_member_namespace_id_migration.rb b/db/post_migrate/20221002234454_finalize_group_member_namespace_id_migration.rb new file mode 100644 index 00000000000..9c5ca6cbb42 --- /dev/null +++ b/db/post_migrate/20221002234454_finalize_group_member_namespace_id_migration.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class FinalizeGroupMemberNamespaceIdMigration < Gitlab::Database::Migration[2.0] + MIGRATION = 'BackfillMemberNamespaceForGroupMembers' + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + ensure_batched_background_migration_is_finished( + job_class_name: MIGRATION, + table_name: :members, + column_name: :id, + job_arguments: [], + finalize: true + ) + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20221019194751_disable_fastupdate_on_issues_title_gin_index.rb b/db/post_migrate/20221019194751_disable_fastupdate_on_issues_title_gin_index.rb index 6ad846dda1c..64d935489c2 100644 --- a/db/post_migrate/20221019194751_disable_fastupdate_on_issues_title_gin_index.rb +++ b/db/post_migrate/20221019194751_disable_fastupdate_on_issues_title_gin_index.rb @@ -6,6 +6,8 @@ class DisableFastupdateOnIssuesTitleGinIndex < Gitlab::Database::Migration[2.0] INDEX_NAME = 'index_issues_on_title_trigram' def up + return unless index_exists_by_name?(:issues, INDEX_NAME) + with_lock_retries do execute <<~SQL ALTER INDEX #{INDEX_NAME} SET ( fastupdate = false ) ; @@ -14,6 +16,8 @@ class DisableFastupdateOnIssuesTitleGinIndex < Gitlab::Database::Migration[2.0] end def down + return unless index_exists_by_name?(:issues, INDEX_NAME) + with_lock_retries do execute <<~SQL ALTER INDEX #{INDEX_NAME} RESET ( fastupdate ) ; diff --git a/db/post_migrate/20221019195754_disable_fastupdate_on_issues_description_gin_index.rb b/db/post_migrate/20221019195754_disable_fastupdate_on_issues_description_gin_index.rb index ce09a48833f..8822cb3b414 100644 --- a/db/post_migrate/20221019195754_disable_fastupdate_on_issues_description_gin_index.rb +++ b/db/post_migrate/20221019195754_disable_fastupdate_on_issues_description_gin_index.rb @@ -6,6 +6,8 @@ class DisableFastupdateOnIssuesDescriptionGinIndex < Gitlab::Database::Migration INDEX_NAME = 'index_issues_on_description_trigram' def up + return unless index_exists_by_name?(:issues, INDEX_NAME) + with_lock_retries do execute <<~SQL ALTER INDEX #{INDEX_NAME} SET ( fastupdate = false ) ; @@ -14,6 +16,8 @@ class DisableFastupdateOnIssuesDescriptionGinIndex < Gitlab::Database::Migration end def down + return unless index_exists_by_name?(:issues, INDEX_NAME) + with_lock_retries do execute <<~SQL ALTER INDEX #{INDEX_NAME} RESET ( fastupdate ) ; diff --git a/db/post_migrate/20221019200033_disable_fastupdate_on_merge_requests_title_gin_index.rb b/db/post_migrate/20221019200033_disable_fastupdate_on_merge_requests_title_gin_index.rb index eb4c413a5a9..3e1124dc2bb 100644 --- a/db/post_migrate/20221019200033_disable_fastupdate_on_merge_requests_title_gin_index.rb +++ b/db/post_migrate/20221019200033_disable_fastupdate_on_merge_requests_title_gin_index.rb @@ -6,6 +6,8 @@ class DisableFastupdateOnMergeRequestsTitleGinIndex < Gitlab::Database::Migratio INDEX_NAME = 'index_merge_requests_on_title_trigram' def up + return unless index_exists_by_name?(:merge_requests, INDEX_NAME) + with_lock_retries do execute <<~SQL ALTER INDEX #{INDEX_NAME} SET ( fastupdate = false ) ; @@ -14,6 +16,8 @@ class DisableFastupdateOnMergeRequestsTitleGinIndex < Gitlab::Database::Migratio end def down + return unless index_exists_by_name?(:merge_requests, INDEX_NAME) + with_lock_retries do execute <<~SQL ALTER INDEX #{INDEX_NAME} RESET ( fastupdate ) ; diff --git a/db/post_migrate/20221019200206_disable_fastupdate_on_merge_requests_description_gin_index.rb b/db/post_migrate/20221019200206_disable_fastupdate_on_merge_requests_description_gin_index.rb index 2e55937db36..7ab6f40e206 100644 --- a/db/post_migrate/20221019200206_disable_fastupdate_on_merge_requests_description_gin_index.rb +++ b/db/post_migrate/20221019200206_disable_fastupdate_on_merge_requests_description_gin_index.rb @@ -6,6 +6,8 @@ class DisableFastupdateOnMergeRequestsDescriptionGinIndex < Gitlab::Database::Mi INDEX_NAME = 'index_merge_requests_on_description_trigram' def up + return unless index_exists_by_name?(:merge_requests, INDEX_NAME) + with_lock_retries do execute <<~SQL ALTER INDEX #{INDEX_NAME} SET ( fastupdate = false ) ; @@ -14,6 +16,8 @@ class DisableFastupdateOnMergeRequestsDescriptionGinIndex < Gitlab::Database::Mi end def down + return unless index_exists_by_name?(:merge_requests, INDEX_NAME) + with_lock_retries do execute <<~SQL ALTER INDEX #{INDEX_NAME} RESET ( fastupdate ) ; diff --git a/db/schema_migrations/20221002234454 b/db/schema_migrations/20221002234454 new file mode 100644 index 00000000000..d01230136be --- /dev/null +++ b/db/schema_migrations/20221002234454 @@ -0,0 +1 @@ +781ed5eaf05091e5d01ec23a9f66f3722c41b4a87ecdabe48158ce82c5cbb325
\ No newline at end of file |