Skip to content

Commit

Permalink
fix: add unique constraint in task_logs for expense_group (#666)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hrishabh17 committed Nov 15, 2024
1 parent c88e867 commit b10510d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions apps/tasks/migrations/0012_alter_tasklog_expense_group.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 3.2.14 on 2024-11-14 10:35

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('fyle', '0033_expense_paid_on_fyle'),
('tasks', '0011_error_repetition_count'),
]

operations = [
migrations.AlterField(
model_name='tasklog',
name='expense_group',
field=models.ForeignKey(help_text='Reference to Expense group', null=True, on_delete=django.db.models.deletion.PROTECT, to='fyle.expensegroup', unique=True),
),
]
2 changes: 1 addition & 1 deletion apps/tasks/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class TaskLog(models.Model):
type = models.CharField(max_length=50, choices=TASK_TYPE, help_text='Task type (FETCH_EXPENSES / CREATE_BILL)')
task_id = models.CharField(max_length=255, null=True, help_text='Django Q task reference')
expense_group = models.ForeignKey(ExpenseGroup, on_delete=models.PROTECT,
null=True, help_text='Reference to Expense group')
null=True, help_text='Reference to Expense group', unique=True)
bill = models.ForeignKey(Bill, on_delete=models.PROTECT, help_text='Reference to Bill', null=True)
expense_report = models.ForeignKey(ExpenseReport, on_delete=models.PROTECT, help_text='Reference to Expense Report',
null=True)
Expand Down

0 comments on commit b10510d

Please sign in to comment.