'use strict';

module.exports = {
  async up(queryInterface, Sequelize) {
    await queryInterface.addColumn('bom_header', 'drawing_number', {
      type: Sequelize.STRING(100),
      allowNull: true,
      comment: 'Drawing number for the assembly (e.g., RCAB00958R4-01-01)'
    });

    await queryInterface.addColumn('bom_header', 'revision_number', {
      type: Sequelize.STRING(20),
      allowNull: true,
      comment: 'Revision number for the BOM (e.g., REV 04)'
    });

    await queryInterface.addIndex('bom_header', ['drawing_number'], {
      name: 'idx_bom_header_drawing_number'
    });
  },

  async down(queryInterface, Sequelize) {
    await queryInterface.removeIndex('bom_header', 'idx_bom_header_drawing_number');
    await queryInterface.removeColumn('bom_header', 'revision_number');
    await queryInterface.removeColumn('bom_header', 'drawing_number');
  }
};

