Files
nxxmdata/bank-backend/check-data.js

33 lines
759 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const { sequelize } = require('./config/database');
async function checkData() {
try {
console.log('检查各表数据统计...\n');
const tables = [
'supervision_tasks',
'projects',
'installation_tasks',
'completed_supervisions',
'loan_applications',
'loan_contracts'
];
for (const table of tables) {
const result = await sequelize.query(
`SELECT COUNT(*) as count FROM ${table}`,
{ type: sequelize.QueryTypes.SELECT }
);
console.log(`${table}: ${result[0].count} 条记录`);
}
console.log('\n检查完成');
} catch (error) {
console.error('错误:', error.message);
} finally {
await sequelize.close();
}
}
checkData();