# Generated by Django 2.2 on 2021-06-30 16:29 from django.db import migrations, models import django.db.models.deletion from account.models import * #def set_architectures(apps, schema_editor): # model = apps.get_model('resource_inventory', 'Image') # # #while model.objects.filter(architecture=' # for obj in model.objects.all(): # obj.architecture = def set_availability(apps, schema_editor): models = [apps.get_model('resource_inventory', 'Image'), apps.get_model('resource_inventory', 'Opsys')] for model in models: for obj in model.objects.all(): obj.available = False obj.obsolete = True obj.save() def set_rconfig_arch(apps, schema_editor): rprofs = apps.get_model('resource_inventory', 'ResourceProfile') for rprof in rprofs.objects.all(): rprof.architecture = rprof.cpuprofile.first().architecture class Migration(migrations.Migration): dependencies = [ ('account', '0009_auto_20210324_2107'), ('resource_inventory', '0017_auto_20201218_1516'), ] operations = [ migrations.RemoveField( model_name='image', name='host_type', ), migrations.AlterField( model_name='image', name='lab_id', field=models.CharField(default='none (retired)', max_length=100), preserve_default=True, ), migrations.RemoveField( model_name='opsys', name='sup_installers', ), migrations.AddField( model_name='image', name='architecture', field=models.CharField(choices=[('x86_64', 'x86_64'), ('aarch64', 'aarch64'), ('unknown', 'unknown')], default='unknown', max_length=50), preserve_default=False, ), migrations.AddField( model_name='image', name='available', field=models.BooleanField(default=True), ), migrations.AddField( model_name='image', name='obsolete', field=models.BooleanField(default=False), ), migrations.AddField( model_name='opsys', name='available', field=models.BooleanField(default=False), ), migrations.AddField( model_name='opsys', name='obsolete', field=models.BooleanField(default=True), ), migrations.RunPython(set_availability), migrations.AddField( model_name='opsys', name='lab_id', field=models.CharField(default="none (retired)", max_length=100), preserve_default=False, ), migrations.AddField( model_name='opsys', name='from_lab', field=models.ForeignKey(default=Lab.objects.first, on_delete=django.db.models.deletion.CASCADE, to='account.Lab'), preserve_default=False, ), migrations.AddField( model_name='resourceprofile', name='architecture', field=models.CharField(choices=[('x86_64', 'x86_64'), ('aarch64', 'aarch64'), ('unknown', 'unknown')], default='unknown', max_length=50), preserve_default=False, ), migrations.RunPython(set_rconfig_arch), ]