# Generated by Django 5.1.2 on 2024-11-09 22:39

from django.db import migrations


def update_device_types(apps, schema_editor):
    Device = apps.get_model("games", "Device")

    # Mapping of short names to long names
    type_map = {
        "pc": "PC",
        "co": "Console",
        "ha": "Handheld",
        "mo": "Mobile",
        "sbc": "Single-board computer",
        "un": "Unknown",
    }

    # Loop through all devices and update the type field
    for device in Device.objects.all():
        if device.type in type_map:
            device.type = type_map[device.type]
            device.save()


class Migration(migrations.Migration):
    dependencies = [
        ("games", "0039_alter_device_type"),
    ]

    operations = [
        migrations.RunPython(update_device_types),
    ]
