0004_migracion_dato_uuid.py 697 Bytes
# Generated by Django 4.1.9 on 2023-09-25 11:35

from django.db import migrations, models
import uuid


def migrar_datos_uuid(apps, schema):
    Edictos = apps.get_model('edicto', 'Edicto')
    for edicto in Edictos.objects.all():
        edicto.uuid = uuid.uuid4()
        edicto.save()


class Migration(migrations.Migration):

    dependencies = [
        ('edicto', '0003_edicto_uuid'),
    ]

    operations = [
        migrations.RunPython(migrar_datos_uuid, reverse_code=migrations.RunPython.noop),
        migrations.AlterField(
            model_name='edicto',
            name='uuid',
            field=models.UUIDField(default=uuid.uuid4, editable=False, unique=True),
        ),
    ]