const db = require('../db');

const addIsStudentColumn = async () => {
    try {
        console.log('Adding is_student column to users table...');
        await db.query(`ALTER TABLE users ADD COLUMN is_student BOOLEAN DEFAULT FALSE`);
        console.log('Success: is_student column added.');
        process.exit(0);
    } catch (error) {
        if (error.code === 'ER_DUP_FIELDNAME' || error.message.includes('Duplicate column')) {
            console.log('Column is_student already exists.');
            process.exit(0);
        }
        console.error('Error adding column:', error);
        process.exit(1);
    }
};

addIsStudentColumn();
