2017-10-22 09:10:33 +08:00
|
|
|
"use strict";
|
|
|
|
|
2017-10-16 05:31:49 +08:00
|
|
|
const express = require('express');
|
|
|
|
const router = express.Router();
|
2017-10-16 07:47:05 +08:00
|
|
|
const auth = require('../../services/auth');
|
|
|
|
const sql = require('../../services/sql');
|
2017-10-23 08:22:09 +08:00
|
|
|
const migration = require('../../services/migration');
|
2017-10-16 05:31:49 +08:00
|
|
|
|
|
|
|
router.get('', auth.checkApiAuth, async (req, res, next) => {
|
|
|
|
res.send({
|
|
|
|
'db_version': parseInt(await sql.getOption('db_version')),
|
2017-10-23 08:22:09 +08:00
|
|
|
'app_db_version': migration.APP_DB_VERSION
|
2017-10-16 05:31:49 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
router.post('', auth.checkApiAuth, async (req, res, next) => {
|
2017-10-23 08:22:09 +08:00
|
|
|
const migrations = await migration.migrate();
|
2017-10-16 05:31:49 +08:00
|
|
|
|
|
|
|
res.send({
|
|
|
|
'migrations': migrations
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = router;
|