changeset 6012:4f4a73acd6b3

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.)
author Søren Løvborg <sorenl@unity3d.com>
date Fri, 15 Jul 2016 16:02:13 +0200
parents 92b4b392b0df
children 0b6d2ca7175f
files kallithea/model/db.py
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/model/db.py	Fri Jul 15 15:16:07 2016 +0200
+++ b/kallithea/model/db.py	Fri Jul 15 16:02:13 2016 +0200
@@ -1484,7 +1484,6 @@
 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 @@
     SEP = ' &raquo; '
 
     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)