修改了一些东西

This commit is contained in:
2026-07-10 11:33:37 +08:00
parent fa2457ce7f
commit d2809c4d6d
9 changed files with 166 additions and 50 deletions
+35
View File
@@ -0,0 +1,35 @@
/*
* @Author: HenryDu8133 813367384@qq.com
* @Date: 2026-07-10 11:05:43
* @LastEditors: HenryDu8133 813367384@qq.com
* @LastEditTime: 2026-07-10 11:23:30
* @FilePath: \TicketMachine\update-db.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
const mysql = require('mysql2/promise');
async function run() {
const pool = mysql.createPool({
host: '127.0.0.1',
port: 3306,
user: 'cc-ticket-machine',
password: 'cc-ticket-machine',
database: 'cc-ticket-machine',
});
try {
const [rows] = await pool.query('SELECT data FROM config LIMIT 1');
if (rows.length > 0) {
let data = rows[0].data;
if (typeof data === 'string') data = JSON.parse(data);
data.lua_versions = data.lua_versions || {};
data.lua_versions.ticketmachine = 'v1.5.12';
data.lua_versions.gate = 'v1.5.9';
await pool.query('UPDATE config SET data = ?', [JSON.stringify(data)]);
console.log('Updated DB config to v1.5.12');
}
} catch(e) {
console.error(e);
} finally {
await pool.end();
}
}
run();