备份:修复前完整项目快照 2026-04-19
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
const db = require('./backend/db-sqlite');
|
||||
async function fix() {
|
||||
// Drop old new table if exists
|
||||
try { await db.query('DROP TABLE IF EXISTS payment_plans_new'); } catch(e) {}
|
||||
|
||||
// Just drop and recreate payment_plans with all correct columns
|
||||
try {
|
||||
await db.query('DROP TABLE IF EXISTS payment_plans');
|
||||
console.log('Dropped payment_plans');
|
||||
} catch(e) { console.log('Drop err:', e.message); }
|
||||
|
||||
try {
|
||||
await db.query(`CREATE TABLE payment_plans (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
purchase_order_id INTEGER DEFAULT 0,
|
||||
code TEXT DEFAULT '',
|
||||
name TEXT DEFAULT '',
|
||||
stage TEXT DEFAULT '',
|
||||
planned_date TEXT DEFAULT '',
|
||||
planned_amount REAL DEFAULT 0,
|
||||
planned_percentage REAL DEFAULT 0,
|
||||
actual_amount REAL DEFAULT 0,
|
||||
actual_date TEXT DEFAULT '',
|
||||
amount REAL DEFAULT 0,
|
||||
payee TEXT DEFAULT '',
|
||||
payer TEXT DEFAULT '',
|
||||
status TEXT DEFAULT 'pending',
|
||||
description TEXT DEFAULT '',
|
||||
remark TEXT DEFAULT '',
|
||||
currency TEXT DEFAULT 'CNY',
|
||||
payment_request_id INTEGER DEFAULT 0,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
)`);
|
||||
console.log('✅ payment_plans recreated with all defaults');
|
||||
} catch(e) { console.log('Create err:', e.message); }
|
||||
|
||||
process.exit();
|
||||
}
|
||||
fix();
|
||||
Reference in New Issue
Block a user