
const db = require('../src/db');
const dotenv = require('dotenv');
dotenv.config();

async function fixColumn() {
    try {
        console.log('Adding awarded_at column...');
        await db.query("ALTER TABLE user_badges ADD COLUMN awarded_at DATETIME DEFAULT CURRENT_TIMESTAMP");
        console.log('Column added.');
        process.exit(0);
    } catch (error) {
        // If column exists, it will error, which is fine
        console.error('Error adding column (may already exist):', error.message);
        process.exit(1);
    }
}

fixColumn();
