test
This commit is contained in:
parent
c9b2130ad8
commit
c0d5d9848b
14
database.js
14
database.js
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user