42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
# Generated by Django 4.2.8 on 2024-02-19 17:40
|
|
|
|
import uuid
|
|
|
|
from django.db import migrations, models
|
|
|
|
|
|
def gen_uuid(apps, schema_editor):
|
|
DataLayer = apps.get_model("umap", "DataLayer")
|
|
for row in DataLayer.objects.all():
|
|
row.uuid = uuid.uuid4()
|
|
row.save(update_fields=["uuid"])
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
("umap", "0017_migrate_to_openstreetmap_oauth2"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.AddField(
|
|
model_name="datalayer",
|
|
name="uuid",
|
|
field=models.UUIDField(default=uuid.uuid4, editable=False, null=True),
|
|
),
|
|
migrations.RunPython(gen_uuid, reverse_code=migrations.RunPython.noop),
|
|
migrations.RunSQL(
|
|
"ALTER TABLE umap_datalayer DROP CONSTRAINT umap_datalayer_pkey"
|
|
),
|
|
# migrations.RemoveConstraint("datalayer", "id"),
|
|
migrations.AlterField(
|
|
"datalayer", name="id", field=models.IntegerField(null=True, blank=True)
|
|
),
|
|
migrations.AlterField(
|
|
model_name="datalayer",
|
|
name="uuid",
|
|
field=models.UUIDField(
|
|
default=uuid.uuid4, editable=False, unique=True, primary_key=True
|
|
),
|
|
),
|
|
# migrations.RemoveConstraint("datalayer", "")
|
|
]
|