diff --git a/backend/metagenedb/apps/catalog/migrations/0028_index_source_and_functions.py b/backend/metagenedb/apps/catalog/migrations/0028_index_source_and_functions.py new file mode 100644 index 0000000000000000000000000000000000000000..b1b1ec6aed4bccb539556740b1f21cbc5e804445 --- /dev/null +++ b/backend/metagenedb/apps/catalog/migrations/0028_index_source_and_functions.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1.7 on 2021-03-26 13:48 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('catalog', '0027_fix_deprecated_jsonfield'), + ] + + operations = [ + migrations.AlterField( + model_name='gene', + name='functions', + field=models.ManyToManyField(db_index=True, through='catalog.GeneFunction', to='catalog.Function'), + ), + migrations.AlterField( + model_name='gene', + name='source', + field=models.CharField(choices=[('undef', 'Undefined'), ('igc', 'IGC'), ('virgo', 'Virgo')], db_index=True, default='undef', max_length=10), + ), + ] diff --git a/backend/metagenedb/apps/catalog/models/gene.py b/backend/metagenedb/apps/catalog/models/gene.py index 1291e951de442b693921398336c8a82f2bdfbc09..08e8449d52bf33499fb5b9536aeb899dd7cceca3 100644 --- a/backend/metagenedb/apps/catalog/models/gene.py +++ b/backend/metagenedb/apps/catalog/models/gene.py @@ -24,13 +24,13 @@ class Gene(models.Model): name = models.CharField(max_length=100, unique=True) sequence = models.TextField(blank=True) length = models.PositiveIntegerField(db_index=True) - functions = models.ManyToManyField(Function, through='GeneFunction') + functions = models.ManyToManyField(Function, db_index=True, through='GeneFunction') taxonomy = models.ForeignKey( 'Taxonomy', related_name='genes', on_delete=models.SET_NULL, null=True, blank=True ) - source = models.CharField(max_length=10, choices=SOURCE_CHOICES, default=UNDEFINED) + source = models.CharField(max_length=10, db_index=True, choices=SOURCE_CHOICES, default=UNDEFINED) def __str__(self) -> str: return self.gene_id