diff --git a/CHANGES/+revert_rel_path.bugfix b/CHANGES/+revert_rel_path.bugfix new file mode 100644 index 00000000000..2db642413be --- /dev/null +++ b/CHANGES/+revert_rel_path.bugfix @@ -0,0 +1 @@ +Revert the migration of relative_paths to the new domain type. diff --git a/pulpcore/app/migrations/0156_alter_contentartifact_relative_path_and_more.py b/pulpcore/app/migrations/0156_alter_contentartifact_relative_path_and_more.py index 22fcf266537..ce1d7bc03c6 100644 --- a/pulpcore/app/migrations/0156_alter_contentartifact_relative_path_and_more.py +++ b/pulpcore/app/migrations/0156_alter_contentartifact_relative_path_and_more.py @@ -1,6 +1,7 @@ # Generated by Django 5.2.15 on 2026-08-10 10:26 import django.contrib.postgres.indexes +import django.contrib.postgres.operations import django.db.models.expressions import pulpcore.app.models.fields from django.db import migrations @@ -8,32 +9,19 @@ class Migration(migrations.Migration): + atomic = False + dependencies = [ ('core', '0155_create_rel_path_domains'), ] operations = [ - migrations.AlterField( - model_name='contentartifact', - name='relative_path', - field=pulpcore.app.models.fields.RelativePathField(), - ), migrations.AlterField( model_name='distribution', name='base_path', field=pulpcore.app.models.fields.RelativePathField(), ), - migrations.AlterField( - model_name='publishedartifact', - name='relative_path', - field=pulpcore.app.models.fields.RelativePathField(), - ), - migrations.AlterField( - model_name='publishedmetadata', - name='relative_path', - field=pulpcore.app.models.fields.RelativePathField(), - ), - migrations.AddIndex( + django.contrib.postgres.operations.AddIndexConcurrently( model_name='distribution', index=django.contrib.postgres.indexes.SpGistIndex(django.contrib.postgres.indexes.OpClass("base_path", name='text_ops'), include=('pulp_domain',), name='core_distribution_base_path_text'), ), diff --git a/pulpcore/app/migrations/0159_alter_contentartifact_relative_path_and_more.py b/pulpcore/app/migrations/0159_alter_contentartifact_relative_path_and_more.py new file mode 100644 index 00000000000..9c56fc31c73 --- /dev/null +++ b/pulpcore/app/migrations/0159_alter_contentartifact_relative_path_and_more.py @@ -0,0 +1,44 @@ +# Generated by Django 5.2.15 on 2026-09-04 15:12 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0158_domain_default_content_guard'), + ] + + operations = [ + migrations.SeparateDatabaseAndState( + database_operations = [ + migrations.RunSQL( + # These instructions are idempotent and only effective on the timeline with + # the 3.117.0 migrations properly applied. + sql=""" + ALTER TABLE "core_contentartifact" ALTER COLUMN "relative_path" TYPE text; + ALTER TABLE "core_publishedartifact" ALTER COLUMN "relative_path" TYPE text; + ALTER TABLE "core_publishedmetadata" ALTER COLUMN "relative_path" TYPE text; + """, + reverse_sql="", + ), + ], + state_operations = [ + migrations.AlterField( + model_name='contentartifact', + name='relative_path', + field=models.TextField(), + ), + migrations.AlterField( + model_name='publishedartifact', + name='relative_path', + field=models.TextField(), + ), + migrations.AlterField( + model_name='publishedmetadata', + name='relative_path', + field=models.TextField(), + ), + ], + ) + ] diff --git a/pulpcore/app/models/content.py b/pulpcore/app/models/content.py index e62c3f85a6e..c2666833fd5 100644 --- a/pulpcore/app/models/content.py +++ b/pulpcore/app/models/content.py @@ -26,7 +26,6 @@ from pulpcore.app import pulp_hashlib from pulpcore.app.models import BaseModel, MasterModel, fields, storage -from pulpcore.app.models.fields import RelativePathField from pulpcore.app.util import get_domain_pk, gpg_verify from pulpcore.constants import ALL_KNOWN_CONTENT_CHECKSUMS from pulpcore.exceptions import ( @@ -658,7 +657,7 @@ class ContentArtifact(BaseModel, QueryMixin): Artifact, on_delete=models.PROTECT, null=True, related_name="content_memberships" ) content = models.ForeignKey(Content, on_delete=models.CASCADE) - relative_path = RelativePathField() + relative_path = models.TextField() objects = BulkCreateManager() diff --git a/pulpcore/app/models/publication.py b/pulpcore/app/models/publication.py index 5b62b6014f9..734fbb4c11c 100644 --- a/pulpcore/app/models/publication.py +++ b/pulpcore/app/models/publication.py @@ -286,7 +286,7 @@ class PublishedArtifact(BaseModel): publication (models.ForeignKey): The publication in which the artifact is included. """ - relative_path = RelativePathField() + relative_path = models.TextField() content_artifact = models.ForeignKey("ContentArtifact", on_delete=models.CASCADE) publication = models.ForeignKey(Publication, on_delete=models.CASCADE) @@ -309,7 +309,7 @@ class PublishedMetadata(Content): TYPE = "publishedmetadata" - relative_path = RelativePathField() + relative_path = models.TextField() publication = models.ForeignKey(Publication, on_delete=models.CASCADE)