xykj-plus/xykj-admin-plus/script/sql/update/update_candidate_table.sql
2026-06-13 13:48:51 +08:00

57 lines
2.4 KiB
SQL

-- ----------------------------
-- 候选人表结构更新脚本
-- 说明:此脚本用于为候选人表添加缺失字段
-- 请根据实际情况谨慎执行,建议先备份数据
-- ----------------------------
-- ----------------------------
-- 第一步:备份原有数据(可选,建议执行)
-- ----------------------------
-- create table biz_candidate_backup as select * from biz_candidate;
-- ----------------------------
-- 第二步:添加缺失字段
-- ----------------------------
-- 沟通日期
alter table biz_candidate add column communication_date date default null comment '沟通日期' after email;
-- 项目组
alter table biz_candidate add column project_group varchar(100) default null comment '项目组' after communication_date;
-- 统招是否
alter table biz_candidate add column is_unified_recruitment char(1) default null comment '统招是否(0否 1是)' after education;
-- 专业
alter table biz_candidate add column major varchar(100) default null comment '专业' after is_unified_recruitment;
-- 是否愿意外派
alter table biz_candidate add column willing_to_outsource char(1) default null comment '是否愿意外派(0否 1是)' after remark;
-- 是否在职
alter table biz_candidate add column is_employed char(1) default null comment '是否在职(0否 1是)' after willing_to_outsource;
-- 离职周期多久
alter table biz_candidate add column resignation_cycle varchar(50) default null comment '离职周期多久' after is_employed;
-- 什么时候方便面试
alter table biz_candidate add column interview_availability varchar(200) default null comment '什么时候方便面试' after resignation_cycle;
-- 候选人住哪里
alter table biz_candidate add column residence_location varchar(200) default null comment '候选人住哪里' after interview_availability;
-- 是否加微信
alter table biz_candidate add column wechat_added char(1) default null comment '是否加微信(0否 1是)' after residence_location;
-- ----------------------------
-- 第三步:添加唯一约束
-- ----------------------------
-- 删除可能存在的旧索引
drop index uk_name on biz_candidate;
drop index uk_phone_number on biz_candidate;
-- 创建唯一索引:姓名唯一
create unique index uk_name on biz_candidate(name);
-- 创建唯一索引:手机号码唯一
create unique index uk_phone_number on biz_candidate(phone_number);