Skip to content

Commit fdbd15b

Browse files
authored
Merge pull request #1221 from tcely/patch-7
Enforce unique for `TaskHistory.task_id`
2 parents d1776df + 9d11620 commit fdbd15b

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Generated by Django 5.2.4 on 2025-07-15 21:40
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('common', '0003_taskhistory_remove_duplicates'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='taskhistory',
15+
name='task_id',
16+
field=models.CharField(max_length=40, unique=True),
17+
),
18+
]
19+

tubesync/common/models/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def succeeded(self, within=None):
7979
class TaskHistory(models.Model):
8080
# the "name" of the task/function to be run
8181
name = models.CharField(max_length=190, db_index=True)
82-
task_id = models.CharField(max_length=40, db_index=True)
82+
task_id = models.CharField(max_length=40, unique=True)
8383
# the json encoded parameters to pass to the task
8484
task_params = models.JSONField(default=dict, encoder=JSONEncoder)
8585

0 commit comments

Comments
 (0)