
import sqlite3 from 'sqlite3';
import path from 'path';

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

db.run("ALTER TABLE users ADD COLUMN password TEXT", (err) => {
    if (err) {
        if (err.message.includes("duplicate column name")) {
            console.log("Column 'password' already exists.");
        } else {
            console.error("Error adding column:", err.message);
            process.exit(1);
        }
    } else {
        console.log("Successfully added 'password' column to users table.");
    }
    db.close();
});
