mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-07-17 16:31:28 +00:00
perf: 优化一下迁移
This commit is contained in:
parent
12adf66f41
commit
4849b2627a
@ -3,14 +3,15 @@
|
|||||||
from django.db import migrations, models
|
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')
|
platform_model = apps.get_model('assets', 'Platform')
|
||||||
for platform in platform_model.objects.all():
|
for platform in platform_model.objects.all():
|
||||||
platform._automation_id = platform.automation.id
|
if platform.automation:
|
||||||
platform.save(update_fields=['_automation_id'])
|
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')
|
platform_model = apps.get_model('assets', 'Platform')
|
||||||
automation_model = apps.get_model('assets', 'PlatformAutomation')
|
automation_model = apps.get_model('assets', 'PlatformAutomation')
|
||||||
platforms = platform_model.objects.all()
|
platforms = platform_model.objects.all()
|
||||||
|
Loading…
Reference in New Issue
Block a user