'use strict';

module.exports = {
  up: async (queryInterface, Sequelize) => {
    await queryInterface.addColumn('policies', 'policyholder_name', {
      type: Sequelize.STRING,
      allowNull: true,
      comment: '投保人姓名'
    });

    await queryInterface.addColumn('policies', 'insured_name', {
      type: Sequelize.STRING,
      allowNull: true,
      comment: '被保险人姓名'
    });

    await queryInterface.addColumn('policies', 'phone', {
      type: Sequelize.STRING,
      allowNull: true,
      comment: '联系电话'
    });

    await queryInterface.addColumn('policies', 'email', {
      type: Sequelize.STRING,
      allowNull: true,
      comment: '邮箱地址'
    });

    await queryInterface.addColumn('policies', 'address', {
      type: Sequelize.STRING,
      allowNull: true,
      comment: '联系地址'
    });
  },

  down: async (queryInterface, Sequelize) => {
    await queryInterface.removeColumn('policies', 'policyholder_name');
    await queryInterface.removeColumn('policies', 'insured_name');
    await queryInterface.removeColumn('policies', 'phone');
    await queryInterface.removeColumn('policies', 'email');
    await queryInterface.removeColumn('policies', 'address');
  }
};