-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Promote resource to a top-level entity
- Loading branch information
1 parent
e4e8e7a
commit a2e2481
Showing
8 changed files
with
60 additions
and
118 deletions.
There are no files selected for viewing
30 changes: 0 additions & 30 deletions
30
migrate/versions/2023_11_23_1eea59d91fea_link_package_to_provider.py
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
migrate/versions/2023_11_24_0ab77b1f560e_support_resources_larger_than_2gb.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
from .archive import Archive, ArchiveResource | ||
from .archive import Archive | ||
from .catalog import Catalog, CatalogRecord, CatalogRecordFacet | ||
from .client import Client, ClientCollection, ClientScope | ||
from .collection import Collection, CollectionAudit, CollectionTag, CollectionTagAudit | ||
from .package import Package, PackageResource | ||
from .provider import Provider, ProviderAudit | ||
from .record import PublishedRecord, Record, RecordAudit, RecordTag, RecordTagAudit | ||
from .resource import Resource | ||
from .role import Role, RoleCollection, RoleScope | ||
from .schema import Schema | ||
from .scope import Scope | ||
from .tag import Tag | ||
from .types import AuditCommand, IdentityCommand, SchemaType, ScopeType, TagCardinality, TagType | ||
from .types import AuditCommand, IdentityCommand, ResourceType, SchemaType, ScopeType, TagCardinality, TagType | ||
from .user import IdentityAudit, User, UserRole | ||
from .vocabulary import Vocabulary, VocabularyTerm, VocabularyTermAudit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import uuid | ||
|
||
from sqlalchemy import BigInteger, Column, Enum, ForeignKey, String, TIMESTAMP | ||
from sqlalchemy.orm import relationship | ||
|
||
from odp.db import Base | ||
from odp.db.models.types import ResourceType | ||
|
||
|
||
class Resource(Base): | ||
"""A reference to a file, folder or web page in an archive. | ||
`path` is relative to `url` of the archive. | ||
""" | ||
|
||
__tablename__ = 'resource' | ||
|
||
id = Column(String, primary_key=True, default=lambda: str(uuid.uuid4())) | ||
type = Column(Enum(ResourceType), nullable=False) | ||
path = Column(String, nullable=False) | ||
name = Column(String) | ||
size = Column(BigInteger) | ||
md5 = Column(String) | ||
timestamp = Column(TIMESTAMP(timezone=True)) | ||
|
||
archive_id = Column(String, ForeignKey('archive.id', ondelete='CASCADE'), nullable=False) | ||
archive = relationship('Archive') | ||
|
||
_repr_ = 'id', 'path', 'name', 'type', 'size', 'archive_id' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters