const mysql = require('mysql2/promise');

(async () => {
  try {
    const connection = await mysql.createConnection({
      host: 'metro.proxy.rlwy.net', // adapte avec ton host Railway
      port: 37172,                               // ton port Railway
      user: 'root',                              // ton user
      password: 'qwOJFDBiNeIdboVNkClQymbgUJtNjdpE',                       // ton mot de passe
      database: 'railway',                       // nom DB Railway
      ssl: {
        rejectUnauthorized: false
      }
    });

    console.log('✅ Connexion réussie !');
    const [rows] = await connection.query('SELECT NOW() as now;');
    console.log('Heure serveur :', rows[0].now);

    await connection.end();
  } catch (err) {
    console.error('❌ Erreur connexion :', err.message);
  }
})();
