'use strict';

module.exports = {
  async up(queryInterface, Sequelize) {
    await queryInterface.addColumn('purchase_order_item', 'cgst_rate', {
      type: Sequelize.DECIMAL(5, 2),
      allowNull: false,
      defaultValue: 0.00,
      comment: 'CGST rate in percentage'
    });

    await queryInterface.addColumn('purchase_order_item', 'cgst_amount', {
      type: Sequelize.DECIMAL(18, 2),
      allowNull: false,
      defaultValue: 0.00,
      comment: 'CGST amount'
    });

    await queryInterface.addColumn('purchase_order_item', 'sgst_rate', {
      type: Sequelize.DECIMAL(5, 2),
      allowNull: false,
      defaultValue: 0.00,
      comment: 'SGST rate in percentage'
    });

    await queryInterface.addColumn('purchase_order_item', 'sgst_amount', {
      type: Sequelize.DECIMAL(18, 2),
      allowNull: false,
      defaultValue: 0.00,
      comment: 'SGST amount'
    });

    await queryInterface.addColumn('purchase_order_item', 'igst_rate', {
      type: Sequelize.DECIMAL(5, 2),
      allowNull: false,
      defaultValue: 0.00,
      comment: 'IGST rate in percentage'
    });

    await queryInterface.addColumn('purchase_order_item', 'igst_amount', {
      type: Sequelize.DECIMAL(18, 2),
      allowNull: false,
      defaultValue: 0.00,
      comment: 'IGST amount'
    });
  },

  async down(queryInterface, Sequelize) {
    await queryInterface.removeColumn('purchase_order_item', 'cgst_rate');
    await queryInterface.removeColumn('purchase_order_item', 'cgst_amount');
    await queryInterface.removeColumn('purchase_order_item', 'sgst_rate');
    await queryInterface.removeColumn('purchase_order_item', 'sgst_amount');
    await queryInterface.removeColumn('purchase_order_item', 'igst_rate');
    await queryInterface.removeColumn('purchase_order_item', 'igst_amount');
  }
};

