Changeset - 24498ba2fbec
[Not reviewed]
Bradley M. Kuhn - 11 years ago 2014-05-23 23:36:09
bkuhn@sfconservancy.org
SETTINGS_PREFIX for identifiers (e.g., db table names) incl. project's name.

kallithea.SETTINGS_PREFIX is a variable string used as a prefix for specific
external identifiers, such as database table names (and likely later form
fields), so that the name of the project need not necessarily be encoded into
data.

This setting is configurable so that compatibility with old, similar
databases can be maintained at the users' request.
17 files changed with 78 insertions and 33 deletions:
0 comments (0 inline, 0 general)
kallithea/__init__.py
Show inline comments
 
@@ -19,13 +19,13 @@ Kallithea, a web based repository manage
 
versioning implementation: http://www.python.org/dev/peps/pep-0386/
 

	
 
This file was forked by the Kallithea project in July 2014.
 
Original author and date, and relevant copyright and licensing information is below:
 
:created_on: Apr 9, 2010
 
:author: marcink
 
:copyright: (c) 2013 RhodeCode GmbH, and others.
 
:copyright: (c) 2013 RhodeCode GmbH, (C) 2014 Bradley M. Kuhn, and others.
 
:license: GPLv3, see LICENSE.md for more details.
 
"""
 

	
 
import sys
 
import platform
 

	
 
@@ -41,12 +41,26 @@ CELERY_EAGER = False
 
# link to config for pylons
 
CONFIG = {}
 

	
 
# Linked module for extensions
 
EXTENSIONS = {}
 

	
 
# SETTINGS_PREFIX is the prefix to use for form fields and database table names.
 

	
 
#  Ideally, SETTINGS_PREFIX would be in an ini file of some sort instead of
 
#  in this code.  However, since this is used in kallithea/model/db.py as
 
#  part of the database initialization in code that typically runs before
 
#  CONFIG (above) is populated with settings from the ini file, it's instead
 
#  hard-coded herein.
 

	
 
SETTINGS_PREFIX = "kallithea_"
 
# NOTE: If you want compatibility with a database that was originally created
 
#  for use with the Rhodecode software product, changing SETTINGS_PREFIX to
 
#  "rhodecode_" might work to make the old database and forms compatible with
 
#  this application.
 

	
 
try:
 
    from kallithea.lib import get_current_revision
 
    _rev = get_current_revision(quiet=True)
 
    if _rev and len(VERSION) > 3:
 
        VERSION += ('%s' % _rev[0],)
 
except ImportError:
kallithea/lib/dbmigrate/schema/db_1_2_0.py
Show inline comments
 
@@ -46,12 +46,13 @@ from kallithea.lib.utils2 import str2boo
 
from kallithea.lib.exceptions import UserGroupsAssignedException
 
from kallithea.lib.compat import json
 

	
 
from kallithea.model.meta import Base, Session
 
from kallithea.lib.caching_query import FromCache
 

	
 
from kallithea import SETTINGS_PREFIX
 

	
 
log = logging.getLogger(__name__)
 

	
 
#==============================================================================
 
# BASE CLASSES
 
#==============================================================================
 
@@ -139,13 +140,13 @@ class BaseModel(object):
 
        obj = cls.query().get(id_)
 
        Session.delete(obj)
 
        Session.commit()
 

	
 

	
 
class Setting(Base, BaseModel):
 
    __tablename__ = 'rhodecode_settings'
 
    __tablename__ = SETTINGS_PREFIX + 'settings'
 
    __table_args__ = (UniqueConstraint('app_settings_name'), {'extend_existing':True})
 
    app_settings_id = Column("app_settings_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
    app_settings_name = Column("app_settings_name", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    _app_settings_value = Column("app_settings_value", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 

	
 
    def __init__(self, k='', v=''):
 
@@ -210,13 +211,13 @@ class Setting(Base, BaseModel):
 
            fd.update({row.app_settings_name:row.app_settings_value})
 

	
 
        return fd
 

	
 

	
 
class Ui(Base, BaseModel):
 
    __tablename__ = 'rhodecode_ui'
 
    __tablename__ = SETTINGS_PREFIX + 'ui'
 
    __table_args__ = (UniqueConstraint('ui_key'), {'extend_existing':True})
 

	
 
    HOOK_UPDATE = 'changegroup.update'
 
    HOOK_REPO_SIZE = 'changegroup.repo_size'
 
    HOOK_PUSH = 'pretxnchangegroup.push_logger'
 
    HOOK_PULL = 'preoutgoing.pull_logger'
kallithea/lib/dbmigrate/schema/db_1_3_0.py
Show inline comments
 
@@ -48,12 +48,13 @@ from kallithea.lib.utils2 import str2boo
 
from kallithea.lib.compat import json
 
from kallithea.lib.caching_query import FromCache
 

	
 
from kallithea.model.meta import Base, Session
 
import hashlib
 

	
 
from kallithea import SETTINGS_PREFIX
 

	
 
log = logging.getLogger(__name__)
 

	
 
#==============================================================================
 
# BASE CLASSES
 
#==============================================================================
 
@@ -154,13 +155,13 @@ class BaseModel(object):
 
        if hasattr(self, '__unicode__'):
 
            # python repr needs to return str
 
            return safe_str(self.__unicode__())
 
        return '<DB:%s>' % (self.__class__.__name__)
 

	
 
class Setting(Base, BaseModel):
 
    __tablename__ = 'rhodecode_settings'
 
    __tablename__ = SETTINGS_PREFIX + 'settings'
 
    __table_args__ = (
 
        UniqueConstraint('app_settings_name'),
 
        {'extend_existing': True, 'mysql_engine':'InnoDB',
 
         'mysql_charset': 'utf8'}
 
    )
 
    app_settings_id = Column("app_settings_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
@@ -229,13 +230,13 @@ class Setting(Base, BaseModel):
 
            fd.update({row.app_settings_name:row.app_settings_value})
 

	
 
        return fd
 

	
 

	
 
class Ui(Base, BaseModel):
 
    __tablename__ = 'rhodecode_ui'
 
    __tablename__ = SETTINGS_PREFIX + 'ui'
 
    __table_args__ = (
 
        UniqueConstraint('ui_key'),
 
        {'extend_existing': True, 'mysql_engine':'InnoDB',
 
         'mysql_charset': 'utf8'}
 
    )
 

	
kallithea/lib/dbmigrate/schema/db_1_4_0.py
Show inline comments
 
@@ -52,12 +52,14 @@ from kallithea.lib.utils2 import str2boo
 
    safe_unicode, remove_suffix
 
from kallithea.lib.compat import json
 
from kallithea.lib.caching_query import FromCache
 

	
 
from kallithea.model.meta import Base, Session
 

	
 
from kallithea import SETTINGS_PREFIX
 

	
 
URL_SEP = '/'
 
log = logging.getLogger(__name__)
 

	
 
#==============================================================================
 
# BASE CLASSES
 
#==============================================================================
 
@@ -145,13 +147,13 @@ class BaseModel(object):
 
            # python repr needs to return str
 
            return safe_str(self.__unicode__())
 
        return '<DB:%s>' % (self.__class__.__name__)
 

	
 

	
 
class Setting(Base, BaseModel):
 
    __tablename__ = 'rhodecode_settings'
 
    __tablename__ = SETTINGS_PREFIX + 'settings'
 
    __table_args__ = (
 
        UniqueConstraint('app_settings_name'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8'}
 
    )
 
    app_settings_id = Column("app_settings_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
@@ -227,13 +229,13 @@ class Setting(Base, BaseModel):
 
            fd.update({row.app_settings_name: row.app_settings_value})
 

	
 
        return fd
 

	
 

	
 
class Ui(Base, BaseModel):
 
    __tablename__ = 'rhodecode_ui'
 
    __tablename__ = SETTINGS_PREFIX + 'ui'
 
    __table_args__ = (
 
        UniqueConstraint('ui_key'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8'}
 
    )
 

	
kallithea/lib/dbmigrate/schema/db_1_5_0.py
Show inline comments
 
@@ -51,12 +51,14 @@ from kallithea.lib.utils2 import str2boo
 
    safe_unicode, remove_suffix, remove_prefix
 
from kallithea.lib.compat import json
 
from kallithea.lib.caching_query import FromCache
 

	
 
from kallithea.model.meta import Base, Session
 

	
 
from kallithea import SETTINGS_PREFIX
 

	
 
URL_SEP = '/'
 
log = logging.getLogger(__name__)
 

	
 
#==============================================================================
 
# BASE CLASSES
 
#==============================================================================
 
@@ -144,13 +146,13 @@ class BaseModel(object):
 
            # python repr needs to return str
 
            return safe_str(self.__unicode__())
 
        return '<DB:%s>' % (self.__class__.__name__)
 

	
 

	
 
class Setting(Base, BaseModel):
 
    __tablename__ = 'rhodecode_settings'
 
    __tablename__ = SETTINGS_PREFIX + 'settings'
 
    __table_args__ = (
 
        UniqueConstraint('app_settings_name'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8'}
 
    )
 
    app_settings_id = Column("app_settings_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
@@ -243,13 +245,13 @@ class Setting(Base, BaseModel):
 
            fd.update({key: row.app_settings_value})
 

	
 
        return fd
 

	
 

	
 
class Ui(Base, BaseModel):
 
    __tablename__ = 'rhodecode_ui'
 
    __tablename__ = SETTINGS_PREFIX + 'ui'
 
    __table_args__ = (
 
        UniqueConstraint('ui_key'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8'}
 
    )
 

	
kallithea/lib/dbmigrate/schema/db_1_5_2.py
Show inline comments
 
@@ -55,12 +55,14 @@ from kallithea.lib.caching_query import 
 

	
 
from kallithea.model.meta import Base, Session
 

	
 
URL_SEP = '/'
 
log = logging.getLogger(__name__)
 

	
 
from kallithea import SETTINGS_PREFIX
 

	
 
#==============================================================================
 
# BASE CLASSES
 
#==============================================================================
 

	
 
_hash_key = lambda k: hashlib.md5(safe_str(k)).hexdigest()
 

	
 
@@ -145,13 +147,13 @@ class BaseModel(object):
 
            # python repr needs to return str
 
            return safe_str(self.__unicode__())
 
        return '<DB:%s>' % (self.__class__.__name__)
 

	
 

	
 
class Setting(Base, BaseModel):
 
    __tablename__ = 'rhodecode_settings'
 
    __tablename__ = SETTINGS_PREFIX + 'settings'
 
    __table_args__ = (
 
        UniqueConstraint('app_settings_name'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8'}
 
    )
 
    app_settings_id = Column("app_settings_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
@@ -244,13 +246,13 @@ class Setting(Base, BaseModel):
 
            fd.update({key: row.app_settings_value})
 

	
 
        return fd
 

	
 

	
 
class Ui(Base, BaseModel):
 
    __tablename__ = 'rhodecode_ui'
 
    __tablename__ = SETTINGS_PREFIX + 'ui'
 
    __table_args__ = (
 
        UniqueConstraint('ui_key'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8'}
 
    )
 

	
kallithea/lib/dbmigrate/schema/db_1_6_0.py
Show inline comments
 
@@ -55,12 +55,14 @@ from kallithea.lib.caching_query import 
 

	
 
from kallithea.model.meta import Base, Session
 

	
 
URL_SEP = '/'
 
log = logging.getLogger(__name__)
 

	
 
from kallithea import SETTINGS_PREFIX
 

	
 
#==============================================================================
 
# BASE CLASSES
 
#==============================================================================
 

	
 
_hash_key = lambda k: hashlib.md5(safe_str(k)).hexdigest()
 

	
 
@@ -145,13 +147,13 @@ class BaseModel(object):
 
            # python repr needs to return str
 
            return safe_str(self.__unicode__())
 
        return '<DB:%s>' % (self.__class__.__name__)
 

	
 

	
 
class Setting(Base, BaseModel):
 
    __tablename__ = 'rhodecode_settings'
 
    __tablename__ = SETTINGS_PREFIX + 'settings'
 
    __table_args__ = (
 
        UniqueConstraint('app_settings_name'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8'}
 
    )
 
    app_settings_id = Column("app_settings_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
@@ -244,13 +246,13 @@ class Setting(Base, BaseModel):
 
            fd.update({key: row.app_settings_value})
 

	
 
        return fd
 

	
 

	
 
class Ui(Base, BaseModel):
 
    __tablename__ = 'rhodecode_ui'
 
    __tablename__ = SETTINGS_PREFIX + 'ui'
 
    __table_args__ = (
 
        UniqueConstraint('ui_key'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8'}
 
    )
 

	
kallithea/lib/dbmigrate/schema/db_1_7_0.py
Show inline comments
 
@@ -55,12 +55,14 @@ from kallithea.lib.caching_query import 
 

	
 
from kallithea.model.meta import Base, Session
 

	
 
URL_SEP = '/'
 
log = logging.getLogger(__name__)
 

	
 
from kallithea import SETTINGS_PREFIX
 

	
 
#==============================================================================
 
# BASE CLASSES
 
#==============================================================================
 

	
 
_hash_key = lambda k: hashlib.md5(safe_str(k)).hexdigest()
 

	
 
@@ -150,13 +152,13 @@ class BaseModel(object):
 
            # python repr needs to return str
 
            return safe_str(self.__unicode__())
 
        return '<DB:%s>' % (self.__class__.__name__)
 

	
 

	
 
class Setting(Base, BaseModel):
 
    __tablename__ = 'rhodecode_settings'
 
    __tablename__ = SETTINGS_PREFIX + 'settings'
 
    __table_args__ = (
 
        UniqueConstraint('app_settings_name'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8'}
 
    )
 
    app_settings_id = Column("app_settings_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
@@ -249,13 +251,13 @@ class Setting(Base, BaseModel):
 
            fd.update({key: row.app_settings_value})
 

	
 
        return fd
 

	
 

	
 
class Ui(Base, BaseModel):
 
    __tablename__ = 'rhodecode_ui'
 
    __tablename__ = SETTINGS_PREFIX + 'ui'
 
    __table_args__ = (
 
        UniqueConstraint('ui_key'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8'}
 
    )
 

	
kallithea/lib/dbmigrate/schema/db_1_8_0.py
Show inline comments
 
@@ -55,12 +55,14 @@ from kallithea.lib.caching_query import 
 

	
 
from kallithea.model.meta import Base, Session
 

	
 
URL_SEP = '/'
 
log = logging.getLogger(__name__)
 

	
 
from kallithea import SETTINGS_PREFIX
 

	
 
#==============================================================================
 
# BASE CLASSES
 
#==============================================================================
 

	
 
_hash_key = lambda k: hashlib.md5(safe_str(k)).hexdigest()
 

	
 
@@ -150,13 +152,13 @@ class BaseModel(object):
 
            # python repr needs to return str
 
            return safe_str(self.__unicode__())
 
        return '<DB:%s>' % (self.__class__.__name__)
 

	
 

	
 
class Setting(Base, BaseModel):
 
    __tablename__ = 'rhodecode_settings'
 
    __tablename__ = SETTINGS_PREFIX +  'settings'
 
    __table_args__ = (
 
        UniqueConstraint('app_settings_name'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
 
    )
 
    app_settings_id = Column("app_settings_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
@@ -267,13 +269,13 @@ class Setting(Base, BaseModel):
 
            'kallithea_version': kallithea.__version__
 
        }
 
        return info
 

	
 

	
 
class Ui(Base, BaseModel):
 
    __tablename__ = 'rhodecode_ui'
 
    __tablename__ = SETTINGS_PREFIX + 'ui'
 
    __table_args__ = (
 
        UniqueConstraint('ui_key'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
 
    )
 

	
kallithea/lib/dbmigrate/schema/db_2_0_0.py
Show inline comments
 
@@ -56,12 +56,14 @@ from kallithea.lib.caching_query import 
 

	
 
from kallithea.model.meta import Base, Session
 

	
 
URL_SEP = '/'
 
log = logging.getLogger(__name__)
 

	
 
from kallithea import SETTINGS_PREFIX
 

	
 
#==============================================================================
 
# BASE CLASSES
 
#==============================================================================
 

	
 
_hash_key = lambda k: hashlib.md5(safe_str(k)).hexdigest()
 

	
 
@@ -158,13 +160,13 @@ class Setting(Base, BaseModel):
 
        'str': safe_str,
 
        'int': safe_int,
 
        'unicode': safe_unicode,
 
        'bool': str2bool,
 
        'list': functools.partial(aslist, sep=',')
 
    }
 
    __tablename__ = 'rhodecode_settings'
 
    __tablename__ = SETTINGS_PREFIX + 'settings'
 
    __table_args__ = (
 
        UniqueConstraint('app_settings_name'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
 
    )
 
    app_settings_id = Column("app_settings_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
@@ -314,13 +316,13 @@ class Setting(Base, BaseModel):
 
            'git_path': kallithea.CONFIG.get('git_path')
 
        }
 
        return info
 

	
 

	
 
class Ui(Base, BaseModel):
 
    __tablename__ = 'rhodecode_ui'
 
    __tablename__ = SETTINGS_PREFIX + 'ui'
 
    __table_args__ = (
 
        UniqueConstraint('ui_key'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
 
    )
 

	
kallithea/lib/dbmigrate/schema/db_2_0_1.py
Show inline comments
 
@@ -53,12 +53,14 @@ from kallithea.lib.utils2 import str2boo
 
    safe_unicode, remove_prefix, time_to_datetime, aslist, Optional, safe_int
 
from kallithea.lib.compat import json
 
from kallithea.lib.caching_query import FromCache
 

	
 
from kallithea.model.meta import Base, Session
 

	
 
from kallithea import SETTINGS_PREFIX
 

	
 
URL_SEP = '/'
 
log = logging.getLogger(__name__)
 

	
 
#==============================================================================
 
# BASE CLASSES
 
#==============================================================================
 
@@ -161,13 +163,13 @@ class Setting(Base, BaseModel):
 
        'str': safe_str,
 
        'int': safe_int,
 
        'unicode': safe_unicode,
 
        'bool': str2bool,
 
        'list': functools.partial(aslist, sep=',')
 
    }
 
    __tablename__ = 'rhodecode_settings'
 
    __tablename__ = SETTINGS_PREFIX + 'settings'
 
    __table_args__ = (
 
        UniqueConstraint('app_settings_name'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
 
    )
 
    app_settings_id = Column("app_settings_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
@@ -317,13 +319,13 @@ class Setting(Base, BaseModel):
 
            'git_path': kallithea.CONFIG.get('git_path')
 
        }
 
        return info
 

	
 

	
 
class Ui(Base, BaseModel):
 
    __tablename__ = 'rhodecode_ui'
 
    __tablename__ = SETTINGS_PREFIX + 'ui'
 
    __table_args__ = (
 
        UniqueConstraint('ui_key'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
 
    )
 

	
kallithea/lib/dbmigrate/schema/db_2_0_2.py
Show inline comments
 
@@ -56,12 +56,14 @@ from kallithea.lib.caching_query import 
 

	
 
from kallithea.model.meta import Base, Session
 

	
 
URL_SEP = '/'
 
log = logging.getLogger(__name__)
 

	
 
from kallithea import SETTINGS_PREFIX
 

	
 
#==============================================================================
 
# BASE CLASSES
 
#==============================================================================
 

	
 
_hash_key = lambda k: hashlib.md5(safe_str(k)).hexdigest()
 

	
 
@@ -161,13 +163,13 @@ class Setting(Base, BaseModel):
 
        'str': safe_str,
 
        'int': safe_int,
 
        'unicode': safe_unicode,
 
        'bool': str2bool,
 
        'list': functools.partial(aslist, sep=',')
 
    }
 
    __tablename__ = 'rhodecode_settings'
 
    __tablename__ = SETTINGS_PREFIX + 'settings'
 
    __table_args__ = (
 
        UniqueConstraint('app_settings_name'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
 
    )
 
    app_settings_id = Column("app_settings_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
@@ -317,13 +319,13 @@ class Setting(Base, BaseModel):
 
            'git_path': kallithea.CONFIG.get('git_path')
 
        }
 
        return info
 

	
 

	
 
class Ui(Base, BaseModel):
 
    __tablename__ = 'rhodecode_ui'
 
    __tablename__ = SETTINGS_PREFIX + 'ui'
 
    __table_args__ = (
 
        UniqueConstraint('ui_key'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
 
    )
 

	
kallithea/lib/dbmigrate/schema/db_2_1_0.py
Show inline comments
 
@@ -56,12 +56,14 @@ from kallithea.lib.caching_query import 
 

	
 
from kallithea.model.meta import Base, Session
 

	
 
URL_SEP = '/'
 
log = logging.getLogger(__name__)
 

	
 
from kallithea import SETTINGS_PREFIX
 

	
 
#==============================================================================
 
# BASE CLASSES
 
#==============================================================================
 

	
 
_hash_key = lambda k: hashlib.md5(safe_str(k)).hexdigest()
 

	
 
@@ -154,13 +156,13 @@ class BaseModel(object):
 
            except UnicodeDecodeError:
 
                pass
 
        return '<DB:%s>' % (self.__class__.__name__)
 

	
 

	
 
class Setting(Base, BaseModel):
 
    __tablename__ = 'rhodecode_settings'
 
    __tablename__ = SETTINGS_PREFIX + 'settings'
 
    __table_args__ = (
 
        UniqueConstraint('app_settings_name'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
 
    )
 

	
 
@@ -320,13 +322,13 @@ class Setting(Base, BaseModel):
 
            'git_path': kallithea.CONFIG.get('git_path')
 
        }
 
        return info
 

	
 

	
 
class Ui(Base, BaseModel):
 
    __tablename__ = 'rhodecode_ui'
 
    __tablename__ = SETTINGS_PREFIX + 'ui'
 
    __table_args__ = (
 
        UniqueConstraint('ui_key'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
 
    )
 

	
kallithea/lib/dbmigrate/schema/db_2_2_0.py
Show inline comments
 
@@ -57,12 +57,14 @@ from kallithea.lib.caching_query import 
 

	
 
from kallithea.model.meta import Base, Session
 

	
 
URL_SEP = '/'
 
log = logging.getLogger(__name__)
 

	
 
from kallithea import SETTINGS_PREFIX
 

	
 
#==============================================================================
 
# BASE CLASSES
 
#==============================================================================
 

	
 
_hash_key = lambda k: hashlib.md5(safe_str(k)).hexdigest()
 

	
 
@@ -155,13 +157,13 @@ class BaseModel(object):
 
            except UnicodeDecodeError:
 
                pass
 
        return '<DB:%s>' % (self.__class__.__name__)
 

	
 

	
 
class Setting(Base, BaseModel):
 
    __tablename__ = 'rhodecode_settings'
 
    __tablename__ = SETTINGS_PREFIX + 'settings'
 
    __table_args__ = (
 
        UniqueConstraint('app_settings_name'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
 
    )
 

	
 
@@ -321,13 +323,13 @@ class Setting(Base, BaseModel):
 
            'git_path': kallithea.CONFIG.get('git_path')
 
        }
 
        return info
 

	
 

	
 
class Ui(Base, BaseModel):
 
    __tablename__ = 'rhodecode_ui'
 
    __tablename__ = SETTINGS_PREFIX + 'ui'
 
    __table_args__ = (
 
        UniqueConstraint('ui_key'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
 
    )
 

	
kallithea/lib/dbmigrate/schema/db_2_2_3.py
Show inline comments
 
@@ -57,12 +57,14 @@ from kallithea.lib.caching_query import 
 

	
 
from kallithea.model.meta import Base, Session
 

	
 
URL_SEP = '/'
 
log = logging.getLogger(__name__)
 

	
 
from kallithea import SETTINGS_PREFIX
 

	
 
#==============================================================================
 
# BASE CLASSES
 
#==============================================================================
 

	
 
_hash_key = lambda k: hashlib.md5(safe_str(k)).hexdigest()
 

	
 
@@ -155,13 +157,13 @@ class BaseModel(object):
 
            except UnicodeDecodeError:
 
                pass
 
        return '<DB:%s>' % (self.__class__.__name__)
 

	
 

	
 
class Setting(Base, BaseModel):
 
    __tablename__ = 'rhodecode_settings'
 
    __tablename__ = SETTINGS_PREFIX + 'settings'
 
    __table_args__ = (
 
        UniqueConstraint('app_settings_name'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
 
    )
 

	
 
@@ -321,13 +323,13 @@ class Setting(Base, BaseModel):
 
            'git_path': kallithea.CONFIG.get('git_path')
 
        }
 
        return info
 

	
 

	
 
class Ui(Base, BaseModel):
 
    __tablename__ = 'rhodecode_ui'
 
    __tablename__ = SETTINGS_PREFIX + 'ui'
 
    __table_args__ = (
 
        UniqueConstraint('ui_key'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
 
    )
 

	
kallithea/lib/dbmigrate/versions/001_initial_release.py
Show inline comments
 
@@ -9,16 +9,18 @@ from sqlalchemy.exc import DatabaseError
 
from sqlalchemy.orm import relation, backref, class_mapper
 
from sqlalchemy.orm.session import Session
 
from kallithea.model.meta import Base
 

	
 
from kallithea.lib.dbmigrate.migrate import *
 

	
 
from kallithea import SETTINGS_PREFIX
 

	
 
log = logging.getLogger(__name__)
 

	
 
class Setting(Base):
 
    __tablename__ = 'rhodecode_settings'
 
    __tablename__ = SETTINGS_PREFIX + 'settings'
 
    __table_args__ = (UniqueConstraint('app_settings_name'), {'useexisting':True})
 
    app_settings_id = Column("app_settings_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
    app_settings_name = Column("app_settings_name", String(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    app_settings_value = Column("app_settings_value", String(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 

	
 
    def __init__(self, k, v):
 
@@ -27,13 +29,13 @@ class Setting(Base):
 

	
 
    def __repr__(self):
 
        return "<Setting('%s:%s')>" % (self.app_settings_name,
 
                                                self.app_settings_value)
 

	
 
class Ui(Base):
 
    __tablename__ = 'rhodecode_ui'
 
    __tablename__ = SETTINGS_PREFIX + 'ui'
 
    __table_args__ = {'useexisting':True}
 
    ui_id = Column("ui_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
 
    ui_section = Column("ui_section", String(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    ui_key = Column("ui_key", String(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    ui_value = Column("ui_value", String(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    ui_active = Column("ui_active", Boolean(), nullable=True, unique=None, default=True)
kallithea/model/db.py
Show inline comments
 
@@ -54,12 +54,14 @@ from kallithea.lib.utils2 import str2boo
 
    get_clone_url
 
from kallithea.lib.compat import json
 
from kallithea.lib.caching_query import FromCache
 

	
 
from kallithea.model.meta import Base, Session
 

	
 
from kallithea import SETTINGS_PREFIX
 

	
 
URL_SEP = '/'
 
log = logging.getLogger(__name__)
 

	
 
#==============================================================================
 
# BASE CLASSES
 
#==============================================================================
 
@@ -155,13 +157,14 @@ class BaseModel(object):
 
            except UnicodeDecodeError:
 
                pass
 
        return '<DB:%s>' % (self.__class__.__name__)
 

	
 

	
 
class Setting(Base, BaseModel):
 
    __tablename__ = 'rhodecode_settings'
 
    __tablename__ = SETTINGS_PREFIX + 'settings'
 

	
 
    __table_args__ = (
 
        UniqueConstraint('app_settings_name'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
 
    )
 

	
 
@@ -321,13 +324,13 @@ class Setting(Base, BaseModel):
 
            'git_path': kallithea.CONFIG.get('git_path')
 
        }
 
        return info
 

	
 

	
 
class Ui(Base, BaseModel):
 
    __tablename__ = 'rhodecode_ui'
 
    __tablename__ = SETTINGS_PREFIX + 'ui'
 
    __table_args__ = (
 
        UniqueConstraint('ui_key'),
 
        {'extend_existing': True, 'mysql_engine': 'InnoDB',
 
         'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
 
    )
 

	
0 comments (0 inline, 0 general)