Changeset - 400fbab35389
[Not reviewed]
Bradley M. Kuhn - 11 years ago 2014-07-03 01:08:37
bkuhn@sfconservancy.org
db: introduce DB_MIGRATIONS to handle the db_migrate version which has the product name in the key.
4 files changed with 12 insertions and 4 deletions:
0 comments (0 inline, 0 general)
kallithea/__init__.py
Show inline comments
 
@@ -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)
kallithea/lib/db_manage.py
Show inline comments
 
@@ -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__)
kallithea/lib/dbmigrate/migrate.cfg
Show inline comments
 
[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.
kallithea/lib/dbmigrate/migrate/versioning/repository.py
Show inline comments
 
@@ -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):
0 comments (0 inline, 0 general)