const Database = require('better-sqlite3');
const path = require('path');

const dbPath = path.join(process.cwd(), 'data', 'fitai.db');
const db = new Database(dbPath);

try {
    console.log('Attempting to add lastVisit column to clients table...');
    db.exec('ALTER TABLE clients ADD COLUMN lastVisit DATETIME');
    console.log('Successfully added lastVisit column.');
} catch (error) {
    if (error.message.includes('duplicate column name')) {
        console.log('Column lastVisit already exists.');
    } else {
        console.error('Error adding column:', error);
    }
}

db.close();
