import type { QueryInterface } from 'sequelize';
import { DataTypes } from 'sequelize';

module.exports = {
  up: async (queryInterface: QueryInterface) => {
    await queryInterface.addColumn('form_16_credit_notes', 'trns_uniq_no', {
      type: DataTypes.STRING(120),
      allowNull: true,
    });
    await queryInterface.addColumn('form_16_debit_notes', 'trns_uniq_no', {
      type: DataTypes.STRING(120),
      allowNull: true,
    });

    await queryInterface.addIndex('form_16_credit_notes', ['trns_uniq_no'], { name: 'idx_form16_credit_notes_trns_uniq_no' });
    await queryInterface.addIndex('form_16_debit_notes', ['trns_uniq_no'], { name: 'idx_form16_debit_notes_trns_uniq_no' });
  },

  down: async (queryInterface: QueryInterface) => {
    await queryInterface.removeIndex('form_16_debit_notes', 'idx_form16_debit_notes_trns_uniq_no');
    await queryInterface.removeIndex('form_16_credit_notes', 'idx_form16_credit_notes_trns_uniq_no');
    await queryInterface.removeColumn('form_16_debit_notes', 'trns_uniq_no');
    await queryInterface.removeColumn('form_16_credit_notes', 'trns_uniq_no');
  },
};

