Skip to content

Commit

Permalink
fix: Add task log constraint (#713)
Browse files Browse the repository at this point in the history
* Revert "fix: add unique constraint in task_logs for expense_group, add interval for next run (#690)"

This reverts commit d1d12fd.

* fix: add unique constraint in task_log
  • Loading branch information
Hrishabh17 committed Jan 3, 2025
1 parent a284091 commit 47f47df
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/0013_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 2025-01-03 08:29

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


class Migration(migrations.Migration):

dependencies = [
('fyle', '0040_expense_masked_corporate_card_number'),
('tasks', '0012_auto_20241127_0730'),
]

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 @@ -20,7 +20,7 @@ class TaskLog(models.Model):
workspace = models.ForeignKey(Workspace, on_delete=models.PROTECT, help_text='Reference to Workspace model')
type = models.CharField(max_length=50, help_text='Task type (FETCH_EXPENSES / CREATE_BILL / CREATE_CHECK)')
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')
expense_group = models.ForeignKey(ExpenseGroup, on_delete=models.PROTECT, 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)
cheque = models.ForeignKey(Cheque, on_delete=models.PROTECT, help_text='Reference to Cheque', null=True)
journal_entry = models.ForeignKey(JournalEntry, on_delete=models.PROTECT, help_text='Reference to journal_entry', null=True)
Expand Down

0 comments on commit 47f47df

Please sign in to comment.