##// END OF EJS Templates
fix(LFS): fixed pull_changes method to support a new (sync_large_objects) flag, updated all parts that will use a new flag. Fixes: RCCE-8
fix(LFS): fixed pull_changes method to support a new (sync_large_objects) flag, updated all parts that will use a new flag. Fixes: RCCE-8

File last commit:

r5042:4c5af799 default
r5256:6b054b38 default
Show More
054_version_4_1_0.py
55 lines | 1.3 KiB | text/x-python | PythonLexer
import logging
from collections import namedtuple
from rhodecode.lib.dbmigrate.versions import _reset_base
from rhodecode.model import init_model_encryption, meta
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_3_7_0_0
init_model_encryption(db_3_7_0_0)
fixups(db_3_7_0_0, meta.Session)
def downgrade(migrate_engine):
pass
AUTH_PLUGINS_SETTING = "auth_plugins"
EXTERN_TYPE_RENAME_MAP = {
'container': 'headers',
}
# Only used for logging purposes.
RenameExternTypeOperation = namedtuple(
'RenameExternTypeOperation', ['user', 'old', 'new'])
def fixups(models, Session):
operations = []
# Rename the extern_type attribute
query = models.User.query().filter(
models.User.extern_type.in_(EXTERN_TYPE_RENAME_MAP.keys()))
for user in query:
old = user.extern_type
new = EXTERN_TYPE_RENAME_MAP[old]
user.extern_type = new
Session.add(user)
operations.append(RenameExternTypeOperation(user, old, new))
log.info("Migration of users 'extern_type' attribute.")
for op in operations:
log.info("%s", op)
Session().commit()