|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
const { MongoClient, ObjectId, Int32 } = require('mongodb') |
|
|
|
|
, { migrateVersion } = require(__dirname+'/../package.json') |
|
|
|
|
, configs = require(__dirname+'/../configs/main.js'); |
|
|
|
|
|
|
|
|
|
module.exports = { |
|
|
|
@ -15,6 +16,18 @@ module.exports = { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
checkVersion: async() => { |
|
|
|
|
const currentVersion = await module.exports.client |
|
|
|
|
.db('jschan') |
|
|
|
|
.collection('version') |
|
|
|
|
.findOne({ '_id': 'version' }) |
|
|
|
|
.then(res => res.version); |
|
|
|
|
if (currentVersion < migrateVersion) { |
|
|
|
|
console.error('Your migration version is out-of-date. Run `gulp migrate` to update.'); |
|
|
|
|
process.exit(1); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
ObjectId, |
|
|
|
|
|
|
|
|
|
NumberInt: Int32, |
|
|
|
|