2017-10-22 09:10:33 +08:00
|
|
|
"use strict";
|
|
|
|
|
2018-04-02 09:27:46 +08:00
|
|
|
const optionService = require('../../services/options');
|
|
|
|
const migrationService = require('../../services/migration');
|
|
|
|
const appInfo = require('../../services/app_info');
|
2017-10-16 05:31:49 +08:00
|
|
|
|
2018-03-31 07:31:22 +08:00
|
|
|
async function getMigrationInfo() {
|
|
|
|
return {
|
2018-04-02 09:27:46 +08:00
|
|
|
db_version: parseInt(await optionService.getOption('db_version')),
|
|
|
|
app_db_version: appInfo.db_version
|
2018-03-31 07:31:22 +08:00
|
|
|
};
|
|
|
|
}
|
2017-10-16 05:31:49 +08:00
|
|
|
|
2018-03-31 07:31:22 +08:00
|
|
|
async function executeMigration() {
|
2018-04-02 09:27:46 +08:00
|
|
|
const migrations = await migrationService.migrate();
|
2017-10-16 05:31:49 +08:00
|
|
|
|
2018-03-31 07:31:22 +08:00
|
|
|
return {
|
2017-11-10 12:25:23 +08:00
|
|
|
migrations: migrations
|
2018-03-31 07:31:22 +08:00
|
|
|
};
|
|
|
|
}
|
2017-10-16 05:31:49 +08:00
|
|
|
|
2018-03-31 07:31:22 +08:00
|
|
|
module.exports = {
|
|
|
|
getMigrationInfo,
|
|
|
|
executeMigration
|
|
|
|
};
|