Mercurial > kallithea
changeset 5634:b9f4b444a172
db: fix uniqueness constraint on the Ui table; it is on the composite key of section and key
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Tue, 05 Jan 2016 16:30:12 +0100 |
parents | 83f7b5449860 |
children | 8839e50145df |
files | kallithea/model/db.py |
diffstat | 1 files changed, 3 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/model/db.py Tue Jan 05 16:30:12 2016 +0100 +++ b/kallithea/model/db.py Tue Jan 05 16:30:12 2016 +0100 @@ -331,7 +331,10 @@ class Ui(Base, BaseModel): __tablename__ = DB_PREFIX + 'ui' __table_args__ = ( + # FIXME: ui_key as key is wrong and should be removed when the corresponding + # Ui.get_by_key has been replaced by the composite key UniqueConstraint('ui_key'), + UniqueConstraint('ui_section', 'ui_key'), _table_args_default_dict, ) @@ -348,11 +351,6 @@ ui_value = Column(String(255), nullable=True, unique=None, default=None) ui_active = Column(Boolean(), nullable=True, unique=None, default=True) - # def __init__(self, section='', key='', value=''): - # self.ui_section = section - # self.ui_key = key - # self.ui_value = value - @classmethod def get_by_key(cls, key): return cls.query().filter(cls.ui_key == key).scalar()