mirror of https://github.com/jumpserver/jumpserver
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
700 B
29 lines
700 B
# Generated by Django 4.1.13 on 2024-07-09 10:19
|
|
|
|
from django.db import migrations
|
|
|
|
|
|
def migrate_platform_protocol_primary(apps, schema_editor):
|
|
platform_model = apps.get_model('assets', 'Platform')
|
|
platforms = platform_model.objects.all()
|
|
|
|
for platform in platforms:
|
|
p = platform.protocols.filter(primary=True).first()
|
|
if p:
|
|
continue
|
|
p = platform.protocols.first()
|
|
if not p:
|
|
continue
|
|
p.primary = True
|
|
p.save()
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
('assets', '0003_auto_20180109_2331'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(migrate_platform_protocol_primary)
|
|
]
|