mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
24 lines
670 B
JavaScript
24 lines
670 B
JavaScript
|
const Settings = require('settings-sharelatex')
|
||
|
const mongojs = require('mongojs')
|
||
|
const db = mongojs(Settings.mongo.url, ['projects'])
|
||
|
|
||
|
exports.migrate = (client, done) => {
|
||
|
console.log(`>> Setting 'imageName' in projects`)
|
||
|
|
||
|
if (!Settings.currentImageName) {
|
||
|
console.log(`>> 'currentImageName' is not defined, no projects updated`)
|
||
|
return done()
|
||
|
}
|
||
|
|
||
|
console.log(`>> Setting 'imageName' = ${Settings.currentImageName}`)
|
||
|
|
||
|
db.projects.update(
|
||
|
{ imageName: { $exists: false } },
|
||
|
{ $set: { imageName: Settings.currentImageName } },
|
||
|
{ multi: true },
|
||
|
done
|
||
|
)
|
||
|
}
|
||
|
|
||
|
exports.rollback = (client, done) => done()
|