##// END OF EJS Templates
speedup: join repo on fork/user/group by default
dan -
r250:39d20fee default
parent child Browse files
Show More
@@ -1264,9 +1264,9 b' class Repository(Base, BaseModel):'
1264 "group_id", Integer(), ForeignKey('groups.group_id'), nullable=True,
1264 "group_id", Integer(), ForeignKey('groups.group_id'), nullable=True,
1265 unique=False, default=None)
1265 unique=False, default=None)
1266
1266
1267 user = relationship('User')
1267 user = relationship('User', lazy='joined')
1268 fork = relationship('Repository', remote_side=repo_id)
1268 fork = relationship('Repository', remote_side=repo_id, lazy='joined')
1269 group = relationship('RepoGroup')
1269 group = relationship('RepoGroup', lazy='joined')
1270 repo_to_perm = relationship(
1270 repo_to_perm = relationship(
1271 'UserRepoToPerm', cascade='all',
1271 'UserRepoToPerm', cascade='all',
1272 order_by='UserRepoToPerm.repo_to_perm_id')
1272 order_by='UserRepoToPerm.repo_to_perm_id')
@@ -1379,9 +1379,6 b' class Repository(Base, BaseModel):'
1379 return instance
1379 return instance
1380
1380
1381 q = session.query(cls).filter(cls.repo_name == repo_name)
1381 q = session.query(cls).filter(cls.repo_name == repo_name)
1382 q = q.options(joinedload(Repository.fork))\
1383 .options(joinedload(Repository.user))\
1384 .options(joinedload(Repository.group))
1385 return q.scalar()
1382 return q.scalar()
1386
1383
1387 @classmethod
1384 @classmethod
General Comments 0
You need to be logged in to leave comments. Login now