From af40e46a755473b6982cbfaca762afc92756457c Mon Sep 17 00:00:00 2001 From: Bai Date: Thu, 3 Dec 2020 10:20:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E8=BF=81=E7=A7=BBDefa?= =?UTF-8?q?ult=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/migrations/0063_migrate_default_node_key.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/assets/migrations/0063_migrate_default_node_key.py b/apps/assets/migrations/0063_migrate_default_node_key.py index 609bc9590..fc294264f 100644 --- a/apps/assets/migrations/0063_migrate_default_node_key.py +++ b/apps/assets/migrations/0063_migrate_default_node_key.py @@ -38,14 +38,14 @@ def migrate_default_node_key(apps, schema_editor): if all_assets: print(f'Check new default node has assets (count: {len(all_assets)})') return - all_children = Node.objects.filter(Q(key__startswith=f'{new_default_node_key}:')) + all_children = Node.objects.filter(key__startswith=f'{new_default_node_key}:') if all_children: print(f'Check new default node has children nodes (count: {len(all_children)})') return print(f'Check new default node not has assets and children nodes, delete it.') new_default_node.delete() # 执行修改 - print(f'Modify old default node key from `{old_default_node_key}` to `{new_default_node_key}`') + print(f'Modify old default node `key` from `{old_default_node_key}` to `{new_default_node_key}`') nodes = Node.objects.filter( Q(key__istartswith=f'{old_default_node_key}:') | Q(key=old_default_node_key) ) @@ -57,8 +57,8 @@ def migrate_default_node_key(apps, schema_editor): node.key = new_key node.parent_key = compute_parent_key(node.key) # 批量更新 + print(f'Bulk update nodes `key` and `parent_key`, (count: {len(nodes)})') Node.objects.bulk_update(nodes, ['key', 'parent_key']) - print('Bulk update key and parent_key') class Migration(migrations.Migration):