Browse Source

perf: 网络设备 ansible enables true

pull/11568/head
feng 1 year ago committed by Bryan
parent
commit
f6c56d4979
  1. 20
      apps/assets/migrations/0123_device_automation_ansible_enabled.py

20
apps/assets/migrations/0123_device_automation_ansible_enabled.py

@ -0,0 +1,20 @@
# Generated by Django 4.1.10 on 2023-09-13 10:59
from django.db import migrations
def migrate_device_automation_ansible_enabled(apps, *args):
platform_model = apps.get_model('assets', 'Platform')
automation_model = apps.get_model('assets', 'PlatformAutomation')
ids = platform_model.objects.filter(category='device').values_list('id', flat=True)
automation_model.objects.filter(platform_id__in=ids).update(ansible_enabled=True)
class Migration(migrations.Migration):
dependencies = [
('assets', '0122_auto_20230803_1553'),
]
operations = [
migrations.RunPython(migrate_device_automation_ansible_enabled)
]
Loading…
Cancel
Save