jumpserver/apps/assets/migrations/0095_auto_20220407_1726.py

38 lines
1.0 KiB
Python
Raw Normal View History

2022-04-07 10:51:35 +00:00
# Generated by Django 3.1.14 on 2022-04-07 09:26
from django.db import migrations, models
2022-05-02 13:37:42 +00:00
def migrate_platform_type_to_lower(apps, *args):
platform_model = apps.get_model('assets', 'Platform')
platforms = platform_model.objects.all()
for p in platforms:
p.type = p.type.lower()
p.save()
2022-04-07 10:51:35 +00:00
class Migration(migrations.Migration):
dependencies = [
2022-08-24 08:14:32 +00:00
('assets', '0094_auto_20220402_1736'),
2022-04-07 10:51:35 +00:00
]
operations = [
migrations.RenameField(
model_name='platform',
old_name='base',
new_name='type',
),
migrations.AddField(
model_name='platform',
name='category',
2022-08-24 08:14:32 +00:00
field=models.CharField(default='host', max_length=32, verbose_name='Category'),
2022-04-07 10:51:35 +00:00
),
migrations.AlterField(
2022-04-12 09:53:56 +00:00
model_name='platform',
2022-04-07 10:51:35 +00:00
name='type',
2022-08-24 06:23:42 +00:00
field=models.CharField(default='linux', max_length=32, verbose_name='Type'),
2022-04-07 10:51:35 +00:00
),
2022-05-02 13:37:42 +00:00
migrations.RunPython(migrate_platform_type_to_lower)
2022-04-07 10:51:35 +00:00
]