feat: add employee fields (birthDate, education, residence) + emergency contacts

This commit is contained in:
pray4skylark
2026-06-02 18:11:05 +09:00
parent 65a82db0e0
commit d205a447a1
12 changed files with 747 additions and 112 deletions
@@ -0,0 +1,41 @@
ALTER TABLE tb_employee ADD COLUMN birth_date DATE;
ALTER TABLE tb_employee ADD COLUMN education VARCHAR(20);
ALTER TABLE tb_employee ADD COLUMN major VARCHAR(100);
ALTER TABLE tb_employee ADD COLUMN graduation_date DATE;
ALTER TABLE tb_employee ADD COLUMN residence VARCHAR(255);
CREATE SEQUENCE sq_employee_emergency_contacts INCREMENT BY 50;
CREATE TABLE tb_employee_emergency_contact (
id BIGSERIAL PRIMARY KEY,
emp_id BIGINT NOT NULL REFERENCES tb_employee(id),
name VARCHAR(100) NOT NULL,
relation VARCHAR(50),
phone VARCHAR(20),
sort_order INTEGER DEFAULT 0,
created_at TIMESTAMP,
updated_at TIMESTAMP,
is_deleted CHAR(1) DEFAULT 'N'
);
CREATE INDEX idx_emergency_contact_emp_id ON tb_employee_emergency_contact(emp_id);
INSERT INTO tb_common_code (id, group_code, code_value, code_name, sort_order, is_active, created_at, updated_at)
SELECT nextval('sq_common_codes'), 'EDUCATION_LEVEL', 'HIGH_SCHOOL', '고졸', 1, 'Y', NOW(), NOW()
WHERE NOT EXISTS (SELECT 1 FROM tb_common_code WHERE group_code = 'EDUCATION_LEVEL' AND code_value = 'HIGH_SCHOOL');
INSERT INTO tb_common_code (id, group_code, code_value, code_name, sort_order, is_active, created_at, updated_at)
SELECT nextval('sq_common_codes'), 'EDUCATION_LEVEL', 'COLLEGE', '전문대', 2, 'Y', NOW(), NOW()
WHERE NOT EXISTS (SELECT 1 FROM tb_common_code WHERE group_code = 'EDUCATION_LEVEL' AND code_value = 'COLLEGE');
INSERT INTO tb_common_code (id, group_code, code_value, code_name, sort_order, is_active, created_at, updated_at)
SELECT nextval('sq_common_codes'), 'EDUCATION_LEVEL', 'BACHELOR', '학사', 3, 'Y', NOW(), NOW()
WHERE NOT EXISTS (SELECT 1 FROM tb_common_code WHERE group_code = 'EDUCATION_LEVEL' AND code_value = 'BACHELOR');
INSERT INTO tb_common_code (id, group_code, code_value, code_name, sort_order, is_active, created_at, updated_at)
SELECT nextval('sq_common_codes'), 'EDUCATION_LEVEL', 'MASTER', '석사', 4, 'Y', NOW(), NOW()
WHERE NOT EXISTS (SELECT 1 FROM tb_common_code WHERE group_code = 'EDUCATION_LEVEL' AND code_value = 'MASTER');
INSERT INTO tb_common_code (id, group_code, code_value, code_name, sort_order, is_active, created_at, updated_at)
SELECT nextval('sq_common_codes'), 'EDUCATION_LEVEL', 'DOCTOR', '박사', 5, 'Y', NOW(), NOW()
WHERE NOT EXISTS (SELECT 1 FROM tb_common_code WHERE group_code = 'EDUCATION_LEVEL' AND code_value = 'DOCTOR');