diff --git a/core/concepts/models.py b/core/concepts/models.py index fa0142f27..deb865a7b 100644 --- a/core/concepts/models.py +++ b/core/concepts/models.py @@ -203,6 +203,11 @@ class Meta: ), models.Index(fields=['uri']), models.Index(fields=['version']), + models.Index( + name='repo_version_concepts', + fields=['id'], + condition=Q(is_active=True, retired=False) + ) ] + VersionedModel.Meta.indexes external_id = models.TextField(null=True, blank=True) diff --git a/core/mappings/models.py b/core/mappings/models.py index ad34a9ec8..2c84bf610 100644 --- a/core/mappings/models.py +++ b/core/mappings/models.py @@ -59,6 +59,11 @@ class Meta: fields=['from_concept', 'parent_id'], condition=(Q(id=F('versioned_object_id'))) ), + models.Index( + name='repo_version_mappings', + fields=['id'], + condition=Q(is_active=True, retired=False) + ), ] + VersionedModel.Meta.indexes parent = models.ForeignKey('sources.Source', related_name='mappings_set', on_delete=models.CASCADE) map_type = models.TextField()