mirror of
https://github.com/hotspotbilling/phpnuxbill.git
synced 2025-08-29 14:28:13 +02:00
Add testing utilities and project summary
- Added database connection test script - Created project completion summary - Included quick start guide and documentation
This commit is contained in:
parent
0f192b39af
commit
a3dc0fbeec
2 changed files with 115 additions and 0 deletions
45
test-connection.js
Normal file
45
test-connection.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
import { connectDB } from './src/config/database.js';
|
||||
import { Customer, User, Plan } from './src/models/index.js';
|
||||
|
||||
const testConnection = async () => {
|
||||
try {
|
||||
console.log('🔄 Testing database connection...');
|
||||
|
||||
// Test database connection
|
||||
await connectDB();
|
||||
console.log('✅ Database connection successful');
|
||||
|
||||
// Test models
|
||||
const userCount = await User.count();
|
||||
const customerCount = await Customer.count();
|
||||
const planCount = await Plan.count();
|
||||
|
||||
console.log(`📊 Statistics:`);
|
||||
console.log(` - Users: ${userCount}`);
|
||||
console.log(` - Customers: ${customerCount}`);
|
||||
console.log(` - Plans: ${planCount}`);
|
||||
|
||||
if (userCount === 0) {
|
||||
console.log('⚠️ No users found. Run "npm run migrate" to create sample data.');
|
||||
}
|
||||
|
||||
console.log('✅ All tests passed!');
|
||||
process.exit(0);
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ Test failed:', error.message);
|
||||
|
||||
if (error.name === 'SequelizeConnectionError') {
|
||||
console.error('💡 Database connection failed. Please check:');
|
||||
console.error(' - MySQL server is running');
|
||||
console.error(' - Database credentials in .env file');
|
||||
console.error(' - Database exists');
|
||||
}
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
testConnection();
|
Loading…
Add table
Add a link
Reference in a new issue