Files
jianli-boss/docs/upgrade_jd_file.sql
T
2026-08-31 19:18:05 +08:00

22 lines
1.0 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- ============================================================
-- v1.18 老库升级:job_applications 新增 jd_file 列
-- 背景:超长 JD(> 20000 字符)不再入库,落盘到项目根目录
-- jd_archive/ 文件,库内仅存相对路径,避免触发
-- MySQL max_allowed_packet(1153)。
-- 幂等:可重复执行(已存在该列时跳过)。
-- 执行:docker exec -i jianli-boss-mysql mysql -uroot -p<密码> <数据库名> < docs/upgrade_jd_file.sql
-- ============================================================
SET @col_exists := (
SELECT COUNT(*) FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'job_applications'
AND COLUMN_NAME = 'jd_file'
);
SET @ddl := IF(@col_exists = 0,
'ALTER TABLE job_applications ADD COLUMN jd_file VARCHAR(255) NULL COMMENT ''超长JD归档文件路径(相对项目根目录,如 jd_archive/1_xxx.txt)'' AFTER jd_text',
'SELECT ''jd_file 列已存在,跳过'' AS msg');
PREPARE stmt FROM @ddl;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;