备份:修复前完整项目快照 2026-04-19
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
const sqlite3 = require('sqlite3').verbose();
|
||||
const db = new sqlite3.Database('company_finance.db');
|
||||
|
||||
// 创建执行记录表
|
||||
db.serialize(() => {
|
||||
console.log('开始创建执行记录表...');
|
||||
|
||||
db.run(`
|
||||
CREATE TABLE IF NOT EXISTS executions (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
apply_id INTEGER NOT NULL,
|
||||
apply_type TEXT NOT NULL,
|
||||
action TEXT NOT NULL,
|
||||
execute_method TEXT,
|
||||
voucher_no TEXT,
|
||||
remark TEXT,
|
||||
reject_reason TEXT,
|
||||
operator TEXT NOT NULL,
|
||||
operator_role TEXT NOT NULL,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
)
|
||||
`, (err) => {
|
||||
if (err) {
|
||||
console.error('创建执行记录表失败:', err.message);
|
||||
} else {
|
||||
console.log('执行记录表创建成功');
|
||||
}
|
||||
});
|
||||
|
||||
// 创建索引
|
||||
db.run(`CREATE INDEX IF NOT EXISTS idx_executions_apply ON executions(apply_id, apply_type)`, (err) => {
|
||||
if (err) {
|
||||
console.error('创建索引失败:', err.message);
|
||||
} else {
|
||||
console.log('索引创建成功');
|
||||
}
|
||||
});
|
||||
|
||||
// 关闭数据库连接
|
||||
db.close((err) => {
|
||||
if (err) {
|
||||
console.error('关闭数据库失败:', err.message);
|
||||
} else {
|
||||
console.log('数据库连接已关闭');
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user