Skip to content
Snippets Groups Projects

Drop migration that finalizes migration to add PAT expiration

Merged Stan Hu requested to merge sh-drop-token-expiration-migrations-17-0 into 17-0-stable-ee
1 file
+ 15
0
Compare changes
  • Side-by-side
  • Inline
  • This MR drops the migration that finalizes a migration that added an
    expiration to all tokens that did not have one. Due to the impact on
    users, this drops the migration to avoid interruption to user
    workflows without them realizing it.
    
    Note this only will help customers that have not already upgraded to
    GitLab 16.0. This finalize step will already be run for instances that
    have already upgraded to GitLab 16.7.
    
    If the instance is in the middle of the background migration, this
    change will allow the migration to be finalized to ensure that future
    upgrades are not blocked by unfinished migrations. Note that the
    `CleanupPersonalAccessTokensWithNilExpiresAt` migration will be NOP'ed
    out to halt further data changes if the migration is in progress.
    
    Related to https://gitlab.com/gitlab-org/gitlab/-/issues/462157
    
    Changelog: changed
@@ -7,7 +7,22 @@ class FinalizeCleanupPersonalAccessTokensWithNilExpiresAt < Gitlab::Database::Mi
restrict_gitlab_migration gitlab_schema: :gitlab_main
class BatchedBackgroundMigration < MigrationRecord
self.table_name = 'batched_background_migrations'
end
def up
migration = BatchedBackgroundMigration.find_by(
job_class_name: 'CleanupPersonalAccessTokensWithNilExpiresAt',
table_name: :personal_access_tokens,
column_name: :id)
return unless migration
# The CleanupPersonalAccessTokensWithNilExpiresAt migration was
# NOP'ed in some releases. If the migration exists, then finish it
# to ensure that we don't have any background migrations left to
# finish. The job class should be NOP'ed as well.
ensure_batched_background_migration_is_finished(
job_class_name: 'CleanupPersonalAccessTokensWithNilExpiresAt',
table_name: :personal_access_tokens,
Loading