diff --git a/apps/authentication/migrations/0012_auto_20220816_1629.py b/apps/authentication/migrations/0012_auto_20220816_1629.py index 07c9559ce..8f8bb9ffa 100644 --- a/apps/authentication/migrations/0012_auto_20220816_1629.py +++ b/apps/authentication/migrations/0012_auto_20220816_1629.py @@ -16,9 +16,11 @@ def migrate_system_user_to_account(apps, schema_editor): count += len(connection_tokens) updated = [] for connection_token in connection_tokens: + if not connection_token.system_user: + continue connection_token.account = connection_token.system_user.username updated.append(connection_token) - connection_token_model.objects.bulk_update(updated, ['account_username']) + connection_token_model.objects.bulk_update(updated, ['account']) class Migration(migrations.Migration):