# HG changeset patch # User Marcin Kuzminski # Date 2019-10-31 09:23:54 # Node ID ad2b487a04ddfc62394bd97c1645f76461631e82 # Parent 6c8101bc993e4e9973df6683ae6d32d5acadeba3 users: added description for users. 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__ = 102 # defines current db version for migrations +__dbversion__ = 103 # defines current db version for migrations __platform__ = platform.system() __license__ = 'AGPLv3, and Commercial License' __author__ = 'RhodeCode GmbH' diff --git a/rhodecode/lib/dbmigrate/versions/103_version_4_18_0.py b/rhodecode/lib/dbmigrate/versions/103_version_4_18_0.py new file mode 100644 --- /dev/null +++ b/rhodecode/lib/dbmigrate/versions/103_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) + + user = db_4_18_0_1.User.__table__ + + with op.batch_alter_table(user.name) as batch_op: + batch_op.add_column(Column('description', UnicodeText().with_variant(UnicodeText(1024), 'mysql'))) + + +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 @@ -577,6 +577,7 @@ class User(Base, BaseModel): _email = Column("email", String(255), nullable=True, unique=None, default=None) last_login = Column("last_login", DateTime(timezone=False), nullable=True, unique=None, default=None) last_activity = Column('last_activity', DateTime(timezone=False), nullable=True, unique=None, default=None) + description = Column('description', UnicodeText().with_variant(UnicodeText(1024), 'mysql')) extern_type = Column("extern_type", String(255), nullable=True, unique=None, default=None) extern_name = Column("extern_name", String(255), nullable=True, unique=None, default=None)