##// END OF EJS Templates
artifacts: alter DB column to allow storing really big artifacts.
marcink -
r4004:ab65a8ce default
parent child Browse files
Show More
@@ -0,0 +1,42 b''
1 # -*- coding: utf-8 -*-
2
3 import logging
4 from sqlalchemy import *
5
6 from alembic.migration import MigrationContext
7 from alembic.operations import Operations
8 from sqlalchemy import BigInteger
9
10 from rhodecode.lib.dbmigrate.versions import _reset_base
11 from rhodecode.model import init_model_encryption
12
13
14 log = logging.getLogger(__name__)
15
16
17 def upgrade(migrate_engine):
18 """
19 Upgrade operations go here.
20 Don't create your own engine; bind migrate_engine to your metadata
21 """
22 _reset_base(migrate_engine)
23 from rhodecode.lib.dbmigrate.schema import db_4_18_0_1
24
25 init_model_encryption(db_4_18_0_1)
26
27 context = MigrationContext.configure(migrate_engine.connect())
28 op = Operations(context)
29
30 file_store = db_4_18_0_1.FileStore.__table__
31
32 with op.batch_alter_table(file_store.name) as batch_op:
33 batch_op.alter_column("file_size", type_=BigInteger())
34
35
36 def downgrade(migrate_engine):
37 meta = MetaData()
38 meta.bind = migrate_engine
39
40
41 def fixups(models, _SESSION):
42 pass
@@ -45,7 +45,7 b' PYRAMID_SETTINGS = {}'
45 EXTENSIONS = {}
45 EXTENSIONS = {}
46
46
47 __version__ = ('.'.join((str(each) for each in VERSION[:3])))
47 __version__ = ('.'.join((str(each) for each in VERSION[:3])))
48 __dbversion__ = 101 # defines current db version for migrations
48 __dbversion__ = 102 # defines current db version for migrations
49 __platform__ = platform.system()
49 __platform__ = platform.system()
50 __license__ = 'AGPLv3, and Commercial License'
50 __license__ = 'AGPLv3, and Commercial License'
51 __author__ = 'RhodeCode GmbH'
51 __author__ = 'RhodeCode GmbH'
@@ -40,7 +40,7 b' from sqlalchemy import ('
40 or_, and_, not_, func, TypeDecorator, event,
40 or_, and_, not_, func, TypeDecorator, event,
41 Index, Sequence, UniqueConstraint, ForeignKey, CheckConstraint, Column,
41 Index, Sequence, UniqueConstraint, ForeignKey, CheckConstraint, Column,
42 Boolean, String, Unicode, UnicodeText, DateTime, Integer, LargeBinary,
42 Boolean, String, Unicode, UnicodeText, DateTime, Integer, LargeBinary,
43 Text, Float, PickleType)
43 Text, Float, PickleType, BigInteger)
44 from sqlalchemy.sql.expression import true, false, case
44 from sqlalchemy.sql.expression import true, false, case
45 from sqlalchemy.sql.functions import coalesce, count # pragma: no cover
45 from sqlalchemy.sql.functions import coalesce, count # pragma: no cover
46 from sqlalchemy.orm import (
46 from sqlalchemy.orm import (
@@ -5131,7 +5131,7 b' class FileStore(Base, BaseModel):'
5131
5131
5132 # sha256 hash
5132 # sha256 hash
5133 file_hash = Column('file_hash', String(512), nullable=False)
5133 file_hash = Column('file_hash', String(512), nullable=False)
5134 file_size = Column('file_size', Integer(), nullable=False)
5134 file_size = Column('file_size', BigInteger(), nullable=False)
5135
5135
5136 created_on = Column('created_on', DateTime(timezone=False), nullable=False, default=datetime.datetime.now)
5136 created_on = Column('created_on', DateTime(timezone=False), nullable=False, default=datetime.datetime.now)
5137 accessed_on = Column('accessed_on', DateTime(timezone=False), nullable=True)
5137 accessed_on = Column('accessed_on', DateTime(timezone=False), nullable=True)
General Comments 0
You need to be logged in to leave comments. Login now