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

const addStudentDomainsTable = async () => {
    try {
        console.log('Creating student_domains table...');
        await db.query(`
            CREATE TABLE IF NOT EXISTS student_domains (
                id INT AUTO_INCREMENT PRIMARY KEY,
                domain VARCHAR(255) UNIQUE NOT NULL,
                added_by INT DEFAULT NULL,
                created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
            )
        `);
        console.log('Success: student_domains table created.');
        process.exit(0);
    } catch (error) {
        console.error('Error creating table:', error);
        process.exit(1);
    }
};

addStudentDomainsTable();
