Remove tag system, use versions only for artifact references
Tags were mutable aliases that caused confusion alongside the immutable version system. This removes tags entirely, keeping only PackageVersion for artifact references. Changes: - Remove tags and tag_history tables (migration 012) - Remove Tag model, TagRepository, and 6 tag API endpoints - Update cache system to create versions instead of tags - Update frontend to display versions instead of tags - Remove tag-related schemas and types - Update artifact cleanup service for version-based ref_count
This commit is contained in:
@@ -8,7 +8,7 @@ from sqlalchemy import func, or_, asc, desc
|
||||
from uuid import UUID
|
||||
|
||||
from .base import BaseRepository
|
||||
from ..models import Package, Project, Tag, Upload, Artifact
|
||||
from ..models import Package, Project, PackageVersion, Upload, Artifact
|
||||
|
||||
|
||||
class PackageRepository(BaseRepository[Package]):
|
||||
@@ -136,10 +136,10 @@ class PackageRepository(BaseRepository[Package]):
|
||||
return self.update(package, **updates)
|
||||
|
||||
def get_stats(self, package_id: UUID) -> dict:
|
||||
"""Get package statistics (tag count, artifact count, total size)."""
|
||||
tag_count = (
|
||||
self.db.query(func.count(Tag.id))
|
||||
.filter(Tag.package_id == package_id)
|
||||
"""Get package statistics (version count, artifact count, total size)."""
|
||||
version_count = (
|
||||
self.db.query(func.count(PackageVersion.id))
|
||||
.filter(PackageVersion.package_id == package_id)
|
||||
.scalar() or 0
|
||||
)
|
||||
|
||||
@@ -154,7 +154,7 @@ class PackageRepository(BaseRepository[Package]):
|
||||
)
|
||||
|
||||
return {
|
||||
"tag_count": tag_count,
|
||||
"version_count": version_count,
|
||||
"artifact_count": artifact_stats[0] if artifact_stats else 0,
|
||||
"total_size": artifact_stats[1] if artifact_stats else 0,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user