瞪眼法测试通过

This commit is contained in:
Kyaru
2026-06-25 21:18:13 +08:00
parent b9266dfc1f
commit 67c9330659
11 changed files with 919 additions and 49 deletions

18
db.js
View File

@@ -152,6 +152,24 @@ async function initDB() {
KEY idx_after_sales_status (handle_status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='售后信息表'
`)
// ============ 2.2.1 添加缺失的字段(兼容已存在的表) ============
// contracts 表允许 customer_id 为空(采购合同可不关联客户)
try {
await pool.query(`ALTER TABLE contracts MODIFY COLUMN customer_id INT DEFAULT NULL COMMENT '客户ID (关联客户表)'`)
console.log('[init] contracts 表 customer_id 已允许为空')
} catch (e) {
// 修改失败则忽略
}
// contracts 表添加 supplier_id采购合同关联供应商
try {
await pool.query(`ALTER TABLE contracts ADD COLUMN supplier_id INT DEFAULT NULL COMMENT '供应商ID (关联供应商表)' AFTER customer_id`)
console.log('[init] contracts 表已添加 supplier_id 字段')
} catch (e) {
// 字段已存在则忽略
}
console.log('[init] 数据表初始化完成')
// ============ 2.3 RBAC 权限相关表 ============