From 9786ed74320540378480999dc7a2fb8ceab279e8 Mon Sep 17 00:00:00 2001 From: Mark Jacobson <52427991+marksparkza@users.noreply.github.com> Date: Fri, 24 Nov 2023 15:16:33 +0200 Subject: [PATCH] Support large resource sizes --- ...f560e_support_resources_larger_than_2gb.py | 34 +++++++++++++++++++ odp/db/models/archive.py | 4 +-- 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 migrate/versions/2023_11_24_0ab77b1f560e_support_resources_larger_than_2gb.py diff --git a/migrate/versions/2023_11_24_0ab77b1f560e_support_resources_larger_than_2gb.py b/migrate/versions/2023_11_24_0ab77b1f560e_support_resources_larger_than_2gb.py new file mode 100644 index 0000000..8a05157 --- /dev/null +++ b/migrate/versions/2023_11_24_0ab77b1f560e_support_resources_larger_than_2gb.py @@ -0,0 +1,34 @@ +"""Support resources larger than 2gb + +Revision ID: 0ab77b1f560e +Revises: 1eea59d91fea +Create Date: 2023-11-24 15:12:02.343016 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '0ab77b1f560e' +down_revision = '1eea59d91fea' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic ### + op.alter_column('archive_resource', 'size', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic ### + op.alter_column('archive_resource', 'size', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + # ### end Alembic commands ### diff --git a/odp/db/models/archive.py b/odp/db/models/archive.py index 09960df..7ae402f 100644 --- a/odp/db/models/archive.py +++ b/odp/db/models/archive.py @@ -1,6 +1,6 @@ import uuid -from sqlalchemy import Column, ForeignKey, Integer, String, TIMESTAMP, UniqueConstraint +from sqlalchemy import BigInteger, Column, ForeignKey, String, TIMESTAMP, UniqueConstraint from sqlalchemy.orm import relationship from odp.db import Base @@ -39,7 +39,7 @@ class ArchiveResource(Base): path = Column(String) name = Column(String) type = Column(String) - size = Column(Integer) + size = Column(BigInteger) md5 = Column(String) timestamp = Column(TIMESTAMP(timezone=True))