Files
yunhaifinance/backend/check-customer-table.js
T

31 lines
832 B
JavaScript

const sqlite3 = require('sqlite3').verbose();
const path = require('path');
// 创建SQLite数据库连接
const dbPath = path.join(__dirname, 'company_finance.db');
const db = new sqlite3.Database(dbPath, (err) => {
if (err) {
console.error('数据库连接失败:', err.message);
} else {
console.log('SQLite数据库连接成功');
checkCustomerTable();
}
});
// 检查customers表结构
function checkCustomerTable() {
console.log('开始检查customers表结构...');
// 检查customers表结构
db.all('PRAGMA table_info(customers)', (err, rows) => {
if (err) {
console.error('检查customers表结构失败:', err.message);
} else {
console.log('customers表结构:');
rows.forEach(row => {
console.log(row.name + ' (' + row.type + ')');
});
}
});
}