From 343600a5403010770d8e0931a8ebf35511ff6361 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 3 Sep 2024 18:41:53 +0200 Subject: [PATCH] migrations --- device/migrations/0001_initial.py | 404 ++++++++++++++++++ ...rand_alter_device_devicehub_id_and_more.py | 33 ++ ...nent_type_remove_computer_type_and_more.py | 73 ++++ 3 files changed, 510 insertions(+) create mode 100644 device/migrations/0001_initial.py create mode 100644 device/migrations/0002_alter_device_brand_alter_device_devicehub_id_and_more.py create mode 100644 device/migrations/0003_remove_component_type_remove_computer_type_and_more.py diff --git a/device/migrations/0001_initial.py b/device/migrations/0001_initial.py new file mode 100644 index 0000000..22d9017 --- /dev/null +++ b/device/migrations/0001_initial.py @@ -0,0 +1,404 @@ +# Generated by Django 5.0.6 on 2024-06-11 09:20 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name="Device", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("created", models.DateTimeField(auto_now_add=True)), + ("updated", models.DateTimeField(auto_now=True)), + ("type", models.CharField(max_length=32)), + ("model", models.CharField(blank=True, max_length=64, null=True)), + ( + "manufacturer", + models.CharField(blank=True, max_length=64, null=True), + ), + ( + "serial_number", + models.CharField(blank=True, max_length=64, null=True), + ), + ("part_number", models.CharField(blank=True, max_length=64, null=True)), + ("brand", models.TextField(blank=True, null=True)), + ("generation", models.SmallIntegerField(blank=True, null=True)), + ("version", models.TextField(blank=True, null=True)), + ("production_date", models.DateTimeField(blank=True, null=True)), + ("variant", models.TextField(blank=True, null=True)), + ("devicehub_id", models.TextField(blank=True, null=True, unique=True)), + ("dhid_bk", models.CharField(blank=True, max_length=64, null=True)), + ("phid_bk", models.CharField(blank=True, max_length=64, null=True)), + ("family", models.CharField(blank=True, max_length=64, null=True)), + ("hid", models.CharField(blank=True, max_length=64, null=True)), + ("chid", models.CharField(blank=True, max_length=64, null=True)), + ("active", models.BooleanField(default=True)), + ( + "owner", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to=settings.AUTH_USER_MODEL, + ), + ), + ], + ), + migrations.CreateModel( + name="Component", + fields=[ + ( + "device", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + primary_key=True, + serialize=False, + to="device.device", + ), + ), + ( + "type", + models.CharField( + choices=[ + ("GraphicCard", "Graphiccard"), + ("DataStorage", "Datastorage"), + ("Motherboard", "Motherboard"), + ("NetworkAdapter", "Networkadapter"), + ("Processor", "Processor"), + ("RamModule", "Rammodule"), + ("SoundCard", "Soundcard"), + ("Display", "Display"), + ("Battery", "Battery"), + ("Camera", "Camera"), + ], + max_length=32, + ), + ), + ], + ), + migrations.CreateModel( + name="Computer", + fields=[ + ( + "device", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + primary_key=True, + serialize=False, + to="device.device", + ), + ), + ("chassis", models.TextField(blank=True, null=True)), + ("system_uuid", models.UUIDField()), + ("sku", models.TextField(blank=True, null=True)), + ( + "type", + models.CharField( + choices=[ + ("Desktop", "Desktop"), + ("Laptop", "Laptop"), + ("Server", "Server"), + ], + default="Laptop", + max_length=32, + ), + ), + ], + ), + migrations.CreateModel( + name="PhysicalProperties", + fields=[ + ( + "device", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + primary_key=True, + serialize=False, + to="device.device", + ), + ), + ("weight", models.FloatField(blank=True, null=True)), + ("width", models.FloatField(blank=True, null=True)), + ("height", models.FloatField(blank=True, null=True)), + ("depth", models.FloatField(blank=True, null=True)), + ("color", models.CharField(blank=True, max_length=20, null=True)), + ("image", models.CharField(blank=True, max_length=64, null=True)), + ], + ), + migrations.CreateModel( + name="SoundCard", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "component", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + to="device.component", + ), + ), + ], + ), + migrations.CreateModel( + name="RamModule", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("size", models.IntegerField(blank=True, null=True)), + ("speed", models.SmallIntegerField(blank=True, null=True)), + ( + "interface", + models.CharField( + choices=[ + ("SDRAM", "Sdram"), + ("DDR SDRAM", "Ddr"), + ("DDR2 SDRAM", "Ddr2"), + ("DDR3 SDRAM", "Ddr3"), + ("DDR4 SDRAM", "Ddr4"), + ("DDR5 SDRAM", "Ddr5"), + ("DDR6 SDRAM", "Ddr6"), + ("LPDDR3", "Lpddr3"), + ], + max_length=32, + ), + ), + ( + "format", + models.CharField( + choices=[("DIMM", "Dimm"), ("SODIMM", "Sodimm")], max_length=32 + ), + ), + ( + "component", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + to="device.component", + ), + ), + ], + ), + migrations.CreateModel( + name="Processor", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("speed", models.FloatField(blank=True, null=True)), + ("cores", models.SmallIntegerField(blank=True, null=True)), + ("threads", models.SmallIntegerField(blank=True, null=True)), + ("address", models.SmallIntegerField(blank=True, null=True)), + ( + "component", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + to="device.component", + ), + ), + ], + ), + migrations.CreateModel( + name="NetworkAdapter", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("speed", models.IntegerField(blank=True, null=True)), + ("wireless", models.BooleanField(default=False)), + ( + "component", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + to="device.component", + ), + ), + ], + ), + migrations.CreateModel( + name="Motherboard", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("slots", models.SmallIntegerField(blank=True, null=True)), + ("usb", models.SmallIntegerField(blank=True, null=True)), + ("firewire", models.SmallIntegerField(blank=True, null=True)), + ("serial", models.SmallIntegerField(blank=True, null=True)), + ("pcmcia", models.SmallIntegerField(blank=True, null=True)), + ("bios_date", models.DateTimeField()), + ("ram_slots", models.SmallIntegerField(blank=True, null=True)), + ("ram_max_size", models.IntegerField(blank=True, null=True)), + ( + "component", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + to="device.component", + ), + ), + ], + ), + migrations.CreateModel( + name="GraphicCard", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("memory", models.IntegerField(blank=True, null=True)), + ( + "component", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + to="device.component", + ), + ), + ], + ), + migrations.CreateModel( + name="Display", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "component", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + to="device.component", + ), + ), + ], + ), + migrations.CreateModel( + name="DataStorage", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("size", models.IntegerField(blank=True, null=True)), + ( + "interface", + models.CharField( + choices=[ + ("ATA", "Ata"), + ("USB", "Usb"), + ("PCI", "Pci"), + ("NVME", "Nvme"), + ], + max_length=32, + ), + ), + ( + "type", + models.CharField( + choices=[ + ("HardDrive", "Harddrive"), + ("SolidStateDrive", "Solidstatedrive"), + ], + max_length=32, + ), + ), + ( + "component", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + to="device.component", + ), + ), + ], + ), + migrations.CreateModel( + name="Battery", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "component", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + to="device.component", + ), + ), + ], + ), + migrations.AddField( + model_name="component", + name="computer", + field=models.OneToOneField( + null=True, + on_delete=django.db.models.deletion.CASCADE, + to="device.computer", + ), + ), + ] diff --git a/device/migrations/0002_alter_device_brand_alter_device_devicehub_id_and_more.py b/device/migrations/0002_alter_device_brand_alter_device_devicehub_id_and_more.py new file mode 100644 index 0000000..1d02fb7 --- /dev/null +++ b/device/migrations/0002_alter_device_brand_alter_device_devicehub_id_and_more.py @@ -0,0 +1,33 @@ +# Generated by Django 5.0.6 on 2024-07-03 11:07 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("device", "0001_initial"), + ] + + operations = [ + migrations.AlterField( + model_name="device", + name="brand", + field=models.CharField(blank=True, max_length=64, null=True), + ), + migrations.AlterField( + model_name="device", + name="devicehub_id", + field=models.CharField(blank=True, max_length=64, null=True, unique=True), + ), + migrations.AlterField( + model_name="device", + name="variant", + field=models.CharField(blank=True, max_length=64, null=True), + ), + migrations.AlterField( + model_name="device", + name="version", + field=models.CharField(blank=True, max_length=64, null=True), + ), + ] diff --git a/device/migrations/0003_remove_component_type_remove_computer_type_and_more.py b/device/migrations/0003_remove_component_type_remove_computer_type_and_more.py new file mode 100644 index 0000000..d57d6bc --- /dev/null +++ b/device/migrations/0003_remove_component_type_remove_computer_type_and_more.py @@ -0,0 +1,73 @@ +# Generated by Django 5.0.6 on 2024-07-03 12:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("device", "0002_alter_device_brand_alter_device_devicehub_id_and_more"), + ] + + operations = [ + migrations.RemoveField( + model_name="component", + name="type", + ), + migrations.RemoveField( + model_name="computer", + name="type", + ), + migrations.RemoveField( + model_name="datastorage", + name="type", + ), + migrations.AlterField( + model_name="computer", + name="chassis", + field=models.CharField( + blank=True, + choices=[ + ("Tower", "Tower"), + ("All in one", "Allinone"), + ("Microtower", "Microtower"), + ("Netbook", "Netbook"), + ("Laptop", "Laptop"), + ("Tablet", "Tabler"), + ("Server", "Server"), + ("Non-physical device", "Virtual"), + ], + max_length=32, + null=True, + ), + ), + migrations.AlterField( + model_name="computer", + name="sku", + field=models.CharField(blank=True, max_length=32, null=True), + ), + migrations.AlterField( + model_name="device", + name="type", + field=models.CharField( + choices=[ + ("Desktop", "Desktop"), + ("Laptop", "Laptop"), + ("Server", "Server"), + ("GraphicCard", "Graphiccard"), + ("HardDrive", "Harddrive"), + ("SolidStateDrive", "Solidstatedrive"), + ("Motherboard", "Motherboard"), + ("NetworkAdapter", "Networkadapter"), + ("Processor", "Processor"), + ("RamModule", "Rammodule"), + ("SoundCard", "Soundcard"), + ("Display", "Display"), + ("Battery", "Battery"), + ("Camera", "Camera"), + ], + default="Laptop", + max_length=32, + ), + ), + ]