fix: 修改迁移 connection-token system_user -> account 字段失败的问题

pull/9327/head^2
Bai 2023-01-17 11:48:49 +08:00 committed by Jiangjie.Bai
parent 6a9f1978bb
commit 3c93ed6a75
1 changed files with 3 additions and 1 deletions

View File

@ -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):