Show More
@@ -138,8 +138,8 b' class UserLog(Base, BaseModel):' | |||||
138 | __tablename__ = 'user_logs' |
|
138 | __tablename__ = 'user_logs' | |
139 | __table_args__ = {'useexisting':True} |
|
139 | __table_args__ = {'useexisting':True} | |
140 | user_log_id = Column("user_log_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) |
|
140 | user_log_id = Column("user_log_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) | |
141 |
user_id = Column("user_id", Integer(), ForeignKey( |
|
141 | user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None) | |
142 |
repository_id = Column("repository_id", Integer(length=None, convert_unicode=False, assert_unicode=None), ForeignKey( |
|
142 | repository_id = Column("repository_id", Integer(length=None, convert_unicode=False, assert_unicode=None), ForeignKey('repositories.repo_id'), nullable=False, unique=None, default=None) | |
143 | repository_name = Column("repository_name", String(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
|
143 | repository_name = Column("repository_name", String(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) | |
144 | user_ip = Column("user_ip", String(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
|
144 | user_ip = Column("user_ip", String(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) | |
145 | action = Column("action", String(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
|
145 | action = Column("action", String(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) | |
@@ -154,12 +154,12 b' class Repository(Base, BaseModel):' | |||||
154 | repo_id = Column("repo_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) |
|
154 | repo_id = Column("repo_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) | |
155 | repo_name = Column("repo_name", String(length=None, convert_unicode=False, assert_unicode=None), nullable=False, unique=True, default=None) |
|
155 | repo_name = Column("repo_name", String(length=None, convert_unicode=False, assert_unicode=None), nullable=False, unique=True, default=None) | |
156 | repo_type = Column("repo_type", String(length=None, convert_unicode=False, assert_unicode=None), nullable=False, unique=False, default='hg') |
|
156 | repo_type = Column("repo_type", String(length=None, convert_unicode=False, assert_unicode=None), nullable=False, unique=False, default='hg') | |
157 |
user_id = Column("user_id", Integer(), ForeignKey( |
|
157 | user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=False, default=None) | |
158 | private = Column("private", Boolean(), nullable=True, unique=None, default=None) |
|
158 | private = Column("private", Boolean(), nullable=True, unique=None, default=None) | |
159 | enable_statistics = Column("statistics", Boolean(), nullable=True, unique=None, default=True) |
|
159 | enable_statistics = Column("statistics", Boolean(), nullable=True, unique=None, default=True) | |
160 | description = Column("description", String(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
|
160 | description = Column("description", String(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) | |
161 |
fork_id = Column("fork_id", Integer(), ForeignKey( |
|
161 | fork_id = Column("fork_id", Integer(), ForeignKey('repositories.repo_id'), nullable=True, unique=False, default=None) | |
162 |
group_id = Column("group_id", Integer(), ForeignKey( |
|
162 | group_id = Column("group_id", Integer(), ForeignKey('groups.group_id'), nullable=True, unique=False, default=None) | |
163 |
|
163 | |||
164 | user = relation('User') |
|
164 | user = relation('User') | |
165 | fork = relation('Repository', remote_side=repo_id) |
|
165 | fork = relation('Repository', remote_side=repo_id) | |
@@ -169,10 +169,9 b' class Repository(Base, BaseModel):' | |||||
169 |
|
169 | |||
170 | repo_followers = relation('UserFollowing', primaryjoin='UserFollowing.follows_repo_id==Repository.repo_id', cascade='all') |
|
170 | repo_followers = relation('UserFollowing', primaryjoin='UserFollowing.follows_repo_id==Repository.repo_id', cascade='all') | |
171 |
|
171 | |||
172 |
|
||||
173 | def __repr__(self): |
|
172 | def __repr__(self): | |
174 | return "<%s('%s:%s')>" % (self.__class__.__name__, |
|
173 | return "<%s('%s:%s')>" % (self.__class__.__name__, | |
175 |
|
|
174 | self.repo_id, self.repo_name) | |
176 |
|
175 | |||
177 | class Group(Base, BaseModel): |
|
176 | class Group(Base, BaseModel): | |
178 | __tablename__ = 'groups' |
|
177 | __tablename__ = 'groups' | |
@@ -180,7 +179,7 b' class Group(Base, BaseModel):' | |||||
180 |
|
179 | |||
181 | group_id = Column("group_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) |
|
180 | group_id = Column("group_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) | |
182 | group_name = Column("group_name", String(length=None, convert_unicode=False, assert_unicode=None), nullable=False, unique=True, default=None) |
|
181 | group_name = Column("group_name", String(length=None, convert_unicode=False, assert_unicode=None), nullable=False, unique=True, default=None) | |
183 |
group_parent_id = Column("group_parent_id", Integer(), ForeignKey( |
|
182 | group_parent_id = Column("group_parent_id", Integer(), ForeignKey('groups.group_id'), nullable=True, unique=None, default=None) | |
184 |
|
183 | |||
185 | parent_group = relation('Group', remote_side=group_id) |
|
184 | parent_group = relation('Group', remote_side=group_id) | |
186 |
|
185 | |||
@@ -202,15 +201,15 b' class Permission(Base, BaseModel):' | |||||
202 |
|
201 | |||
203 | def __repr__(self): |
|
202 | def __repr__(self): | |
204 | return "<%s('%s:%s')>" % (self.__class__.__name__, |
|
203 | return "<%s('%s:%s')>" % (self.__class__.__name__, | |
205 |
|
|
204 | self.permission_id, self.permission_name) | |
206 |
|
205 | |||
207 | class RepoToPerm(Base, BaseModel): |
|
206 | class RepoToPerm(Base, BaseModel): | |
208 | __tablename__ = 'repo_to_perm' |
|
207 | __tablename__ = 'repo_to_perm' | |
209 | __table_args__ = (UniqueConstraint('user_id', 'repository_id'), {'useexisting':True}) |
|
208 | __table_args__ = (UniqueConstraint('user_id', 'repository_id'), {'useexisting':True}) | |
210 | repo_to_perm_id = Column("repo_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) |
|
209 | repo_to_perm_id = Column("repo_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) | |
211 |
user_id = Column("user_id", Integer(), ForeignKey( |
|
210 | user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None) | |
212 |
permission_id = Column("permission_id", Integer(), ForeignKey( |
|
211 | permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None) | |
213 |
repository_id = Column("repository_id", Integer(), ForeignKey( |
|
212 | repository_id = Column("repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=False, unique=None, default=None) | |
214 |
|
213 | |||
215 | user = relation('User') |
|
214 | user = relation('User') | |
216 | permission = relation('Permission') |
|
215 | permission = relation('Permission') | |
@@ -220,8 +219,8 b' class UserToPerm(Base, BaseModel):' | |||||
220 | __tablename__ = 'user_to_perm' |
|
219 | __tablename__ = 'user_to_perm' | |
221 | __table_args__ = (UniqueConstraint('user_id', 'permission_id'), {'useexisting':True}) |
|
220 | __table_args__ = (UniqueConstraint('user_id', 'permission_id'), {'useexisting':True}) | |
222 | user_to_perm_id = Column("user_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) |
|
221 | user_to_perm_id = Column("user_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) | |
223 |
user_id = Column("user_id", Integer(), ForeignKey( |
|
222 | user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None) | |
224 |
permission_id = Column("permission_id", Integer(), ForeignKey( |
|
223 | permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None) | |
225 |
|
224 | |||
226 | user = relation('User') |
|
225 | user = relation('User') | |
227 | permission = relation('Permission') |
|
226 | permission = relation('Permission') | |
@@ -231,24 +230,19 b' class GroupToPerm(Base, BaseModel):' | |||||
231 | __table_args__ = (UniqueConstraint('group_id', 'permission_id'), {'useexisting':True}) |
|
230 | __table_args__ = (UniqueConstraint('group_id', 'permission_id'), {'useexisting':True}) | |
232 |
|
231 | |||
233 | group_to_perm_id = Column("group_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) |
|
232 | group_to_perm_id = Column("group_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) | |
234 |
user_id = Column("user_id", Integer(), ForeignKey( |
|
233 | user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None) | |
235 |
permission_id = Column("permission_id", Integer(), ForeignKey( |
|
234 | permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None) | |
236 |
group_id = Column("group_id", Integer(), ForeignKey( |
|
235 | group_id = Column("group_id", Integer(), ForeignKey('groups.group_id'), nullable=False, unique=None, default=None) | |
237 |
|
236 | |||
238 | user = relation('User') |
|
237 | user = relation('User') | |
239 | permission = relation('Permission') |
|
238 | permission = relation('Permission') | |
240 | group = relation('Group') |
|
239 | group = relation('Group') | |
241 |
|
240 | |||
242 |
|
||||
243 |
|
||||
244 |
|
||||
245 |
|
||||
246 |
|
||||
247 | class Statistics(Base, BaseModel): |
|
241 | class Statistics(Base, BaseModel): | |
248 | __tablename__ = 'statistics' |
|
242 | __tablename__ = 'statistics' | |
249 | __table_args__ = (UniqueConstraint('repository_id'), {'useexisting':True}) |
|
243 | __table_args__ = (UniqueConstraint('repository_id'), {'useexisting':True}) | |
250 | stat_id = Column("stat_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) |
|
244 | stat_id = Column("stat_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) | |
251 |
repository_id = Column("repository_id", Integer(), ForeignKey( |
|
245 | repository_id = Column("repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=False, unique=True, default=None) | |
252 | stat_on_revision = Column("stat_on_revision", Integer(), nullable=False) |
|
246 | stat_on_revision = Column("stat_on_revision", Integer(), nullable=False) | |
253 | commit_activity = Column("commit_activity", LargeBinary(), nullable=False)#JSON data |
|
247 | commit_activity = Column("commit_activity", LargeBinary(), nullable=False)#JSON data | |
254 | commit_activity_combined = Column("commit_activity_combined", LargeBinary(), nullable=False)#JSON data |
|
248 | commit_activity_combined = Column("commit_activity_combined", LargeBinary(), nullable=False)#JSON data | |
@@ -263,16 +257,15 b' class UserFollowing(Base, BaseModel):' | |||||
263 | , {'useexisting':True}) |
|
257 | , {'useexisting':True}) | |
264 |
|
258 | |||
265 | user_following_id = Column("user_following_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) |
|
259 | user_following_id = Column("user_following_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) | |
266 |
user_id = Column("user_id", Integer(), ForeignKey( |
|
260 | user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None) | |
267 |
follows_repo_id = Column("follows_repository_id", Integer(), ForeignKey( |
|
261 | follows_repo_id = Column("follows_repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=True, unique=None, default=None) | |
268 |
follows_user_id = Column("follows_user_id", Integer(), ForeignKey( |
|
262 | follows_user_id = Column("follows_user_id", Integer(), ForeignKey('users.user_id'), nullable=True, unique=None, default=None) | |
269 |
|
263 | |||
270 | user = relation('User', primaryjoin='User.user_id==UserFollowing.user_id') |
|
264 | user = relation('User', primaryjoin='User.user_id==UserFollowing.user_id') | |
271 |
|
265 | |||
272 | follows_user = relation('User', primaryjoin='User.user_id==UserFollowing.follows_user_id') |
|
266 | follows_user = relation('User', primaryjoin='User.user_id==UserFollowing.follows_user_id') | |
273 | follows_repository = relation('Repository') |
|
267 | follows_repository = relation('Repository') | |
274 |
|
268 | |||
275 |
|
||||
276 | class CacheInvalidation(Base, BaseModel): |
|
269 | class CacheInvalidation(Base, BaseModel): | |
277 | __tablename__ = 'cache_invalidation' |
|
270 | __tablename__ = 'cache_invalidation' | |
278 | __table_args__ = (UniqueConstraint('cache_key'), {'useexisting':True}) |
|
271 | __table_args__ = (UniqueConstraint('cache_key'), {'useexisting':True}) |
General Comments 0
You need to be logged in to leave comments.
Login now