This commit is contained in:
Louis Mazin 2025-12-09 19:44:26 +01:00
parent c9b2130ad8
commit c0d5d9848b

View File

@ -50,6 +50,20 @@ const initDatabase = async () => {
)
`);
// Migration: ajouter la colonne lastConnection si elle n'existe pas
await connection.execute(`
PRAGMA table_info(user_links)
`);
const [columns] = await connection.execute(`PRAGMA table_info(user_links)`);
const hasLastConnection = columns.some(col => col.name === 'lastConnection');
if (!hasLastConnection) {
await connection.execute(`ALTER TABLE user_links ADD COLUMN lastConnection TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP`);
console.log('✅ Colonne lastConnection ajoutée');
}
console.log('✅ Tables créées/vérifiées');
} catch (error) {
console.error('❌ Erreur de connexion à la base de données:', error);