import { MikroORM } from '@mikro-orm/core';
import config from '../../mikro-orm.config';

async function testConnection() {
    console.log('Initializing database connection...');
    const orm = await MikroORM.init(config);
    
    try {
        console.log('Connection successful!');
        console.log('Database name:', orm.config.get('dbName'));
        console.log('Host:', orm.config.get('host'));
        console.log('Port:', orm.config.get('port'));
    } catch (error) {
        console.error('Connection failed:', error);
    } finally {
        await orm.close();
        console.log('Connection closed');
    }
}

testConnection().catch(error => {
    console.error('Test failed:', error);
    process.exit(1);
}); 