Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated db tables #156

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES/143.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed pre 0.2 residua. When you are upgrading from <0.3, and your system was operated on <0.2 before, make sure you have run the corresponding datarepair commands before upgrading the codebase to this version.
Empty file.
Empty file.
64 changes: 0 additions & 64 deletions pulp_gem/app/management/commands/datarepair-gemspec-platform.py

This file was deleted.

60 changes: 0 additions & 60 deletions pulp_gem/app/management/commands/datarepair-shallow-gems.py

This file was deleted.

4 changes: 2 additions & 2 deletions pulp_gem/app/migrations/0009_check_datarepair.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
def check_datarepair(apps, schema_editor):
ShallowGemContent = apps.get_model("gem", "ShallowGemContent")
if ShallowGemContent.objects.exists():
raise RuntimeError("Before continuing with this upgrade, you need to run the 'datarepair-shallow-gems' command, or remove all remaining broken repository versions.")
raise RuntimeError("Before continuing with this upgrade, you need to downgrade pulp_gem to ~=0.3, then run the 'datarepair-shallow-gems' command, or remove all remaining broken repository versions.")

GemContent = apps.get_model("gem", "GemContent")
if GemContent.objects.filter(platform=None).exists():
raise RuntimeError("Before continuing with this upgrade, you need to run the 'datarepair-gemspec-platform' command, or remove all remaining broken repository versions.")
raise RuntimeError("Before continuing with this upgrade, you need to downgrade pulp_gem to ~=0.3, then run the 'datarepair-gemspec-platform' command, or remove all remaining broken repository versions.")


class Migration(migrations.Migration):
Expand Down
15 changes: 15 additions & 0 deletions pulp_gem/app/migrations/0010_delete_shallowgemcontent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Generated by Django 4.2.4 on 2023-09-12 10:56

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("gem", "0009_check_datarepair"),
]

operations = [
migrations.DeleteModel(
name="ShallowGemContent",
),
]
17 changes: 17 additions & 0 deletions pulp_gem/app/migrations/0011_alter_gemcontent_platform.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.4 on 2023-09-12 11:04

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("gem", "0010_delete_shallowgemcontent"),
]

operations = [
migrations.AlterField(
model_name="gemcontent",
name="platform",
field=models.TextField(),
),
]
40 changes: 2 additions & 38 deletions pulp_gem/app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,39 +19,6 @@
log = getLogger(__name__)


class ShallowGemContent(Content):
"""
The "shallow-gem" content type.

Content of this type represents a ruby gem file with its spec data.
This is the old deprecated format that is only carried around for legacy installations.

Fields:
name (str): The name of the gem.
version (str): The version of the gem.

"""

TYPE = "shallow-gem"

name = models.TextField(blank=False, null=False)
version = models.TextField(blank=False, null=False)

@property
def relative_path(self):
"""The relative path this gem is stored under for the content app."""
return f"gems/{self.name}-{self.version}.gem"

@property
def gemspec_path(self):
"""The path for this gem's gemspec for the content app."""
return f"quick/Marshal.4.8/{self.name}-{self.version}.gemspec.rz"

class Meta:
default_related_name = "%(app_label)s_%(model_name)s"
unique_together = ("name", "version")


class GemContent(Content):
"""
The "gem" content type.
Expand All @@ -65,10 +32,7 @@ class GemContent(Content):

name = models.TextField(blank=False, null=False)
version = models.TextField(blank=False, null=False)
# `null` on `platform is allowed for zero downtime upgrade from version 0.1.*.
# Change this to `null=False` in a version no earlier than 0.3.0.
# See also `ext_version` and the datarepair-gemspec-platform command.
platform = models.TextField(blank=False, null=True)
platform = models.TextField(blank=False, null=False)
checksum = models.CharField(max_length=64, null=False, db_index=True)
prerelease = models.BooleanField(default=False)
dependencies = HStoreField(default=dict)
Expand All @@ -89,7 +53,7 @@ def gemspec_path(self):
def ext_version(self):
"""The version for this gem with the appended platform if not "ruby"."""
# Remove the `None` with the change to the platform column.
if self.platform is None or self.platform == "ruby":
if self.platform == "ruby":
platform_suffix = ""
else:
platform_suffix = f"-{self.platform}"
Expand Down
Loading