diff --git a/rhodecode/__init__.py b/rhodecode/__init__.py --- a/rhodecode/__init__.py +++ b/rhodecode/__init__.py @@ -45,7 +45,7 @@ PYRAMID_SETTINGS = {} EXTENSIONS = {} __version__ = ('.'.join((str(each) for each in VERSION[:3]))) -__dbversion__ = 101 # defines current db version for migrations +__dbversion__ = 102 # defines current db version for migrations __platform__ = platform.system() __license__ = 'AGPLv3, and Commercial License' __author__ = 'RhodeCode GmbH' diff --git a/rhodecode/lib/dbmigrate/versions/102_version_4_18_0.py b/rhodecode/lib/dbmigrate/versions/102_version_4_18_0.py new file mode 100644 --- /dev/null +++ b/rhodecode/lib/dbmigrate/versions/102_version_4_18_0.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- + +import logging +from sqlalchemy import * + +from alembic.migration import MigrationContext +from alembic.operations import Operations +from sqlalchemy import BigInteger + +from rhodecode.lib.dbmigrate.versions import _reset_base +from rhodecode.model import init_model_encryption + + +log = logging.getLogger(__name__) + + +def upgrade(migrate_engine): + """ + Upgrade operations go here. + Don't create your own engine; bind migrate_engine to your metadata + """ + _reset_base(migrate_engine) + from rhodecode.lib.dbmigrate.schema import db_4_18_0_1 + + init_model_encryption(db_4_18_0_1) + + context = MigrationContext.configure(migrate_engine.connect()) + op = Operations(context) + + file_store = db_4_18_0_1.FileStore.__table__ + + with op.batch_alter_table(file_store.name) as batch_op: + batch_op.alter_column("file_size", type_=BigInteger()) + + +def downgrade(migrate_engine): + meta = MetaData() + meta.bind = migrate_engine + + +def fixups(models, _SESSION): + pass diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -40,7 +40,7 @@ from sqlalchemy import ( or_, and_, not_, func, TypeDecorator, event, Index, Sequence, UniqueConstraint, ForeignKey, CheckConstraint, Column, Boolean, String, Unicode, UnicodeText, DateTime, Integer, LargeBinary, - Text, Float, PickleType) + Text, Float, PickleType, BigInteger) from sqlalchemy.sql.expression import true, false, case from sqlalchemy.sql.functions import coalesce, count # pragma: no cover from sqlalchemy.orm import ( @@ -5131,7 +5131,7 @@ class FileStore(Base, BaseModel): # sha256 hash file_hash = Column('file_hash', String(512), nullable=False) - file_size = Column('file_size', Integer(), nullable=False) + file_size = Column('file_size', BigInteger(), nullable=False) created_on = Column('created_on', DateTime(timezone=False), nullable=False, default=datetime.datetime.now) accessed_on = Column('accessed_on', DateTime(timezone=False), nullable=True)