|
a/Allura/allura/command/show_models.py |
|
b/Allura/allura/command/show_models.py |
|
... |
|
... |
132 |
base.log.info('Updating indexes for main DB')
|
132 |
base.log.info('Updating indexes for main DB')
|
133 |
db = M.main_doc_session.db
|
133 |
db = M.main_doc_session.db
|
134 |
for name, indexes in main_indexes.iteritems():
|
134 |
for name, indexes in main_indexes.iteritems():
|
135 |
self._update_indexes(db[name], indexes)
|
135 |
self._update_indexes(db[name], indexes)
|
136 |
base.log.info('Updating indexes for project DBs')
|
136 |
base.log.info('Updating indexes for project DBs')
|
137 |
projects = M.Project.query.find().all()
|
|
|
138 |
configured_dbs = set()
|
137 |
configured_dbs = set()
|
|
|
138 |
for projects in utils.chunked_find(M.Project):
|
139 |
for p in projects:
|
139 |
for p in projects:
|
140 |
db = p.database_uri
|
140 |
db = p.database_uri
|
141 |
if db in configured_dbs: continue
|
141 |
if db in configured_dbs: continue
|
142 |
configured_dbs.add(db)
|
142 |
configured_dbs.add(db)
|
143 |
c.project = p
|
143 |
c.project = p
|
144 |
db = M.project_doc_session.db
|
144 |
db = M.project_doc_session.db
|
145 |
base.log.info('... DB: %s', db)
|
145 |
base.log.info('... DB: %s', db)
|
146 |
for name, indexes in project_indexes.iteritems():
|
146 |
for name, indexes in project_indexes.iteritems():
|
147 |
self._update_indexes(db[name], indexes)
|
147 |
self._update_indexes(db[name], indexes)
|
148 |
|
148 |
|
149 |
def _update_indexes(self, collection, indexes):
|
149 |
def _update_indexes(self, collection, indexes):
|
150 |
prev_indexes = {}
|
150 |
prev_indexes = {}
|
151 |
prev_uindexes = {}
|
151 |
prev_uindexes = {}
|
152 |
uindexes = dict(
|
152 |
uindexes = dict(
|