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.
30 lines
856 B
30 lines
856 B
# Generated by Django 3.2.14 on 2022-12-15 07:08
|
|
|
|
from django.db import migrations
|
|
|
|
|
|
def migrate_del_macos(apps, schema_editor):
|
|
db_alias = schema_editor.connection.alias
|
|
asset_model = apps.get_model('assets', 'Asset')
|
|
platform_model = apps.get_model('assets', 'Platform')
|
|
old_macos = platform_model.objects.using(db_alias).get(
|
|
name='MacOS', type='macos'
|
|
)
|
|
new_macos = platform_model.objects.using(db_alias).get(
|
|
name='macOS', type='unix'
|
|
)
|
|
asset_model.objects.using(db_alias).filter(
|
|
platform=old_macos).update(platform=new_macos)
|
|
|
|
platform_model.objects.using(db_alias).filter(id=old_macos.id).delete()
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
('assets', '0113_auto_20221122_2015'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(migrate_del_macos),
|
|
]
|