Files
life-echo/api/migrations_legacy/fix_chapter_order_index.sql

16 lines
1.1 KiB
MySQL
Raw Normal View History

-- 修复章节 order_index 为 999 的问题
-- 原因STAGE_KEYWORDS 使用简化阶段名career, belief
-- 但 CHAPTER_ORDER 使用详细分类名career_early, beliefs导致查找失败回退到 999
-- 根据 category 字段修复 order_index
UPDATE chapters SET order_index = 0 WHERE order_index = 999 AND category = 'childhood';
UPDATE chapters SET order_index = 1 WHERE order_index = 999 AND category = 'education';
UPDATE chapters SET order_index = 2 WHERE order_index = 999 AND category = 'career';
UPDATE chapters SET order_index = 2 WHERE order_index = 999 AND category = 'career_early';
UPDATE chapters SET order_index = 3 WHERE order_index = 999 AND category = 'career_achievement';
UPDATE chapters SET order_index = 4 WHERE order_index = 999 AND category = 'career_challenge';
UPDATE chapters SET order_index = 5 WHERE order_index = 999 AND category = 'family';
UPDATE chapters SET order_index = 6 WHERE order_index = 999 AND category = 'belief';
UPDATE chapters SET order_index = 6 WHERE order_index = 999 AND category = 'beliefs';
UPDATE chapters SET order_index = 7 WHERE order_index = 999 AND category = 'summary';