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

31 lines
907 B
Python
Raw Normal View History

2024-01-12 21:59:57 +00:00
# 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
2024-06-22 23:33:24 +00:00
IssueThread = apps.get_model('tickets', 'IssueThread')
2024-01-12 21:59:57 +00:00
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),
),
]