Skip to content

Commit

Permalink
Redefine archive access points
Browse files Browse the repository at this point in the history
  • Loading branch information
marksparkza committed Sep 30, 2024
1 parent 741e91b commit a3862cb
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 36 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Redefine archive access points
Revision ID: 5cb26063cc6c
Revises: cecb45343667
Create Date: 2024-09-30 11:56:41.631854
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '5cb26063cc6c'
down_revision = 'cecb45343667'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic ###
op.add_column('archive', sa.Column('download_url', sa.String(), nullable=True))
op.add_column('archive', sa.Column('upload_url', sa.String(), nullable=True))
op.drop_column('archive', 'url')
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic ###
op.add_column('archive', sa.Column('url', sa.VARCHAR(), autoincrement=False, nullable=False))
op.drop_column('archive', 'upload_url')
op.drop_column('archive', 'download_url')
# ### end Alembic commands ###
13 changes: 5 additions & 8 deletions odp/db/models/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@


class Archive(Base):
"""A data store for digital resources.
`url` is for downloads, `dir` for uploads.
"""
"""A data store for digital resources."""

__tablename__ = 'archive'

Expand All @@ -25,21 +22,21 @@ class Archive(Base):
)

id = Column(String, primary_key=True)
url = Column(String, nullable=False)
dir = Column(String)
adapter = Column(Enum(ArchiveAdapter), nullable=False)
download_url = Column(String)
upload_url = Column(String)

scope_id = Column(String, nullable=False)
scope_type = Column(Enum(ScopeType), nullable=False)
scope = relationship('Scope')

_repr_ = 'id', 'url', 'dir', 'adapter', 'scope_id'
_repr_ = 'id', 'adapter', 'download_url', 'upload_url', 'scope_id'


class ArchiveResource(Base):
"""An archived instance of a resource.
`path` is relative to `url` of the archive.
`path` is relative to the archive's upload and download URLs.
"""

__tablename__ = 'archive_resource'
Expand Down

0 comments on commit a3862cb

Please sign in to comment.