mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-07-17 00:11:42 +00:00
perf: 优化一下迁移
This commit is contained in:
parent
12adf66f41
commit
4849b2627a
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user