Mercurial > kallithea
annotate rhodecode/model/db.py @ 1232:0dc8d578ff49
merges for stable
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 09 Apr 2011 18:38:18 +0200 |
parents | a3b2b4b4e440 |
children | 603b6bcd180b |
rev | line source |
---|---|
759
a7f50911a945
Models code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
1 # -*- coding: utf-8 -*- |
a7f50911a945
Models code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
2 """ |
832
634596f81cfd
new improved models with helper functions for easier data fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
810
diff
changeset
|
3 rhodecode.model.db |
634596f81cfd
new improved models with helper functions for easier data fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
810
diff
changeset
|
4 ~~~~~~~~~~~~~~~~~~ |
759
a7f50911a945
Models code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
5 |
834
8924ed0e4f36
added current db version into rhodecode,
Marcin Kuzminski <marcin@python-works.com>
parents:
832
diff
changeset
|
6 Database Models for RhodeCode |
8924ed0e4f36
added current db version into rhodecode,
Marcin Kuzminski <marcin@python-works.com>
parents:
832
diff
changeset
|
7 |
759
a7f50911a945
Models code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
8 :created_on: Apr 08, 2010 |
a7f50911a945
Models code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
9 :author: marcink |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
10 :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
759
a7f50911a945
Models code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
11 :license: GPLv3, see COPYING for more details. |
a7f50911a945
Models code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
12 """ |
1217
a3b2b4b4e440
fixes for issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1136
diff
changeset
|
13 # This program is free software: you can redistribute it and/or modify |
a3b2b4b4e440
fixes for issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1136
diff
changeset
|
14 # it under the terms of the GNU General Public License as published by |
a3b2b4b4e440
fixes for issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1136
diff
changeset
|
15 # the Free Software Foundation, either version 3 of the License, or |
a3b2b4b4e440
fixes for issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1136
diff
changeset
|
16 # (at your option) any later version. |
a3b2b4b4e440
fixes for issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1136
diff
changeset
|
17 # |
759
a7f50911a945
Models code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
18 # This program is distributed in the hope that it will be useful, |
a7f50911a945
Models code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
a7f50911a945
Models code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
a7f50911a945
Models code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
21 # GNU General Public License for more details. |
1217
a3b2b4b4e440
fixes for issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1136
diff
changeset
|
22 # |
759
a7f50911a945
Models code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
23 # You should have received a copy of the GNU General Public License |
1217
a3b2b4b4e440
fixes for issue #149
Marcin Kuzminski <marcin@python-works.com>
parents:
1136
diff
changeset
|
24 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
759
a7f50911a945
Models code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
25 import logging |
a7f50911a945
Models code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
26 import datetime |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
27 from datetime import date |
759
a7f50911a945
Models code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
28 |
658 | 29 from sqlalchemy import * |
759
a7f50911a945
Models code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
30 from sqlalchemy.exc import DatabaseError |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
31 from sqlalchemy.orm import relationship, backref |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
32 from sqlalchemy.orm.interfaces import MapperExtension |
759
a7f50911a945
Models code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
33 |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
34 from rhodecode.model.meta import Base, Session |
759
a7f50911a945
Models code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
35 |
442
d66a7fa7689b
moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents:
417
diff
changeset
|
36 log = logging.getLogger(__name__) |
49
3ada2f409c1c
Added sqlalchemy support
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
37 |
832
634596f81cfd
new improved models with helper functions for easier data fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
810
diff
changeset
|
38 |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
39 class RhodeCodeSettings(Base): |
548
b75b77ef649d
renamed hg_app to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
40 __tablename__ = 'rhodecode_settings' |
381
55377fdc1fc6
cleared global application settings.
Marcin Kuzminski <marcin@python-works.com>
parents:
367
diff
changeset
|
41 __table_args__ = (UniqueConstraint('app_settings_name'), {'useexisting':True}) |
780
92fa9c3414d0
fixed models for compatibility with database systems
Marcin Kuzminski <marcin@python-works.com>
parents:
759
diff
changeset
|
42 app_settings_id = Column("app_settings_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
43 app_settings_name = Column("app_settings_name", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
44 app_settings_value = Column("app_settings_value", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
341
1ef52a70f3b7
Made config file free configuration based on database and capable of beeing manage via application settings + some code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
328
diff
changeset
|
45 |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
46 def __init__(self, k='', v=''): |
704
26237de9b613
Added settings model, and Exceptions lib.
Marcin Kuzminski <marcin@python-works.com>
parents:
692
diff
changeset
|
47 self.app_settings_name = k |
26237de9b613
Added settings model, and Exceptions lib.
Marcin Kuzminski <marcin@python-works.com>
parents:
692
diff
changeset
|
48 self.app_settings_value = v |
26237de9b613
Added settings model, and Exceptions lib.
Marcin Kuzminski <marcin@python-works.com>
parents:
692
diff
changeset
|
49 |
26237de9b613
Added settings model, and Exceptions lib.
Marcin Kuzminski <marcin@python-works.com>
parents:
692
diff
changeset
|
50 def __repr__(self): |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
51 return "<%s('%s:%s')>" % (self.__class__.__name__, |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
52 self.app_settings_name, self.app_settings_value) |
704
26237de9b613
Added settings model, and Exceptions lib.
Marcin Kuzminski <marcin@python-works.com>
parents:
692
diff
changeset
|
53 |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
54 class RhodeCodeUi(Base): |
548
b75b77ef649d
renamed hg_app to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
55 __tablename__ = 'rhodecode_ui' |
341
1ef52a70f3b7
Made config file free configuration based on database and capable of beeing manage via application settings + some code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
328
diff
changeset
|
56 __table_args__ = {'useexisting':True} |
780
92fa9c3414d0
fixed models for compatibility with database systems
Marcin Kuzminski <marcin@python-works.com>
parents:
759
diff
changeset
|
57 ui_id = Column("ui_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
58 ui_section = Column("ui_section", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
59 ui_key = Column("ui_key", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
60 ui_value = Column("ui_value", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
780
92fa9c3414d0
fixed models for compatibility with database systems
Marcin Kuzminski <marcin@python-works.com>
parents:
759
diff
changeset
|
61 ui_active = Column("ui_active", Boolean(), nullable=True, unique=None, default=True) |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
549
diff
changeset
|
62 |
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
549
diff
changeset
|
63 |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
64 class User(Base): |
49
3ada2f409c1c
Added sqlalchemy support
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
65 __tablename__ = 'users' |
473
6b934c9607e7
Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents:
462
diff
changeset
|
66 __table_args__ = (UniqueConstraint('username'), UniqueConstraint('email'), {'useexisting':True}) |
780
92fa9c3414d0
fixed models for compatibility with database systems
Marcin Kuzminski <marcin@python-works.com>
parents:
759
diff
changeset
|
67 user_id = Column("user_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
68 username = Column("username", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
69 password = Column("password", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
780
92fa9c3414d0
fixed models for compatibility with database systems
Marcin Kuzminski <marcin@python-works.com>
parents:
759
diff
changeset
|
70 active = Column("active", Boolean(), nullable=True, unique=None, default=None) |
92fa9c3414d0
fixed models for compatibility with database systems
Marcin Kuzminski <marcin@python-works.com>
parents:
759
diff
changeset
|
71 admin = Column("admin", Boolean(), nullable=True, unique=None, default=False) |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
72 name = Column("name", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
73 lastname = Column("lastname", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
74 email = Column("email", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
780
92fa9c3414d0
fixed models for compatibility with database systems
Marcin Kuzminski <marcin@python-works.com>
parents:
759
diff
changeset
|
75 last_login = Column("last_login", DateTime(timezone=False), nullable=True, unique=None, default=None) |
92fa9c3414d0
fixed models for compatibility with database systems
Marcin Kuzminski <marcin@python-works.com>
parents:
759
diff
changeset
|
76 is_ldap = Column("is_ldap", Boolean(), nullable=False, unique=None, default=False) |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
549
diff
changeset
|
77 |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
78 user_log = relationship('UserLog', cascade='all') |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
79 user_perms = relationship('UserToPerm', primaryjoin="User.user_id==UserToPerm.user_id", cascade='all') |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
549
diff
changeset
|
80 |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
81 repositories = relationship('Repository') |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
82 user_followers = relationship('UserFollowing', primaryjoin='UserFollowing.follows_user_id==User.user_id', cascade='all') |
713
1bb0fcdec895
fixed #72 show warning on removal when user still is owner of existing repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
708
diff
changeset
|
83 |
759
a7f50911a945
Models code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
84 @property |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
242
diff
changeset
|
85 def full_contact(self): |
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
242
diff
changeset
|
86 return '%s %s <%s>' % (self.name, self.lastname, self.email) |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
549
diff
changeset
|
87 |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
88 @property |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
89 def short_contact(self): |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
90 return '%s %s' % (self.name, self.lastname) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
91 |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
92 |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
93 @property |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
94 def is_admin(self): |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
95 return self.admin |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
96 |
232
37a832dc4a82
some beaker cache changes, and added repr to models
Marcin Kuzminski <marcin@python-works.com>
parents:
226
diff
changeset
|
97 def __repr__(self): |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
98 return "<%s('id:%s:%s')>" % (self.__class__.__name__, |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
99 self.user_id, self.username) |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
549
diff
changeset
|
100 |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
101 @classmethod |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
102 def by_username(cls, username): |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
103 return Session.query(cls).filter(cls.username == username).one() |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
104 |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
105 |
442
d66a7fa7689b
moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents:
417
diff
changeset
|
106 def update_lastlogin(self): |
d66a7fa7689b
moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents:
417
diff
changeset
|
107 """Update user lastlogin""" |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
549
diff
changeset
|
108 |
442
d66a7fa7689b
moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents:
417
diff
changeset
|
109 try: |
d66a7fa7689b
moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents:
417
diff
changeset
|
110 session = Session.object_session(self) |
d66a7fa7689b
moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents:
417
diff
changeset
|
111 self.last_login = datetime.datetime.now() |
d66a7fa7689b
moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents:
417
diff
changeset
|
112 session.add(self) |
d66a7fa7689b
moved loged in user propagation out of forms,
Marcin Kuzminski <marcin@python-works.com>
parents:
417
diff
changeset
|
113 session.commit() |
473
6b934c9607e7
Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents:
462
diff
changeset
|
114 log.debug('updated user %s lastlogin', self.username) |
759
a7f50911a945
Models code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
734
diff
changeset
|
115 except (DatabaseError,): |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
549
diff
changeset
|
116 session.rollback() |
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
549
diff
changeset
|
117 |
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
549
diff
changeset
|
118 |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
119 class UserLog(Base): |
49
3ada2f409c1c
Added sqlalchemy support
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
120 __tablename__ = 'user_logs' |
3ada2f409c1c
Added sqlalchemy support
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
121 __table_args__ = {'useexisting':True} |
780
92fa9c3414d0
fixed models for compatibility with database systems
Marcin Kuzminski <marcin@python-works.com>
parents:
759
diff
changeset
|
122 user_log_id = Column("user_log_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
123 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None) |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
124 repository_id = Column("repository_id", Integer(length=None, convert_unicode=False, assert_unicode=None), ForeignKey('repositories.repo_id'), nullable=False, unique=None, default=None) |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
125 repository_name = Column("repository_name", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
126 user_ip = Column("user_ip", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
127 action = Column("action", UnicodeText(length=1200000, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
780
92fa9c3414d0
fixed models for compatibility with database systems
Marcin Kuzminski <marcin@python-works.com>
parents:
759
diff
changeset
|
128 action_date = Column("action_date", DateTime(timezone=False), nullable=True, unique=None, default=None) |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
549
diff
changeset
|
129 |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
130 @property |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
131 def action_as_day(self): |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
132 return date(*self.action_date.timetuple()[:3]) |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
133 |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
134 user = relationship('User') |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
135 repository = relationship('Repository') |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
549
diff
changeset
|
136 |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
137 class Repository(Base): |
234
a0116e944da1
changed naming convention for db modules.
Marcin Kuzminski <marcin@python-works.com>
parents:
232
diff
changeset
|
138 __tablename__ = 'repositories' |
367
a26f48ad7a8a
fixes issue #16 reimplementation of database repository, for using generic pk instead of repo naming as pk. Which caused to many problems.
Marcin Kuzminski <marcin@python-works.com>
parents:
341
diff
changeset
|
139 __table_args__ = (UniqueConstraint('repo_name'), {'useexisting':True},) |
780
92fa9c3414d0
fixed models for compatibility with database systems
Marcin Kuzminski <marcin@python-works.com>
parents:
759
diff
changeset
|
140 repo_id = Column("repo_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
141 repo_name = Column("repo_name", String(length=255, convert_unicode=False, assert_unicode=None), nullable=False, unique=True, default=None) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
142 repo_type = Column("repo_type", String(length=255, convert_unicode=False, assert_unicode=None), nullable=False, unique=False, default='hg') |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
143 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=False, default=None) |
780
92fa9c3414d0
fixed models for compatibility with database systems
Marcin Kuzminski <marcin@python-works.com>
parents:
759
diff
changeset
|
144 private = Column("private", Boolean(), nullable=True, unique=None, default=None) |
810
bd57d1cb9dc3
fixes #62, added option to disable statistics for each repository
Marcin Kuzminski <marcin@python-works.com>
parents:
780
diff
changeset
|
145 enable_statistics = Column("statistics", Boolean(), nullable=True, unique=None, default=True) |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
146 description = Column("description", String(length=10000, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
147 fork_id = Column("fork_id", Integer(), ForeignKey('repositories.repo_id'), nullable=True, unique=False, default=None) |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
148 |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
149 user = relationship('User') |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
150 fork = relationship('Repository', remote_side=repo_id) |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
151 repo_to_perm = relationship('RepoToPerm', cascade='all') |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
152 stats = relationship('Statistics', cascade='all', uselist=False) |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
549
diff
changeset
|
153 |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
154 repo_followers = relationship('UserFollowing', primaryjoin='UserFollowing.follows_repo_id==Repository.repo_id', cascade='all') |
667
56a8434a88cc
fixes #51 deleting a repo didn't delete it's dependent db entries.
Marcin Kuzminski <marcin@python-works.com>
parents:
658
diff
changeset
|
155 |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
156 logs = relationship('UserLog', cascade='all') |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
157 |
417
3ed2d46a2ca7
permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents:
414
diff
changeset
|
158 def __repr__(self): |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
159 return "<%s('%s:%s')>" % (self.__class__.__name__, |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
160 self.repo_id, self.repo_name) |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
549
diff
changeset
|
161 |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
162 class Permission(Base): |
226
c6526b7531e9
rewritten db manage script to use sqlalchemy. Fixed sqlalchemy models to more generic.
Marcin Kuzminski <marcin@python-works.com>
parents:
89
diff
changeset
|
163 __tablename__ = 'permissions' |
c6526b7531e9
rewritten db manage script to use sqlalchemy. Fixed sqlalchemy models to more generic.
Marcin Kuzminski <marcin@python-works.com>
parents:
89
diff
changeset
|
164 __table_args__ = {'useexisting':True} |
780
92fa9c3414d0
fixed models for compatibility with database systems
Marcin Kuzminski <marcin@python-works.com>
parents:
759
diff
changeset
|
165 permission_id = Column("permission_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
166 permission_name = Column("permission_name", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
167 permission_longname = Column("permission_longname", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
549
diff
changeset
|
168 |
232
37a832dc4a82
some beaker cache changes, and added repr to models
Marcin Kuzminski <marcin@python-works.com>
parents:
226
diff
changeset
|
169 def __repr__(self): |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
170 return "<%s('%s:%s')>" % (self.__class__.__name__, |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
171 self.permission_id, self.permission_name) |
296
29370bb76fa6
first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents:
265
diff
changeset
|
172 |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
173 class RepoToPerm(Base): |
296
29370bb76fa6
first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents:
265
diff
changeset
|
174 __tablename__ = 'repo_to_perm' |
367
a26f48ad7a8a
fixes issue #16 reimplementation of database repository, for using generic pk instead of repo naming as pk. Which caused to many problems.
Marcin Kuzminski <marcin@python-works.com>
parents:
341
diff
changeset
|
175 __table_args__ = (UniqueConstraint('user_id', 'repository_id'), {'useexisting':True}) |
780
92fa9c3414d0
fixed models for compatibility with database systems
Marcin Kuzminski <marcin@python-works.com>
parents:
759
diff
changeset
|
176 repo_to_perm_id = Column("repo_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
177 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None) |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
178 permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None) |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
179 repository_id = Column("repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=False, unique=None, default=None) |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
549
diff
changeset
|
180 |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
181 user = relationship('User') |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
182 permission = relationship('Permission') |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
183 repository = relationship('Repository') |
399
f5c1eec9f376
rename repo2perm into repo_to_perm
Marcin Kuzminski <marcin@python-works.com>
parents:
392
diff
changeset
|
184 |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
185 class UserToPerm(Base): |
399
f5c1eec9f376
rename repo2perm into repo_to_perm
Marcin Kuzminski <marcin@python-works.com>
parents:
392
diff
changeset
|
186 __tablename__ = 'user_to_perm' |
414
27f801e03489
fixed escaping for new webhelpers and added perm2user constraint
Marcin Kuzminski <marcin@python-works.com>
parents:
399
diff
changeset
|
187 __table_args__ = (UniqueConstraint('user_id', 'permission_id'), {'useexisting':True}) |
780
92fa9c3414d0
fixed models for compatibility with database systems
Marcin Kuzminski <marcin@python-works.com>
parents:
759
diff
changeset
|
188 user_to_perm_id = Column("user_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
189 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None) |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
190 permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None) |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
549
diff
changeset
|
191 |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
192 user = relationship('User') |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
193 permission = relationship('Permission') |
399
f5c1eec9f376
rename repo2perm into repo_to_perm
Marcin Kuzminski <marcin@python-works.com>
parents:
392
diff
changeset
|
194 |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
195 class Statistics(Base): |
493
2256c78afe53
implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents:
473
diff
changeset
|
196 __tablename__ = 'statistics' |
2256c78afe53
implemented basic autoupdating statistics fetched from database
Marcin Kuzminski <marcin@python-works.com>
parents:
473
diff
changeset
|
197 __table_args__ = (UniqueConstraint('repository_id'), {'useexisting':True}) |
780
92fa9c3414d0
fixed models for compatibility with database systems
Marcin Kuzminski <marcin@python-works.com>
parents:
759
diff
changeset
|
198 stat_id = Column("stat_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
199 repository_id = Column("repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=False, unique=True, default=None) |
780
92fa9c3414d0
fixed models for compatibility with database systems
Marcin Kuzminski <marcin@python-works.com>
parents:
759
diff
changeset
|
200 stat_on_revision = Column("stat_on_revision", Integer(), nullable=False) |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
201 commit_activity = Column("commit_activity", LargeBinary(1000000), nullable=False)#JSON data |
780
92fa9c3414d0
fixed models for compatibility with database systems
Marcin Kuzminski <marcin@python-works.com>
parents:
759
diff
changeset
|
202 commit_activity_combined = Column("commit_activity_combined", LargeBinary(), nullable=False)#JSON data |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
203 languages = Column("languages", LargeBinary(1000000), nullable=False)#JSON data |
631
05528ad948c4
Hacking for git support,and new faster repo scan
Marcin Kuzminski <marcin@python-works.com>
parents:
549
diff
changeset
|
204 |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
205 repository = relationship('Repository', single_parent=True) |
399
f5c1eec9f376
rename repo2perm into repo_to_perm
Marcin Kuzminski <marcin@python-works.com>
parents:
392
diff
changeset
|
206 |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
207 class UserFollowing(Base): |
734
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
713
diff
changeset
|
208 __tablename__ = 'user_followings' |
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
713
diff
changeset
|
209 __table_args__ = (UniqueConstraint('user_id', 'follows_repository_id'), |
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
713
diff
changeset
|
210 UniqueConstraint('user_id', 'follows_user_id') |
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
713
diff
changeset
|
211 , {'useexisting':True}) |
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
713
diff
changeset
|
212 |
780
92fa9c3414d0
fixed models for compatibility with database systems
Marcin Kuzminski <marcin@python-works.com>
parents:
759
diff
changeset
|
213 user_following_id = Column("user_following_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
214 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None) |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
215 follows_repo_id = Column("follows_repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=True, unique=None, default=None) |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
216 follows_user_id = Column("follows_user_id", Integer(), ForeignKey('users.user_id'), nullable=True, unique=None, default=None) |
734
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
713
diff
changeset
|
217 |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
218 user = relationship('User', primaryjoin='User.user_id==UserFollowing.user_id') |
734
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
713
diff
changeset
|
219 |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
220 follows_user = relationship('User', primaryjoin='User.user_id==UserFollowing.follows_user_id') |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
221 follows_repository = relationship('Repository', order_by='Repository.repo_name') |
734
49eb69d78988
implemented user dashboards, and following system.
Marcin Kuzminski <marcin@python-works.com>
parents:
713
diff
changeset
|
222 |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
223 class CacheInvalidation(Base): |
670
e7c670cc03cb
Adde table for cache invalidation
Marcin Kuzminski <marcin@python-works.com>
parents:
667
diff
changeset
|
224 __tablename__ = 'cache_invalidation' |
692
cb0d9ce6ac5c
#50 on point cache invalidation changes.
Marcin Kuzminski <marcin@python-works.com>
parents:
670
diff
changeset
|
225 __table_args__ = (UniqueConstraint('cache_key'), {'useexisting':True}) |
780
92fa9c3414d0
fixed models for compatibility with database systems
Marcin Kuzminski <marcin@python-works.com>
parents:
759
diff
changeset
|
226 cache_id = Column("cache_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
227 cache_key = Column("cache_key", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
228 cache_args = Column("cache_args", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
780
92fa9c3414d0
fixed models for compatibility with database systems
Marcin Kuzminski <marcin@python-works.com>
parents:
759
diff
changeset
|
229 cache_active = Column("cache_active", Boolean(), nullable=True, unique=None, default=False) |
670
e7c670cc03cb
Adde table for cache invalidation
Marcin Kuzminski <marcin@python-works.com>
parents:
667
diff
changeset
|
230 |
e7c670cc03cb
Adde table for cache invalidation
Marcin Kuzminski <marcin@python-works.com>
parents:
667
diff
changeset
|
231 |
692
cb0d9ce6ac5c
#50 on point cache invalidation changes.
Marcin Kuzminski <marcin@python-works.com>
parents:
670
diff
changeset
|
232 def __init__(self, cache_key, cache_args=''): |
cb0d9ce6ac5c
#50 on point cache invalidation changes.
Marcin Kuzminski <marcin@python-works.com>
parents:
670
diff
changeset
|
233 self.cache_key = cache_key |
cb0d9ce6ac5c
#50 on point cache invalidation changes.
Marcin Kuzminski <marcin@python-works.com>
parents:
670
diff
changeset
|
234 self.cache_args = cache_args |
cb0d9ce6ac5c
#50 on point cache invalidation changes.
Marcin Kuzminski <marcin@python-works.com>
parents:
670
diff
changeset
|
235 self.cache_active = False |
cb0d9ce6ac5c
#50 on point cache invalidation changes.
Marcin Kuzminski <marcin@python-works.com>
parents:
670
diff
changeset
|
236 |
cb0d9ce6ac5c
#50 on point cache invalidation changes.
Marcin Kuzminski <marcin@python-works.com>
parents:
670
diff
changeset
|
237 def __repr__(self): |
1057
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
238 return "<%s('%s:%s')>" % (self.__class__.__name__, |
af6ca51fb80f
rhodecode release 1.1.3 changes
Marcin Kuzminski <marcin@python-works.com>
parents:
857
diff
changeset
|
239 self.cache_id, self.cache_key) |
834
8924ed0e4f36
added current db version into rhodecode,
Marcin Kuzminski <marcin@python-works.com>
parents:
832
diff
changeset
|
240 |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
241 class DbMigrateVersion(Base): |
834
8924ed0e4f36
added current db version into rhodecode,
Marcin Kuzminski <marcin@python-works.com>
parents:
832
diff
changeset
|
242 __tablename__ = 'db_migrate_version' |
8924ed0e4f36
added current db version into rhodecode,
Marcin Kuzminski <marcin@python-works.com>
parents:
832
diff
changeset
|
243 __table_args__ = {'useexisting':True} |
1136
93b980ebee55
changes for release 1.1.5
Marcin Kuzminski <marcin@python-works.com>
parents:
1057
diff
changeset
|
244 repository_id = Column('repository_id', String(255), primary_key=True) |
834
8924ed0e4f36
added current db version into rhodecode,
Marcin Kuzminski <marcin@python-works.com>
parents:
832
diff
changeset
|
245 repository_path = Column('repository_path', Text) |
8924ed0e4f36
added current db version into rhodecode,
Marcin Kuzminski <marcin@python-works.com>
parents:
832
diff
changeset
|
246 version = Column('version', Integer) |
8924ed0e4f36
added current db version into rhodecode,
Marcin Kuzminski <marcin@python-works.com>
parents:
832
diff
changeset
|
247 |