diff --git a/CHANGES/1550.removal b/CHANGES/1550.removal new file mode 100644 index 000000000..88abd48c6 --- /dev/null +++ b/CHANGES/1550.removal @@ -0,0 +1 @@ +Remove the `is_highest` field from CollectionVersion table. diff --git a/pulp_ansible/app/migrations/0059_remove_collectionversion_unique_is_highest_and_more.py b/pulp_ansible/app/migrations/0059_remove_collectionversion_unique_is_highest_and_more.py new file mode 100644 index 000000000..a88d38343 --- /dev/null +++ b/pulp_ansible/app/migrations/0059_remove_collectionversion_unique_is_highest_and_more.py @@ -0,0 +1,23 @@ +# Generated by Django 4.2.16 on 2024-11-21 08:53 + +from django.db import migrations +from pulpcore.plugin.migrations import RequireVersion + + +class Migration(migrations.Migration): + + dependencies = [ + ("ansible", "0058_collectionversion_unique_sha256"), + ] + + operations = [ + RequireVersion("ansible", "0.23.0"), + migrations.RemoveConstraint( + model_name="collectionversion", + name="unique_is_highest", + ), + migrations.RemoveField( + model_name="collectionversion", + name="is_highest", + ), + ] diff --git a/pulp_ansible/app/models.py b/pulp_ansible/app/models.py index 3274d00c4..01c474b38 100644 --- a/pulp_ansible/app/models.py +++ b/pulp_ansible/app/models.py @@ -150,10 +150,6 @@ class CollectionVersion(Content): repository (models.CharField): The URL of the originating SCM repository. version (models.CharField): The version of the collection. requires_ansible (models.CharField): The version of Ansible required to use the collection. - is_highest (models.BooleanField): Indicates that the version is the highest one - in the collection. Import and sync workflows update this field, which then - triggers the database to [re]build the search_vector. - This field is Deprecated and scheduled for removal as soon as 0.24.0. Relations: @@ -188,9 +184,6 @@ class CollectionVersion(Content): version_patch = models.IntegerField() version_prerelease = models.CharField(max_length=128) - # This field is deprecated. We keep it for some releases for 0-Downtime upgrades. - is_highest = models.BooleanField(editable=False, default=False) - # Foreign Key Fields collection = models.ForeignKey( Collection, on_delete=models.PROTECT, related_name="versions", editable=False @@ -202,9 +195,7 @@ class CollectionVersion(Content): # a migration file. The trigger only runs when the table is # updated. CollectionVersions are INSERT'ed into the table, so # the search_vector does not get populated at initial creation - # time. In the import or sync workflows, is_highest gets toggled - # back and forth, which causes an UPDATE operation and then the - # search_vector is built. + # time. search_vector = psql_search.SearchVectorField(default="") @hook(BEFORE_SAVE) @@ -232,13 +223,6 @@ def __str__(self): class Meta: default_related_name = "%(app_label)s_%(model_name)s" unique_together = ("sha256",) - constraints = [ - UniqueConstraint( - fields=("collection", "is_highest"), - name="unique_is_highest", - condition=Q(is_highest=True), - ) - ] class CollectionVersionMark(Content):