# HG changeset patch # User Bradley M. Kuhn # Date 1404342517 14400 # Node ID 400fbab35389397b0a6dee405b7cd157f8b58089 # Parent f5c9018a5cf0c468181f5cc37d1c27c1509cb27c db: introduce DB_MIGRATIONS to handle the db_migrate version which has the product name in the key. diff -r f5c9018a5cf0 -r 400fbab35389 kallithea/__init__.py --- a/kallithea/__init__.py Wed Jul 02 19:08:37 2014 -0400 +++ b/kallithea/__init__.py Wed Jul 02 19:08:37 2014 -0400 @@ -64,6 +64,9 @@ # Users.extern_type and .extern_name value for local users EXTERN_TYPE_INTERNAL = BRAND if BRAND != 'kallithea' else 'internal' +# db_migrate_version.repository_id value, same as kallithea/lib/dbmigrate/migrate.cfg +DB_MIGRATIONS = BRAND + "_db_migrations" + try: from kallithea.lib import get_current_revision _rev = get_current_revision(quiet=True) diff -r f5c9018a5cf0 -r 400fbab35389 kallithea/lib/db_manage.py --- a/kallithea/lib/db_manage.py Wed Jul 02 19:08:37 2014 -0400 +++ b/kallithea/lib/db_manage.py Wed Jul 02 19:08:37 2014 -0400 @@ -34,7 +34,7 @@ from os.path import dirname as dn, join as jn import datetime -from kallithea import __dbversion__, __py_version__, EXTERN_TYPE_INTERNAL +from kallithea import __dbversion__, __py_version__, EXTERN_TYPE_INTERNAL, DB_MIGRATIONS from kallithea.model.user import UserModel from kallithea.lib.utils import ask_ok from kallithea.model import init_model @@ -110,7 +110,7 @@ def set_db_version(self): ver = DbMigrateVersion() ver.version = __dbversion__ - ver.repository_id = 'rhodecode_db_migrations' + ver.repository_id = DB_MIGRATIONS ver.repository_path = 'versions' self.sa.add(ver) log.info('db version set to: %s' % __dbversion__) diff -r f5c9018a5cf0 -r 400fbab35389 kallithea/lib/dbmigrate/migrate.cfg --- a/kallithea/lib/dbmigrate/migrate.cfg Wed Jul 02 19:08:37 2014 -0400 +++ b/kallithea/lib/dbmigrate/migrate.cfg Wed Jul 02 19:08:37 2014 -0400 @@ -1,7 +1,7 @@ [db_settings] # Used to identify which repository this database is versioned under. # You can use the name of your project. -repository_id=rhodecode_db_migrations +repository_id=kallithea_db_migrations # The name of the database table used to track the schema version. # This name shouldn't already be used by your project. diff -r f5c9018a5cf0 -r 400fbab35389 kallithea/lib/dbmigrate/migrate/versioning/repository.py --- a/kallithea/lib/dbmigrate/migrate/versioning/repository.py Wed Jul 02 19:08:37 2014 -0400 +++ b/kallithea/lib/dbmigrate/migrate/versioning/repository.py Wed Jul 02 19:08:37 2014 -0400 @@ -9,6 +9,7 @@ from pkg_resources import resource_filename from tempita import Template as TempitaTemplate +import kallithea from kallithea.lib.dbmigrate.migrate import exceptions from kallithea.lib.dbmigrate.migrate.versioning import version, pathed, cfgparse from kallithea.lib.dbmigrate.migrate.versioning.template import Template @@ -175,7 +176,11 @@ @property def id(self): """Returns repository id specified in config""" - return self.config.get('db_settings', 'repository_id') + # Adjust the value read from kallithea/lib/dbmigrate/migrate.cfg, normally "kallithea_db_migrations" + s = self.config.get('db_settings', 'repository_id') + if s == "kallithea_db_migrations": + s = kallithea.DB_MIGRATIONS + return s @property def use_timestamp_numbering(self):