Skip to content

Commit

Permalink
fix: add index to cost type model (#574)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hrishabh17 committed Nov 13, 2024
1 parent 2f5499a commit 95a72fa
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
25 changes: 25 additions & 0 deletions apps/sage_intacct/migrations/0030_auto_20241112_0425.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 3.2.14 on 2024-11-12 04:25

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('sage_intacct', '0029_auto_20240902_1511'),
]

operations = [
migrations.AddIndex(
model_name='costtype',
index=models.Index(fields=['project_id'], name='cost_types_project_04e2f5_idx'),
),
migrations.AddIndex(
model_name='costtype',
index=models.Index(fields=['task_id'], name='cost_types_task_id_085813_idx'),
),
migrations.AddIndex(
model_name='costtype',
index=models.Index(fields=['task_name'], name='cost_types_task_na_17ecec_idx'),
),
]
5 changes: 5 additions & 0 deletions apps/sage_intacct/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1511,6 +1511,11 @@ class CostType(models.Model):
class Meta:
unique_together = ('record_number', 'workspace_id')
db_table = 'cost_types'
indexes = [
models.Index(fields=['project_id']),
models.Index(fields=['task_id']),
models.Index(fields=['task_name']),
]

@staticmethod
def bulk_create_or_update(cost_types: List[Dict], workspace_id: int):
Expand Down

0 comments on commit 95a72fa

Please sign in to comment.