artifacts: alter DB column to allow storing really big artifacts.

This commit is contained in:
Marcin Kuzminski 2019-10-22 21:09:00 +02:00
parent c6f649e139
commit dfb948e9ab
3 changed files with 45 additions and 3 deletions

View file

@ -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'

View file

@ -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

View file

@ -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)