'use strict';

module.exports = {
  async up(queryInterface, Sequelize) {
    // Modify the ENUM to include RELEASED status
    await queryInterface.sequelize.query(`
      ALTER TABLE sales_order 
      MODIFY COLUMN status ENUM(
        'DRAFT', 
        'SUBMITTED', 
        'APPROVED', 
        'RELEASED',
        'REJECTED', 
        'PARTIALLY_DELIVERED', 
        'DELIVERED', 
        'CLOSED'
      ) NOT NULL DEFAULT 'DRAFT'
    `);
  },

  async down(queryInterface, Sequelize) {
    // Revert back to original ENUM (without RELEASED)
    await queryInterface.sequelize.query(`
      ALTER TABLE sales_order 
      MODIFY COLUMN status ENUM(
        'DRAFT', 
        'SUBMITTED', 
        'APPROVED', 
        'REJECTED', 
        'PARTIALLY_DELIVERED', 
        'DELIVERED', 
        'CLOSED'
      ) NOT NULL DEFAULT 'DRAFT'
    `);
  }
};

