Browse Source

include commands to update indexes in docHistory migration - not called

Brian Gough 10 years ago
parent
commit
c4618e795e
1 changed files with 15 additions and 0 deletions
  1. 15 0
      server-ce/migrations/3_pack_docHistory_collection.coffee

+ 15 - 0
server-ce/migrations/3_pack_docHistory_collection.coffee

@@ -74,6 +74,21 @@ processNext = (doc_id, callback)->
 		PackManager._packDocHistory doc_id, {}, (err) ->
 			markDocAsProcessed doc_id, callback
 
+updateIndexes = (callback) ->
+	async.series [
+		(cb) ->
+			console.log "create index"
+			db.docHistory.ensureIndex { project_id: 1, "meta.end_ts": 1, "meta.start_ts": -1 }, { background: true }, cb
+		(cb) ->
+			console.log "drop index"
+			db.docHistory.dropIndex { project_id: 1, "meta.end_ts": 1 }, cb
+		(cb) ->
+			console.log "drop index"
+			db.docHistory.dropIndex { project_id: 1, "pack.0.meta.end_ts": 1, "meta.end_ts": 1}, cb
+	], (err, results) ->
+		console.log "all done"
+		callback(err)
+
 exports.migrate = (client, done = ->)->
 	getDocIds (err, ids)->
 		interval = setInterval printProgress, 3*1000