'use strict';

module.exports = {
  async up(queryInterface, Sequelize) {
    const tableDescription = await queryInterface.describeTable('scrap_reporting');
    if (!tableDescription.batch_number) {
      await queryInterface.addColumn('scrap_reporting', 'batch_number', {
        type: Sequelize.STRING(50),
        allowNull: true,
        comment: 'Batch number for batch-tracked scrap'
      });
    }
  },

  async down(queryInterface) {
    const tableDescription = await queryInterface.describeTable('scrap_reporting');
    if (tableDescription.batch_number) {
      await queryInterface.removeColumn('scrap_reporting', 'batch_number');
    }
  }
};
