overleaf/migrations/6_add_track_changes_feature.coffee
2017-05-17 14:23:55 +01:00

31 lines
672 B
CoffeeScript

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()