'use strict';

/**
 * Migration: Add service_type field to service table
 * This field is used to determine which appointment form to navigate to
 */
module.exports = {
  up: async (queryInterface, Sequelize) => {
    const tableInfo = await queryInterface.describeTable('service');
    
    if (!tableInfo.service_type) {
      await queryInterface.addColumn('service', 'service_type', {
        type: Sequelize.STRING(50),
        allowNull: true,
        comment: '服务具体类型，用于跳转对应预约表单'
      });
      
      console.log('Added service_type column to service table');
    } else {
      console.log('service_type column already exists');
    }
  },

  down: async (queryInterface, Sequelize) => {
    await queryInterface.removeColumn('service', 'service_type');
  }
};
