c3lf-system-3/core/tickets/migrations/0006_issuethread_uuid.py

30 lines
907 B
Python

# Generated by Django 4.2.7 on 2024-01-12 21:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tickets', '0005_remove_issuethread_last_activity'),
]
def set_uuid(apps, schema_editor):
import uuid
IssueThread = apps.get_model('tickets', 'IssueThread')
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),
),
]