32 lines
932 B
TypeScript
32 lines
932 B
TypeScript
import db from '../src/database/models/index.js';
|
|
|
|
async function checkModels() {
|
|
console.log('🔍 Checking model loading...');
|
|
try {
|
|
await db.sequelize.authenticate();
|
|
console.log('✅ Database authentication successful!');
|
|
|
|
const modelsCount = Object.keys(db).filter(k => k !== 'sequelize' && k !== 'Sequelize').length;
|
|
console.log(`📊 Total models loaded: ${modelsCount}`);
|
|
|
|
// Check a few specific models
|
|
const sampleModels = ['User', 'Application', 'Dealer', 'TerminationRequest', 'AuditLog'];
|
|
for (const m of sampleModels) {
|
|
if (db[m]) {
|
|
console.log(`✅ Model ${m} is available`);
|
|
} else {
|
|
console.error(`❌ Model ${m} is MISSING!`);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
console.log('🚀 All checks passed!');
|
|
process.exit(0);
|
|
} catch (error) {
|
|
console.error('❌ Check failed:', error);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
checkModels();
|