Skip to content

Commit

Permalink
Merge branch 'feature/add_queue_uuid_field' of https://github.com/wen…
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaslinhares committed Oct 28, 2024
2 parents 38798cf + b1efbb1 commit 121f2c2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
27 changes: 27 additions & 0 deletions weni/internal/migrations/0003_ticketerqueue_queue_uuid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 3.2.22 on 2024-10-28 20:32

from django.db import migrations, models
import uuid

def copy_uuid_to_queue_uuid(apps, schema_editor):
ticketerqueue = apps.get_model('internal', 'TicketerQueue')

for queue in ticketerqueue.objects.all():
queue.queue_uuid = queue.topic.uuid
queue.save()

class Migration(migrations.Migration):

dependencies = [
('internal', '0002_project'),
]

operations = [
migrations.AddField(
model_name='ticketerqueue',
name='queue_uuid',
field=models.UUIDField(default=uuid.uuid4),
),
migrations.RunPython(copy_uuid_to_queue_uuid),
]

1 change: 1 addition & 0 deletions weni/internal/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class TicketerQueue(Topic):
ticketer = models.ForeignKey(
Ticketer, on_delete=models.CASCADE, related_name="queues"
)
queue_uuid = models.UUIDField(default=uuid4)

class Meta:
db_table = "internal_tickets_ticketerqueue"
Expand Down

0 comments on commit 121f2c2

Please sign in to comment.