const mysql = require('mysql2/promise');
const fs = require('fs');

async function runSQL() {
  try {
    const connection = await mysql.createConnection({
      host: 'localhost',
      user: 'root',
      password: '', // Add password if needed
      database: 'cms_db'
    });

    const sql = fs.readFileSync('./database/designations.sql', 'utf8');
    await connection.execute(sql);
    
    console.log('✅ Designations table created successfully!');
    await connection.end();
  } catch (error) {
    console.error('❌ Error creating designations table:', error);
  }
}

runSQL();
