chore: 后端首次基线提交
运行必须源码:app/(controller/model/service/middleware/lib/utils/validate/router)、config/、database/(migrations/seeders/sql)、启动脚本、app/public/templates 模板。 已忽略运行非必须:node_modules/、logs/、run/、app/public 运行时上传数据、.env*、构建/缓存产物。
This commit is contained in:
23
add_word_cols.js
Normal file
23
add_word_cols.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const mysql = require('mysql2/promise');
|
||||
(async () => {
|
||||
const c = await mysql.createConnection({
|
||||
host: 'localhost', user: 'root', password: '74191221', database: 'competition_db'
|
||||
});
|
||||
try {
|
||||
await c.query("ALTER TABLE exam_submissions ADD COLUMN word_file_path VARCHAR(500) NULL DEFAULT NULL COMMENT 'Word答案文件路径' AFTER answers");
|
||||
console.log('Added word_file_path');
|
||||
} catch (e) {
|
||||
if (e.code === 'ER_DUP_FIELDNAME') console.log('word_file_path exists');
|
||||
else throw e;
|
||||
}
|
||||
try {
|
||||
await c.query("ALTER TABLE exam_submissions ADD COLUMN word_file_name VARCHAR(255) NULL DEFAULT NULL COMMENT 'Word答案文件名' AFTER word_file_path");
|
||||
console.log('Added word_file_name');
|
||||
} catch (e) {
|
||||
if (e.code === 'ER_DUP_FIELDNAME') console.log('word_file_name exists');
|
||||
else throw e;
|
||||
}
|
||||
const [cols] = await c.query('SHOW COLUMNS FROM exam_submissions');
|
||||
cols.forEach(x => console.log(x.Field, x.Type, x.Null));
|
||||
await c.end();
|
||||
})();
|
||||
Reference in New Issue
Block a user