import { sequelize } from '../src/models/index.js';

async function migrate() {
  try {
    await sequelize.query('ALTER TABLE job_tasks ADD COLUMN sub_tasks JSON DEFAULT NULL AFTER status;');
    console.log('Migration successful: sub_tasks column added.');
  } catch (err) {
    if (err.message.includes('Duplicate column name')) {
      console.log('Column sub_tasks already exists.');
    } else {
      console.error('Migration failed:', err);
    }
  } finally {
    process.exit();
  }
}

migrate();
