##// END OF EJS Templates
database: dropped CheckConstraint for auto-increment field for mysql/mariadb compatability....
marcink -
r3486:118155b6 default
parent child Browse files
Show More
@@ -680,7 +680,7 b' class Repository(Base, BaseModel):'
680 680 class Group(Base, BaseModel):
681 681 __tablename__ = 'groups'
682 682 __table_args__ = (UniqueConstraint('group_name', 'group_parent_id'),
683 CheckConstraint('group_id != group_parent_id'), {'extend_existing':True},)
683 {'extend_existing':True},)
684 684 __mapper_args__ = {'order_by':'group_name'}
685 685
686 686 group_id = Column("group_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
@@ -699,7 +699,6 b' class RepoGroup(Base, BaseModel):'
699 699 __tablename__ = 'groups'
700 700 __table_args__ = (
701 701 UniqueConstraint('group_name', 'group_parent_id'),
702 CheckConstraint('group_id != group_parent_id'),
703 702 {'extend_existing': True, 'mysql_engine':'InnoDB',
704 703 'mysql_charset': 'utf8'},
705 704 )
@@ -513,7 +513,6 b' class RepoGroup(Base, BaseModel):'
513 513 __tablename__ = 'groups'
514 514 __table_args__ = (
515 515 UniqueConstraint('group_name', 'group_parent_id'),
516 CheckConstraint('group_id != group_parent_id'),
517 516 {'extend_existing': True, 'mysql_engine': 'InnoDB',
518 517 'mysql_charset': 'utf8'},
519 518 )
@@ -526,7 +526,6 b' class RepoGroup(Base, BaseModel):'
526 526 __tablename__ = 'groups'
527 527 __table_args__ = (
528 528 UniqueConstraint('group_name', 'group_parent_id'),
529 CheckConstraint('group_id != group_parent_id'),
530 529 {'extend_existing': True, 'mysql_engine': 'InnoDB',
531 530 'mysql_charset': 'utf8'},
532 531 )
@@ -543,7 +543,6 b' class RepoGroup(Base, BaseModel):'
543 543 __tablename__ = 'groups'
544 544 __table_args__ = (
545 545 UniqueConstraint('group_name', 'group_parent_id'),
546 CheckConstraint('group_id != group_parent_id'),
547 546 {'extend_existing': True, 'mysql_engine': 'InnoDB',
548 547 'mysql_charset': 'utf8'},
549 548 )
@@ -626,7 +626,6 b' class RepoGroup(Base, BaseModel):'
626 626 __tablename__ = 'groups'
627 627 __table_args__ = (
628 628 UniqueConstraint('group_name', 'group_parent_id'),
629 CheckConstraint('group_id != group_parent_id'),
630 629 {'extend_existing': True, 'mysql_engine': 'InnoDB',
631 630 'mysql_charset': 'utf8'},
632 631 )
@@ -597,7 +597,6 b' class RepoGroup(Base, BaseModel):'
597 597 __tablename__ = 'groups'
598 598 __table_args__ = (
599 599 UniqueConstraint('group_name', 'group_parent_id'),
600 CheckConstraint('group_id != group_parent_id'),
601 600 {'extend_existing': True, 'mysql_engine': 'InnoDB',
602 601 'mysql_charset': 'utf8'},
603 602 )
@@ -599,7 +599,6 b' class RepoGroup(Base, BaseModel):'
599 599 __tablename__ = 'groups'
600 600 __table_args__ = (
601 601 UniqueConstraint('group_name', 'group_parent_id'),
602 CheckConstraint('group_id != group_parent_id'),
603 602 {'extend_existing': True, 'mysql_engine': 'InnoDB',
604 603 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
605 604 )
@@ -622,7 +622,6 b' class RepoGroup(Base, BaseModel):'
622 622 __tablename__ = 'groups'
623 623 __table_args__ = (
624 624 UniqueConstraint('group_name', 'group_parent_id'),
625 CheckConstraint('group_id != group_parent_id'),
626 625 {'extend_existing': True, 'mysql_engine': 'InnoDB',
627 626 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
628 627 )
@@ -621,7 +621,6 b' class RepoGroup(Base, BaseModel):'
621 621 __tablename__ = 'groups'
622 622 __table_args__ = (
623 623 UniqueConstraint('group_name', 'group_parent_id'),
624 CheckConstraint('group_id != group_parent_id'),
625 624 {'extend_existing': True, 'mysql_engine': 'InnoDB',
626 625 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
627 626 )
@@ -639,7 +639,6 b' class RepoGroup(Base, BaseModel):'
639 639 __tablename__ = 'groups'
640 640 __table_args__ = (
641 641 UniqueConstraint('group_name', 'group_parent_id'),
642 CheckConstraint('group_id != group_parent_id'),
643 642 {'extend_existing': True, 'mysql_engine': 'InnoDB',
644 643 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
645 644 )
@@ -656,7 +656,6 b' class RepoGroup(Base, BaseModel):'
656 656 __tablename__ = 'groups'
657 657 __table_args__ = (
658 658 UniqueConstraint('group_name', 'group_parent_id'),
659 CheckConstraint('group_id != group_parent_id'),
660 659 {'extend_existing': True, 'mysql_engine': 'InnoDB',
661 660 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
662 661 )
@@ -672,7 +672,6 b' class RepoGroup(Base, BaseModel):'
672 672 __tablename__ = 'groups'
673 673 __table_args__ = (
674 674 UniqueConstraint('group_name', 'group_parent_id'),
675 CheckConstraint('group_id != group_parent_id'),
676 675 {'extend_existing': True, 'mysql_engine': 'InnoDB',
677 676 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
678 677 )
@@ -675,7 +675,6 b' class RepoGroup(Base, BaseModel):'
675 675 __tablename__ = 'groups'
676 676 __table_args__ = (
677 677 UniqueConstraint('group_name', 'group_parent_id'),
678 CheckConstraint('group_id != group_parent_id'),
679 678 {'extend_existing': True, 'mysql_engine': 'InnoDB',
680 679 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
681 680 )
@@ -679,7 +679,6 b' class RepoGroup(Base, BaseModel):'
679 679 __tablename__ = 'groups'
680 680 __table_args__ = (
681 681 UniqueConstraint('group_name', 'group_parent_id'),
682 CheckConstraint('group_id != group_parent_id'),
683 682 {'extend_existing': True, 'mysql_engine': 'InnoDB',
684 683 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
685 684 )
@@ -679,7 +679,6 b' class RepoGroup(Base, BaseModel):'
679 679 __tablename__ = 'groups'
680 680 __table_args__ = (
681 681 UniqueConstraint('group_name', 'group_parent_id'),
682 CheckConstraint('group_id != group_parent_id'),
683 682 {'extend_existing': True, 'mysql_engine': 'InnoDB',
684 683 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
685 684 )
@@ -707,7 +707,6 b' class RepoGroup(Base, BaseModel):'
707 707 __tablename__ = 'groups'
708 708 __table_args__ = (
709 709 UniqueConstraint('group_name', 'group_parent_id'),
710 CheckConstraint('group_id != group_parent_id'),
711 710 {'extend_existing': True, 'mysql_engine': 'InnoDB',
712 711 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
713 712 )
@@ -717,7 +717,6 b' class RepoGroup(Base, BaseModel):'
717 717 __tablename__ = 'groups'
718 718 __table_args__ = (
719 719 UniqueConstraint('group_name', 'group_parent_id'),
720 CheckConstraint('group_id != group_parent_id'),
721 720 {'extend_existing': True, 'mysql_engine': 'InnoDB',
722 721 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
723 722 )
@@ -760,7 +760,6 b' class RepoGroup(Base, BaseModel):'
760 760 __tablename__ = 'groups'
761 761 __table_args__ = (
762 762 UniqueConstraint('group_name', 'group_parent_id'),
763 CheckConstraint('group_id != group_parent_id'),
764 763 {'extend_existing': True, 'mysql_engine': 'InnoDB',
765 764 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
766 765 )
@@ -758,7 +758,6 b' class RepoGroup(Base, BaseModel):'
758 758 __tablename__ = 'groups'
759 759 __table_args__ = (
760 760 UniqueConstraint('group_name', 'group_parent_id'),
761 CheckConstraint('group_id != group_parent_id'),
762 761 {'extend_existing': True, 'mysql_engine': 'InnoDB',
763 762 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
764 763 )
@@ -759,7 +759,6 b' class RepoGroup(Base, BaseModel):'
759 759 __tablename__ = 'groups'
760 760 __table_args__ = (
761 761 UniqueConstraint('group_name', 'group_parent_id'),
762 CheckConstraint('group_id != group_parent_id'),
763 762 {'extend_existing': True, 'mysql_engine': 'InnoDB',
764 763 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
765 764 )
@@ -759,7 +759,6 b' class RepoGroup(Base, BaseModel):'
759 759 __tablename__ = 'groups'
760 760 __table_args__ = (
761 761 UniqueConstraint('group_name', 'group_parent_id'),
762 CheckConstraint('group_id != group_parent_id'),
763 762 {'extend_existing': True, 'mysql_engine': 'InnoDB',
764 763 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
765 764 )
@@ -765,7 +765,6 b' class RepoGroup(Base, BaseModel):'
765 765 __tablename__ = 'groups'
766 766 __table_args__ = (
767 767 UniqueConstraint('group_name', 'group_parent_id'),
768 CheckConstraint('group_id != group_parent_id'),
769 768 {'extend_existing': True, 'mysql_engine': 'InnoDB',
770 769 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
771 770 )
@@ -887,7 +887,6 b' class RepoGroup(Base, BaseModel):'
887 887 __tablename__ = 'groups'
888 888 __table_args__ = (
889 889 UniqueConstraint('group_name', 'group_parent_id'),
890 CheckConstraint('group_id != group_parent_id'),
891 890 {'extend_existing': True, 'mysql_engine': 'InnoDB',
892 891 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
893 892 )
@@ -912,7 +912,6 b' class RepoGroup(Base, BaseModel):'
912 912 __tablename__ = 'groups'
913 913 __table_args__ = (
914 914 UniqueConstraint('group_name', 'group_parent_id'),
915 CheckConstraint('group_id != group_parent_id'),
916 915 {'extend_existing': True, 'mysql_engine': 'InnoDB',
917 916 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
918 917 )
@@ -2295,7 +2295,6 b' class RepoGroup(Base, BaseModel):'
2295 2295 __tablename__ = 'groups'
2296 2296 __table_args__ = (
2297 2297 UniqueConstraint('group_name', 'group_parent_id'),
2298 CheckConstraint('group_id != group_parent_id'),
2299 2298 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2300 2299 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
2301 2300 )
@@ -2361,7 +2361,6 b' class RepoGroup(Base, BaseModel):'
2361 2361 __tablename__ = 'groups'
2362 2362 __table_args__ = (
2363 2363 UniqueConstraint('group_name', 'group_parent_id'),
2364 CheckConstraint('group_id != group_parent_id'),
2365 2364 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2366 2365 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
2367 2366 )
@@ -2436,7 +2436,6 b' class RepoGroup(Base, BaseModel):'
2436 2436 __tablename__ = 'groups'
2437 2437 __table_args__ = (
2438 2438 UniqueConstraint('group_name', 'group_parent_id'),
2439 CheckConstraint('group_id != group_parent_id'),
2440 2439 base_table_args,
2441 2440 )
2442 2441 __mapper_args__ = {'order_by': 'group_name'}
@@ -2459,7 +2459,6 b' class RepoGroup(Base, BaseModel):'
2459 2459 __tablename__ = 'groups'
2460 2460 __table_args__ = (
2461 2461 UniqueConstraint('group_name', 'group_parent_id'),
2462 CheckConstraint('group_id != group_parent_id'),
2463 2462 base_table_args,
2464 2463 )
2465 2464 __mapper_args__ = {'order_by': 'group_name'}
@@ -2459,7 +2459,6 b' class RepoGroup(Base, BaseModel):'
2459 2459 __tablename__ = 'groups'
2460 2460 __table_args__ = (
2461 2461 UniqueConstraint('group_name', 'group_parent_id'),
2462 CheckConstraint('group_id != group_parent_id'),
2463 2462 base_table_args,
2464 2463 )
2465 2464 __mapper_args__ = {'order_by': 'group_name'}
@@ -2007,7 +2007,6 b' class RepoGroup(Base, BaseModel):'
2007 2007 __tablename__ = 'groups'
2008 2008 __table_args__ = (
2009 2009 UniqueConstraint('group_name', 'group_parent_id'),
2010 CheckConstraint('group_id != group_parent_id'),
2011 2010 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2012 2011 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
2013 2012 )
@@ -1999,7 +1999,6 b' class RepoGroup(Base, BaseModel):'
1999 1999 __tablename__ = 'groups'
2000 2000 __table_args__ = (
2001 2001 UniqueConstraint('group_name', 'group_parent_id'),
2002 CheckConstraint('group_id != group_parent_id'),
2003 2002 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2004 2003 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
2005 2004 )
@@ -1998,7 +1998,6 b' class RepoGroup(Base, BaseModel):'
1998 1998 __tablename__ = 'groups'
1999 1999 __table_args__ = (
2000 2000 UniqueConstraint('group_name', 'group_parent_id'),
2001 CheckConstraint('group_id != group_parent_id'),
2002 2001 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2003 2002 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
2004 2003 )
@@ -2000,7 +2000,6 b' class RepoGroup(Base, BaseModel):'
2000 2000 __tablename__ = 'groups'
2001 2001 __table_args__ = (
2002 2002 UniqueConstraint('group_name', 'group_parent_id'),
2003 CheckConstraint('group_id != group_parent_id'),
2004 2003 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2005 2004 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
2006 2005 )
@@ -2000,7 +2000,6 b' class RepoGroup(Base, BaseModel):'
2000 2000 __tablename__ = 'groups'
2001 2001 __table_args__ = (
2002 2002 UniqueConstraint('group_name', 'group_parent_id'),
2003 CheckConstraint('group_id != group_parent_id'),
2004 2003 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2005 2004 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
2006 2005 )
@@ -2043,7 +2043,6 b' class RepoGroup(Base, BaseModel):'
2043 2043 __tablename__ = 'groups'
2044 2044 __table_args__ = (
2045 2045 UniqueConstraint('group_name', 'group_parent_id'),
2046 CheckConstraint('group_id != group_parent_id'),
2047 2046 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2048 2047 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
2049 2048 )
@@ -2044,7 +2044,6 b' class RepoGroup(Base, BaseModel):'
2044 2044 __tablename__ = 'groups'
2045 2045 __table_args__ = (
2046 2046 UniqueConstraint('group_name', 'group_parent_id'),
2047 CheckConstraint('group_id != group_parent_id'),
2048 2047 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2049 2048 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
2050 2049 )
@@ -2231,7 +2231,6 b' class RepoGroup(Base, BaseModel):'
2231 2231 __tablename__ = 'groups'
2232 2232 __table_args__ = (
2233 2233 UniqueConstraint('group_name', 'group_parent_id'),
2234 CheckConstraint('group_id != group_parent_id'),
2235 2234 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2236 2235 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
2237 2236 )
@@ -2460,7 +2460,6 b' class RepoGroup(Base, BaseModel):'
2460 2460 __tablename__ = 'groups'
2461 2461 __table_args__ = (
2462 2462 UniqueConstraint('group_name', 'group_parent_id'),
2463 CheckConstraint('group_id != group_parent_id'),
2464 2463 base_table_args,
2465 2464 )
2466 2465 __mapper_args__ = {'order_by': 'group_name'}
@@ -2481,8 +2480,7 b' class RepoGroup(Base, BaseModel):'
2481 2480 users_group_to_perm = relationship('UserGroupRepoGroupToPerm', cascade='all')
2482 2481 parent_group = relationship('RepoGroup', remote_side=group_id)
2483 2482 user = relationship('User')
2484 integrations = relationship('Integration',
2485 cascade="all, delete, delete-orphan")
2483 integrations = relationship('Integration', cascade="all, delete, delete-orphan")
2486 2484
2487 2485 def __init__(self, group_name='', parent_group=None):
2488 2486 self.group_name = group_name
@@ -2492,6 +2490,16 b' class RepoGroup(Base, BaseModel):'
2492 2490 return u"<%s('id:%s:%s')>" % (
2493 2491 self.__class__.__name__, self.group_id, self.group_name)
2494 2492
2493 @validates('group_parent_id')
2494 def validate_group_parent_id(self, key, val):
2495 """
2496 Check cycle references for a parent group to self
2497 """
2498 if self.group_id and val:
2499 assert val != self.group_id
2500
2501 return val
2502
2495 2503 @hybrid_property
2496 2504 def description_safe(self):
2497 2505 from rhodecode.lib import helpers as h
General Comments 0
You need to be logged in to leave comments. Login now