'use strict';

module.exports = {
  async up(queryInterface, Sequelize) {
    const table = await queryInterface.describeTable('route_card');
    if (!Object.prototype.hasOwnProperty.call(table, 'raw_material_process_switches')) {
      await queryInterface.addColumn('route_card', 'raw_material_process_switches', {
        type: Sequelize.JSON,
        allowNull: true
      });
    }
  },

  async down(queryInterface) {
    const table = await queryInterface.describeTable('route_card');
    if (Object.prototype.hasOwnProperty.call(table, 'raw_material_process_switches')) {
      await queryInterface.removeColumn('route_card', 'raw_material_process_switches');
    }
  }
};

