'use strict';

module.exports = {
  async up(queryInterface, Sequelize) {
    const table = 'production_qc';
    const cols = await queryInterface.describeTable(table);

    if (!cols.production_qc_number) {
      await queryInterface.addColumn(table, 'production_qc_number', {
        type: Sequelize.STRING(50),
        allowNull: true,
        unique: true,
        after: 'route_card_operation_id'
      });
    }
  },

  async down(queryInterface) {
    const table = 'production_qc';
    const cols = await queryInterface.describeTable(table);
    if (cols.production_qc_number) {
      await queryInterface.removeColumn(table, 'production_qc_number');
    }
  }
};
