diff --git a/kallithea/__init__.py b/kallithea/__init__.py --- a/kallithea/__init__.py +++ b/kallithea/__init__.py @@ -64,6 +64,9 @@ DB_PREFIX = (BRAND + "_") if BRAND != "k # 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 --git a/kallithea/lib/db_manage.py b/kallithea/lib/db_manage.py --- a/kallithea/lib/db_manage.py +++ b/kallithea/lib/db_manage.py @@ -34,7 +34,7 @@ import logging 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 @@ class DbManage(object): 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 --git a/kallithea/lib/dbmigrate/migrate.cfg b/kallithea/lib/dbmigrate/migrate.cfg --- a/kallithea/lib/dbmigrate/migrate.cfg +++ b/kallithea/lib/dbmigrate/migrate.cfg @@ -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 --git a/kallithea/lib/dbmigrate/migrate/versioning/repository.py b/kallithea/lib/dbmigrate/migrate/versioning/repository.py --- a/kallithea/lib/dbmigrate/migrate/versioning/repository.py +++ b/kallithea/lib/dbmigrate/migrate/versioning/repository.py @@ -9,6 +9,7 @@ import logging 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 @@ class Repository(pathed.Pathed): @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):