# HG changeset patch # User Søren Løvborg # Date 2016-07-15 16:02:13 # Node ID 4f4a73acd6b3a983ffc9affb2b141143002f58f0 # Parent 92b4b392b0dfa2fa98250aaad24f72537c844127 db: remove redundant unique constraint for repository groups There's already a unique constraint on 'group_name' alone, no need for one on the combination of 'group_name' and 'group_parent_id'. (The extra constraint likely stems from confusion over what exactly goes into group_name; add comment to clarify that it is the full group path.) diff --git a/kallithea/model/db.py b/kallithea/model/db.py --- a/kallithea/model/db.py +++ b/kallithea/model/db.py @@ -1484,7 +1484,6 @@ class Repository(Base, BaseModel): class RepoGroup(Base, BaseModel): __tablename__ = 'groups' __table_args__ = ( - UniqueConstraint('group_name', 'group_parent_id'), CheckConstraint('group_id != group_parent_id'), _table_args_default_dict, ) @@ -1493,7 +1492,7 @@ class RepoGroup(Base, BaseModel): SEP = ' » ' group_id = Column(Integer(), primary_key=True) - group_name = Column(Unicode(255), nullable=False, unique=True) + group_name = Column(Unicode(255), nullable=False, unique=True) # full path group_parent_id = Column(Integer(), ForeignKey('groups.group_id'), nullable=True) group_description = Column(Unicode(10000), nullable=False) enable_locking = Column(Boolean(), nullable=False, default=False)