Phase 1 of migrating APPR-specific tables to tables with the Appr
prefix
Fixes https://jira.coreos.com/browse/QUAY-950
This commit is contained in:
parent
6622f27c93
commit
113bb96f29
28 changed files with 699 additions and 176 deletions
|
@ -10,7 +10,7 @@ from cachetools import ttl_cache
|
|||
from data.model import (
|
||||
config, DataModelException, tag, db_transaction, storage, permission, _basequery)
|
||||
from data.database import (
|
||||
Repository, Namespace, RepositoryTag, Star, Image, ImageStorage, User, Visibility, Tag,
|
||||
Repository, Namespace, RepositoryTag, Star, Image, ImageStorage, User, Visibility, Tag, ApprTag,
|
||||
RepositoryPermission, RepositoryActionCount, Role, RepositoryAuthorizedEmail, TagManifest,
|
||||
DerivedStorageForImage, Label, TagManifestLabel, db_for_update, get_epoch_timestamp,
|
||||
db_random_func, db_concat_func, RepositorySearchScore, RepositoryKind)
|
||||
|
@ -87,11 +87,13 @@ def purge_repository(namespace_name, repository_name):
|
|||
except Repository.DoesNotExist:
|
||||
return False
|
||||
|
||||
# Delete the repository of all OCI-referenced entries.
|
||||
# Delete the repository of all Appr-referenced entries.
|
||||
# Note that new-model Tag's must be deleted in *two* passes, as they can reference parent tags,
|
||||
# and MySQL is... particular... about such relationships when deleting.
|
||||
Tag.delete().where(Tag.repository == repo, ~(Tag.linked_tag >> None)).execute()
|
||||
Tag.delete().where(Tag.repository == repo).execute()
|
||||
ApprTag.delete().where(ApprTag.repository == repo, ~(ApprTag.linked_tag >> None)).execute()
|
||||
ApprTag.delete().where(ApprTag.repository == repo).execute()
|
||||
|
||||
# Delete all tags to allow gc to reclaim storage
|
||||
previously_referenced = tag.purge_all_tags(repo)
|
||||
|
|
Reference in a new issue