mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Add migration to enable trackChanges for all users
This commit is contained in:
parent
99f2cad19a
commit
48e4f32745
1 changed files with 31 additions and 0 deletions
31
server-ce/migrations/6_add_track_changes_feature.coffee
Normal file
31
server-ce/migrations/6_add_track_changes_feature.coffee
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
Settings = require "settings-sharelatex"
|
||||||
|
fs = require("fs")
|
||||||
|
mongojs = require("mongojs")
|
||||||
|
ObjectId = mongojs.ObjectId
|
||||||
|
db = mongojs(Settings.mongo.url, ['users'])
|
||||||
|
_ = require("underscore")
|
||||||
|
BSON = db.bson.BSON
|
||||||
|
|
||||||
|
|
||||||
|
handleExit = () ->
|
||||||
|
console.log('Got signal. Shutting down.')
|
||||||
|
|
||||||
|
|
||||||
|
process.on 'SIGINT', handleExit
|
||||||
|
process.on 'SIGHUP', handleExit
|
||||||
|
|
||||||
|
|
||||||
|
exports.migrate = (client, done=()->) ->
|
||||||
|
patch = {
|
||||||
|
$set: {
|
||||||
|
'features.trackChanges': true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log ">> enabling trackChanges feature: ", patch
|
||||||
|
db.users.update {}, patch, {multi: true}, (err) ->
|
||||||
|
console.log "finished enabling trackChanges feature"
|
||||||
|
return done(err)
|
||||||
|
|
||||||
|
|
||||||
|
exports.rollback = (client, done) ->
|
||||||
|
done()
|
Loading…
Reference in a new issue