Skip to content

Commit

Permalink
fix: DEV-2667: Replace inner_id index with multicolumn (HumanSignal#2542
Browse files Browse the repository at this point in the history
)
  • Loading branch information
triklozoid authored Jun 20, 2022
1 parent 43d52df commit 4e340ce
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
22 changes: 22 additions & 0 deletions label_studio/tasks/migrations/0023_auto_20220620_1007.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 3.1.14 on 2022-06-20 10:07

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('tasks', '0022_merge_20220517_1128'),
]

operations = [
migrations.AlterField(
model_name='task',
name='inner_id',
field=models.BigIntegerField(default=0, help_text='Internal task ID in the project, starts with 1', null=True, verbose_name='inner id'),
),
migrations.AddIndex(
model_name='task',
index=models.Index(fields=['project', 'inner_id'], name='task_project_499b59_idx'),
),
]
3 changes: 2 additions & 1 deletion label_studio/tasks/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Task(TaskMixin, models.Model):
'data_import.FileUpload', on_delete=models.SET_NULL, null=True, blank=True, related_name='tasks',
help_text='Uploaded file used as data source for this task'
)
inner_id = models.BigIntegerField(_('inner id'), default=0, db_index=True, null=True,
inner_id = models.BigIntegerField(_('inner id'), default=0, null=True,
help_text='Internal task ID in the project, starts with 1')
updates = ['is_labeled']
total_annotations = models.IntegerField(_('total_annotations'), default=0, db_index=True,
Expand All @@ -83,6 +83,7 @@ class Meta:
ordering = ['-updated_at']
indexes = [
models.Index(fields=['project', 'is_labeled']),
models.Index(fields=['project', 'inner_id']),
models.Index(fields=['id', 'project']),
models.Index(fields=['id', 'overlap']),
models.Index(fields=['overlap']),
Expand Down

0 comments on commit 4e340ce

Please sign in to comment.