diff --git a/core/concepts/migrations/0075_remove_concept_repo_version_concepts_and_more.py b/core/concepts/migrations/0075_remove_concept_repo_version_concepts_and_more.py new file mode 100644 index 000000000..7d7524f9d --- /dev/null +++ b/core/concepts/migrations/0075_remove_concept_repo_version_concepts_and_more.py @@ -0,0 +1,21 @@ +# Generated by Django 4.2.4 on 2024-02-08 05:22 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('concepts', '0074_concept_repo_version_concepts'), + ] + + operations = [ + migrations.RemoveIndex( + model_name='concept', + name='repo_version_concepts', + ), + migrations.AddIndex( + model_name='concept', + index=models.Index(condition=models.Q(('is_active', True), ('retired', False)), fields=['id', '-updated_at'], name='repo_version_concepts'), + ), + ] diff --git a/core/concepts/models.py b/core/concepts/models.py index deb865a7b..2110fd7d7 100644 --- a/core/concepts/models.py +++ b/core/concepts/models.py @@ -205,7 +205,7 @@ class Meta: models.Index(fields=['version']), models.Index( name='repo_version_concepts', - fields=['id'], + fields=['id', '-updated_at'], condition=Q(is_active=True, retired=False) ) ] + VersionedModel.Meta.indexes diff --git a/core/mappings/migrations/0053_remove_mapping_repo_version_mappings_and_more.py b/core/mappings/migrations/0053_remove_mapping_repo_version_mappings_and_more.py new file mode 100644 index 000000000..3d9fb10d1 --- /dev/null +++ b/core/mappings/migrations/0053_remove_mapping_repo_version_mappings_and_more.py @@ -0,0 +1,21 @@ +# Generated by Django 4.2.4 on 2024-02-08 05:19 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('mappings', '0052_mapping_repo_version_mappings'), + ] + + operations = [ + migrations.RemoveIndex( + model_name='mapping', + name='repo_version_mappings', + ), + migrations.AddIndex( + model_name='mapping', + index=models.Index(condition=models.Q(('is_active', True), ('retired', False)), fields=['-updated_at'], name='repo_version_mappings'), + ), + ] diff --git a/core/mappings/migrations/0054_remove_mapping_repo_version_mappings_and_more.py b/core/mappings/migrations/0054_remove_mapping_repo_version_mappings_and_more.py new file mode 100644 index 000000000..37e2f3002 --- /dev/null +++ b/core/mappings/migrations/0054_remove_mapping_repo_version_mappings_and_more.py @@ -0,0 +1,21 @@ +# Generated by Django 4.2.4 on 2024-02-08 05:21 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('mappings', '0053_remove_mapping_repo_version_mappings_and_more'), + ] + + operations = [ + migrations.RemoveIndex( + model_name='mapping', + name='repo_version_mappings', + ), + migrations.AddIndex( + model_name='mapping', + index=models.Index(condition=models.Q(('is_active', True), ('retired', False)), fields=['id', '-updated_at'], name='repo_version_mappings'), + ), + ] diff --git a/core/mappings/models.py b/core/mappings/models.py index 2c84bf610..5fcbd110a 100644 --- a/core/mappings/models.py +++ b/core/mappings/models.py @@ -61,7 +61,7 @@ class Meta: ), models.Index( name='repo_version_mappings', - fields=['id'], + fields=['id', '-updated_at'], condition=Q(is_active=True, retired=False) ), ] + VersionedModel.Meta.indexes