From 4849b2627ad063eeccbee951fecec7b3a5bc7d3c Mon Sep 17 00:00:00 2001 From: ibuler Date: Wed, 19 Apr 2023 10:39:50 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/migrations/0115_auto_20230417_1425.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/assets/migrations/0115_auto_20230417_1425.py b/apps/assets/migrations/0115_auto_20230417_1425.py index 4995ac85e..34cd7ef2c 100644 --- a/apps/assets/migrations/0115_auto_20230417_1425.py +++ b/apps/assets/migrations/0115_auto_20230417_1425.py @@ -3,14 +3,15 @@ from django.db import migrations, models -def migrate_platform_automation_id(apps, schema_editor): +def migrate_platform_automation_id(apps, *args): platform_model = apps.get_model('assets', 'Platform') for platform in platform_model.objects.all(): - platform._automation_id = platform.automation.id - platform.save(update_fields=['_automation_id']) + if platform.automation: + platform._automation_id = platform.automation.id + platform.save(update_fields=['_automation_id']) -def migrate_automation_platform(apps, schema_editor): +def migrate_automation_platform(apps, *args): platform_model = apps.get_model('assets', 'Platform') automation_model = apps.get_model('assets', 'PlatformAutomation') platforms = platform_model.objects.all()