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