c3lf-system-3/core/tickets/migrations/0006_issuethread_uuid.py
2024-01-12 23:02:30 +01:00

32 lines
885 B
Python

# Generated by Django 4.2.7 on 2024-01-12 21:28
from django.db import migrations, models
from tickets.models import IssueThread
class Migration(migrations.Migration):
dependencies = [
('tickets', '0005_remove_issuethread_last_activity'),
]
def set_uuid(apps, schema_editor):
import uuid
for issue_thread in IssueThread.objects.all():
issue_thread.uuid = str(uuid.uuid4())
issue_thread.save()
operations = [
migrations.AddField(
model_name='issuethread',
name='uuid',
field=models.CharField(max_length=255, null=True),
),
migrations.RunPython(set_uuid),
migrations.AlterField(
model_name='issuethread',
name='uuid',
field=models.CharField(max_length=255, unique=True, null=False, blank=False),
),
]