From cc878e4caf2af5b7010df2478c71d16703da4483 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 2 Dec 2016 14:01:19 +0000 Subject: [PATCH] Add an `update_user_features` migration. --- .../migrations/4_update_user_features.coffee | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 server-ce/migrations/4_update_user_features.coffee diff --git a/server-ce/migrations/4_update_user_features.coffee b/server-ce/migrations/4_update_user_features.coffee new file mode 100644 index 0000000000..0a13416e5c --- /dev/null +++ b/server-ce/migrations/4_update_user_features.coffee @@ -0,0 +1,32 @@ +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 + +module.exports.migrate = (client, done=()->) -> + patch = { + $set: { + features: { + collaborators: -1 + dropbox: true + versioning: true + references: true + templates: true + compileTimeout: 180 + compileGroup: "standard" + } + } + } + console.log ">> updating all user features: ", patch + db.users.update {}, patch, {multi: true}, (err) -> + console.log "finished updating all user features" + return done(err)