Skip to content

Commit

Permalink
Add session and sprint UUID fields to fires
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Jan 29, 2025
1 parent a421207 commit 09ccaf6
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 5.1.4 on 2025-01-29 18:04

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("contacts", "0199_contactfire"),
]

operations = [
migrations.AddField(
model_name="contactfire",
name="session_uuid",
field=models.UUIDField(null=True),
),
migrations.AddField(
model_name="contactfire",
name="sprint_uuid",
field=models.UUIDField(null=True),
),
migrations.AlterField(
model_name="contactfire",
name="extra",
field=models.JSONField(null=True),
),
]
8 changes: 7 additions & 1 deletion temba/contacts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1751,9 +1751,15 @@ class ContactFire(models.Model):
contact = models.ForeignKey(Contact, on_delete=models.PROTECT, related_name="fires", db_index=False) # index below
fire_type = models.CharField(max_length=1, choices=TYPE_CHOICES)
scope = models.CharField(max_length=64) # e.g. campaign event id
extra = models.JSONField(default=dict) # e.g. session id
fire_on = models.DateTimeField(db_index=True)

# used to ensure wait events don't act on a session that's already changed
session_uuid = models.UUIDField(null=True)
sprint_uuid = models.UUIDField(null=True)

# TODO remove
extra = models.JSONField(null=True)

class Meta:
constraints = [
# used to prevent adding duplicate fires for the same contact and scope
Expand Down

0 comments on commit 09ccaf6

Please sign in to comment.