'use strict';
const { defaultKeys, migrationDefaults, relationShip } = require('../sequelize/defaults');
/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up(queryInterface, Sequelize) {
    await queryInterface.createTable('designation', {
      ...defaultKeys("designation_id"),
      tbl_ref_id: {
        type: Sequelize.STRING,
        allowNull: true,
      },
      branch_id: relationShip({
        modelName: "branches",
        key: "branch_id",
        allowNull: false,
      }),
      designation_name: {
        type: Sequelize.STRING,
        allowNull: false,
      },
      designation_descp: {
        type: Sequelize.STRING,
        allowNull: true,
      },
      active_status: {
        type: Sequelize.BOOLEAN,
        allowNull: false,
        defaultValue: 1,
      },
      // ...migrationDefaults({withUser : false}),
      ...migrationDefaults(),
    });
  },
  async down(queryInterface, Sequelize) {
    await queryInterface.dropTable('designation');
  }
};