Skip to content

Commit

Permalink
use progress bar wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
mdtro committed May 31, 2024
1 parent 2532fb5 commit 996b6a6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/sentry/migrations/0725_apitoken_backfill_hashes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from django.db.migrations.state import StateApps

from sentry.new_migrations.migrations import CheckedMigration
from sentry.utils.query import RangeQuerySetWrapperWithProgressBar

logger = logging.getLogger(__name__)

Expand All @@ -23,7 +24,7 @@ def backfill_hash_values(apps: StateApps, schema_editor: BaseDatabaseSchemaEdito
logger.exception("Cannot execute migration. Required symbols could not be imported")
return

for api_token in ApiToken.objects.all():
for api_token in RangeQuerySetWrapperWithProgressBar(ApiToken.objects.all()):
hashed_token = None
if api_token.hashed_token is None:
hashed_token = hashlib.sha256(api_token.token.encode()).hexdigest()
Expand Down

0 comments on commit 996b6a6

Please sign in to comment.