# HG changeset patch # User Martin Bornhold # Date 2016-10-25 08:01:29 # Node ID 3f46ec252da602c8daaf974e9a5d61a40f13ef35 # Parent 645596576fdf6694e55a9bd50861d254ea2d3bd5 db-migration: Add a column to the PullRequest and PullRequestVersion table. The column holds the value of the shadow repo merge reference. diff --git a/rhodecode/__init__.py b/rhodecode/__init__.py --- a/rhodecode/__init__.py +++ b/rhodecode/__init__.py @@ -51,7 +51,7 @@ PYRAMID_SETTINGS = {} EXTENSIONS = {} __version__ = ('.'.join((str(each) for each in VERSION[:3]))) -__dbversion__ = 61 # defines current db version for migrations +__dbversion__ = 62 # defines current db version for migrations __platform__ = platform.system() __license__ = 'AGPLv3, and Commercial License' __author__ = 'RhodeCode GmbH' diff --git a/rhodecode/lib/dbmigrate/versions/062_version_4_5_0.py b/rhodecode/lib/dbmigrate/versions/062_version_4_5_0.py new file mode 100644 --- /dev/null +++ b/rhodecode/lib/dbmigrate/versions/062_version_4_5_0.py @@ -0,0 +1,31 @@ +import logging + +from sqlalchemy import Column, MetaData, Unicode + +from rhodecode.lib.dbmigrate.versions import _reset_base + +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_5_0_0 as db + + # Add shadow merge ref column to pull request table. + pr_table = db.PullRequest.__table__ + pr_col = Column('shadow_merge_ref', Unicode(255), nullable=True) + pr_col.create(table=pr_table) + + # Add shadow merge ref column to pull request version table. + pr_version_table = db.PullRequestVersion.__table__ + pr_version_col = Column('shadow_merge_ref', Unicode(255), nullable=True) + pr_version_col.create(table=pr_version_table) + + +def downgrade(migrate_engine): + meta = MetaData() + meta.bind = migrate_engine