init
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
-- 添加is_favorite字段到用户单词学习进度表
|
||||
ALTER TABLE ai_user_word_progress
|
||||
ADD COLUMN is_favorite BOOLEAN DEFAULT FALSE COMMENT '是否收藏' AFTER proficiency;
|
||||
|
||||
-- 创建索引以提高查询收藏单词的性能
|
||||
CREATE INDEX idx_is_favorite ON ai_user_word_progress(user_id, is_favorite);
|
||||
25
serve/migrations/add_vocabulary_extended_fields.sql
Normal file
25
serve/migrations/add_vocabulary_extended_fields.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
-- 添加词汇扩展字段
|
||||
-- 为ai_vocabulary表添加同义词、反义词、派生词等字段
|
||||
|
||||
USE ai_english_learning;
|
||||
|
||||
-- 添加扩展字段到词汇表
|
||||
ALTER TABLE ai_vocabulary
|
||||
ADD COLUMN IF NOT EXISTS synonyms JSON COMMENT '同义词列表 ["happy", "joyful"]',
|
||||
ADD COLUMN IF NOT EXISTS antonyms JSON COMMENT '反义词列表 ["sad", "unhappy"]',
|
||||
ADD COLUMN IF NOT EXISTS derivatives JSON COMMENT '派生词列表 [{"word": "happiness", "meaning": "幸福"}]',
|
||||
ADD COLUMN IF NOT EXISTS collocations JSON COMMENT '词组搭配 [{"phrase": "look forward to", "meaning": "期待"}]',
|
||||
ADD COLUMN IF NOT EXISTS word_root TEXT COMMENT '词根信息';
|
||||
|
||||
-- 添加索引
|
||||
ALTER TABLE ai_vocabulary
|
||||
ADD INDEX idx_phonetic_us (phonetic_us(50)),
|
||||
ADD INDEX idx_phonetic_uk (phonetic_uk(50));
|
||||
|
||||
-- 更新现有数据的默认值
|
||||
UPDATE ai_vocabulary
|
||||
SET
|
||||
synonyms = JSON_ARRAY() WHERE synonyms IS NULL,
|
||||
antonyms = JSON_ARRAY() WHERE antonyms IS NULL,
|
||||
derivatives = JSON_ARRAY() WHERE derivatives IS NULL,
|
||||
collocations = JSON_ARRAY() WHERE collocations IS NULL;
|
||||
17
serve/migrations/create_learning_sessions.sql
Normal file
17
serve/migrations/create_learning_sessions.sql
Normal file
@@ -0,0 +1,17 @@
|
||||
-- 创建学习会话表
|
||||
CREATE TABLE IF NOT EXISTS ai_learning_sessions (
|
||||
id BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '会话ID',
|
||||
user_id BIGINT NOT NULL COMMENT '用户ID',
|
||||
book_id VARCHAR(36) NOT NULL COMMENT '词汇书ID',
|
||||
daily_goal INT DEFAULT 20 COMMENT '每日学习目标',
|
||||
new_words_count INT DEFAULT 0 COMMENT '新学单词数',
|
||||
review_count INT DEFAULT 0 COMMENT '复习单词数',
|
||||
mastered_count INT DEFAULT 0 COMMENT '掌握单词数',
|
||||
started_at TIMESTAMP NOT NULL COMMENT '开始时间',
|
||||
completed_at TIMESTAMP NULL COMMENT '完成时间',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
|
||||
INDEX idx_user_book (user_id, book_id),
|
||||
INDEX idx_created_at (created_at)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='学习会话表';
|
||||
19
serve/migrations/create_notifications.sql
Normal file
19
serve/migrations/create_notifications.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
-- 创建通知表
|
||||
CREATE TABLE IF NOT EXISTS `ai_notifications` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '通知ID',
|
||||
`user_id` BIGINT UNSIGNED NOT NULL COMMENT '用户ID',
|
||||
`type` VARCHAR(50) NOT NULL COMMENT '通知类型: system(系统通知), learning(学习提醒), achievement(成就通知)',
|
||||
`title` VARCHAR(255) NOT NULL COMMENT '通知标题',
|
||||
`content` TEXT NOT NULL COMMENT '通知内容',
|
||||
`link` VARCHAR(500) DEFAULT NULL COMMENT '跳转链接',
|
||||
`is_read` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已读: 0-未读, 1-已读',
|
||||
`priority` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '优先级: 0-普通, 1-重要, 2-紧急',
|
||||
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`read_at` TIMESTAMP NULL DEFAULT NULL COMMENT '阅读时间',
|
||||
`deleted_at` TIMESTAMP NULL DEFAULT NULL COMMENT '删除时间',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_user_id` (`user_id`),
|
||||
KEY `idx_is_read` (`is_read`),
|
||||
KEY `idx_created_at` (`created_at`),
|
||||
KEY `idx_type` (`type`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='通知表';
|
||||
121
serve/migrations/create_test_tables.sql
Normal file
121
serve/migrations/create_test_tables.sql
Normal file
@@ -0,0 +1,121 @@
|
||||
-- 创建测试相关表
|
||||
-- Create test-related tables
|
||||
|
||||
-- 测试模板表
|
||||
CREATE TABLE IF NOT EXISTS test_templates (
|
||||
id VARCHAR(36) PRIMARY KEY,
|
||||
title VARCHAR(255) NOT NULL COMMENT '模板标题',
|
||||
description TEXT COMMENT '模板描述',
|
||||
type VARCHAR(50) NOT NULL COMMENT '测试类型: quick, comprehensive, daily, custom',
|
||||
difficulty VARCHAR(50) COMMENT '难度: beginner, intermediate, advanced',
|
||||
duration INT COMMENT '测试时长(秒)',
|
||||
total_questions INT COMMENT '总题目数',
|
||||
passing_score INT COMMENT '及格分数',
|
||||
max_score INT COMMENT '最高分数',
|
||||
question_config JSON COMMENT '题目配置',
|
||||
skill_distribution JSON COMMENT '技能分布',
|
||||
is_active BOOLEAN DEFAULT TRUE COMMENT '是否启用',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
INDEX idx_type (type),
|
||||
INDEX idx_difficulty (difficulty),
|
||||
INDEX idx_is_active (is_active)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='测试模板表';
|
||||
|
||||
-- 测试题目表
|
||||
CREATE TABLE IF NOT EXISTS test_questions (
|
||||
id VARCHAR(36) PRIMARY KEY,
|
||||
template_id VARCHAR(36) NOT NULL COMMENT '模板ID',
|
||||
question_type VARCHAR(50) NOT NULL COMMENT '题目类型: single_choice, multiple_choice, true_false, fill_blank, short_answer',
|
||||
skill_type VARCHAR(50) NOT NULL COMMENT '技能类型: vocabulary, grammar, reading, listening, speaking, writing',
|
||||
difficulty VARCHAR(50) COMMENT '难度',
|
||||
content TEXT NOT NULL COMMENT '题目内容',
|
||||
options JSON COMMENT '选项(JSON数组)',
|
||||
correct_answer TEXT COMMENT '正确答案',
|
||||
explanation TEXT COMMENT '答案解析',
|
||||
points INT DEFAULT 1 COMMENT '分值',
|
||||
order_index INT COMMENT '题目顺序',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
INDEX idx_template_id (template_id),
|
||||
INDEX idx_question_type (question_type),
|
||||
INDEX idx_skill_type (skill_type),
|
||||
INDEX idx_difficulty (difficulty),
|
||||
FOREIGN KEY (template_id) REFERENCES test_templates(id) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='测试题目表';
|
||||
|
||||
-- 测试会话表
|
||||
CREATE TABLE IF NOT EXISTS test_sessions (
|
||||
id VARCHAR(36) PRIMARY KEY,
|
||||
template_id VARCHAR(36) NOT NULL COMMENT '模板ID',
|
||||
user_id VARCHAR(36) NOT NULL COMMENT '用户ID',
|
||||
status VARCHAR(50) NOT NULL DEFAULT 'pending' COMMENT '状态: pending, in_progress, paused, completed, abandoned',
|
||||
start_time TIMESTAMP NULL COMMENT '开始时间',
|
||||
end_time TIMESTAMP NULL COMMENT '结束时间',
|
||||
paused_at TIMESTAMP NULL COMMENT '暂停时间',
|
||||
time_remaining INT COMMENT '剩余时间(秒)',
|
||||
current_question_index INT DEFAULT 0 COMMENT '当前题目索引',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
INDEX idx_template_id (template_id),
|
||||
INDEX idx_user_id (user_id),
|
||||
INDEX idx_status (status),
|
||||
INDEX idx_created_at (created_at),
|
||||
FOREIGN KEY (template_id) REFERENCES test_templates(id) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='测试会话表';
|
||||
|
||||
-- 测试会话题目关联表
|
||||
CREATE TABLE IF NOT EXISTS test_session_questions (
|
||||
session_id VARCHAR(36) NOT NULL COMMENT '会话ID',
|
||||
question_id VARCHAR(36) NOT NULL COMMENT '题目ID',
|
||||
order_index INT COMMENT '题目顺序',
|
||||
PRIMARY KEY (session_id, question_id),
|
||||
INDEX idx_session_id (session_id),
|
||||
INDEX idx_question_id (question_id),
|
||||
FOREIGN KEY (session_id) REFERENCES test_sessions(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (question_id) REFERENCES test_questions(id) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='测试会话题目关联表';
|
||||
|
||||
-- 测试答案表
|
||||
CREATE TABLE IF NOT EXISTS test_answers (
|
||||
id VARCHAR(36) PRIMARY KEY,
|
||||
session_id VARCHAR(36) NOT NULL COMMENT '会话ID',
|
||||
question_id VARCHAR(36) NOT NULL COMMENT '题目ID',
|
||||
answer TEXT COMMENT '用户答案',
|
||||
is_correct BOOLEAN COMMENT '是否正确',
|
||||
score INT DEFAULT 0 COMMENT '得分',
|
||||
time_spent INT COMMENT '答题用时(秒)',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
INDEX idx_session_id (session_id),
|
||||
INDEX idx_question_id (question_id),
|
||||
UNIQUE KEY uk_session_question (session_id, question_id),
|
||||
FOREIGN KEY (session_id) REFERENCES test_sessions(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (question_id) REFERENCES test_questions(id) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='测试答案表';
|
||||
|
||||
-- 测试结果表
|
||||
CREATE TABLE IF NOT EXISTS test_results (
|
||||
id VARCHAR(36) PRIMARY KEY,
|
||||
session_id VARCHAR(36) NOT NULL UNIQUE COMMENT '会话ID',
|
||||
user_id VARCHAR(36) NOT NULL COMMENT '用户ID',
|
||||
template_id VARCHAR(36) NOT NULL COMMENT '模板ID',
|
||||
total_score INT COMMENT '总得分',
|
||||
max_score INT COMMENT '最高分',
|
||||
percentage DECIMAL(5,2) COMMENT '得分百分比',
|
||||
correct_count INT COMMENT '正确题数',
|
||||
wrong_count INT COMMENT '错误题数',
|
||||
skipped_count INT COMMENT '跳过题数',
|
||||
time_spent INT COMMENT '总用时(秒)',
|
||||
skill_scores JSON COMMENT '各技能得分',
|
||||
passed BOOLEAN COMMENT '是否通过',
|
||||
completed_at TIMESTAMP NOT NULL COMMENT '完成时间',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
INDEX idx_session_id (session_id),
|
||||
INDEX idx_user_id (user_id),
|
||||
INDEX idx_template_id (template_id),
|
||||
INDEX idx_completed_at (completed_at),
|
||||
FOREIGN KEY (session_id) REFERENCES test_sessions(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (template_id) REFERENCES test_templates(id) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='测试结果表';
|
||||
23
serve/migrations/create_user_vocabulary_book_progress.sql
Normal file
23
serve/migrations/create_user_vocabulary_book_progress.sql
Normal file
@@ -0,0 +1,23 @@
|
||||
-- 创建用户词汇书学习进度表
|
||||
CREATE TABLE IF NOT EXISTS user_vocabulary_book_progress (
|
||||
id BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '进度ID',
|
||||
user_id BIGINT NOT NULL COMMENT '用户ID',
|
||||
book_id VARCHAR(36) NOT NULL COMMENT '词汇书ID',
|
||||
learned_words INT DEFAULT 0 COMMENT '已学习单词数',
|
||||
mastered_words INT DEFAULT 0 COMMENT '已掌握单词数',
|
||||
progress_percentage DECIMAL(5,2) DEFAULT 0.00 COMMENT '学习进度百分比',
|
||||
streak_days INT DEFAULT 0 COMMENT '连续学习天数',
|
||||
total_study_days INT DEFAULT 0 COMMENT '总学习天数',
|
||||
average_daily_words DECIMAL(5,2) DEFAULT 0.00 COMMENT '平均每日学习单词数',
|
||||
estimated_completion_date TIMESTAMP NULL COMMENT '预计完成时间',
|
||||
is_completed BOOLEAN DEFAULT FALSE COMMENT '是否已完成',
|
||||
completed_at TIMESTAMP NULL COMMENT '完成时间',
|
||||
started_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '开始学习时间',
|
||||
last_studied_at TIMESTAMP NULL COMMENT '最后学习时间',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
|
||||
UNIQUE INDEX idx_user_book (user_id, book_id),
|
||||
INDEX idx_user_id (user_id),
|
||||
INDEX idx_book_id (book_id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户词汇书学习进度表';
|
||||
22
serve/migrations/create_user_word_progress.sql
Normal file
22
serve/migrations/create_user_word_progress.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
-- 创建用户单词学习进度表
|
||||
CREATE TABLE IF NOT EXISTS ai_user_word_progress (
|
||||
id BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '进度ID',
|
||||
user_id BIGINT NOT NULL COMMENT '用户ID',
|
||||
vocabulary_id BIGINT NOT NULL COMMENT '单词ID',
|
||||
status VARCHAR(20) DEFAULT 'not_started' COMMENT '学习状态',
|
||||
study_count INT DEFAULT 0 COMMENT '学习次数',
|
||||
correct_count INT DEFAULT 0 COMMENT '正确次数',
|
||||
wrong_count INT DEFAULT 0 COMMENT '错误次数',
|
||||
proficiency INT DEFAULT 0 COMMENT '熟练度(0-100)',
|
||||
next_review_at TIMESTAMP NULL COMMENT '下次复习时间',
|
||||
review_interval INT DEFAULT 1 COMMENT '复习间隔(天)',
|
||||
first_studied_at TIMESTAMP NOT NULL COMMENT '首次学习时间',
|
||||
last_studied_at TIMESTAMP NOT NULL COMMENT '最后学习时间',
|
||||
mastered_at TIMESTAMP NULL COMMENT '掌握时间',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
|
||||
UNIQUE INDEX idx_user_vocab (user_id, vocabulary_id),
|
||||
INDEX idx_next_review (next_review_at),
|
||||
INDEX idx_status (status)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户单词学习进度表';
|
||||
45
serve/migrations/create_vocabulary_books.sql
Normal file
45
serve/migrations/create_vocabulary_books.sql
Normal file
@@ -0,0 +1,45 @@
|
||||
-- 创建词汇书表
|
||||
CREATE TABLE IF NOT EXISTS `ai_vocabulary_books` (
|
||||
`id` VARCHAR(36) NOT NULL COMMENT '词汇书ID',
|
||||
`name` VARCHAR(200) NOT NULL COMMENT '词汇书名称',
|
||||
`description` TEXT COMMENT '词汇书描述',
|
||||
`category` VARCHAR(100) NOT NULL COMMENT '分类',
|
||||
`level` ENUM('beginner','elementary','intermediate','advanced','expert') NOT NULL COMMENT '难度级别',
|
||||
`total_words` INT DEFAULT 0 COMMENT '总单词数',
|
||||
`cover_image` VARCHAR(500) COMMENT '封面图片URL',
|
||||
`icon` VARCHAR(255) COMMENT '图标',
|
||||
`color` VARCHAR(7) COMMENT '主题色',
|
||||
`is_system` BOOLEAN DEFAULT TRUE COMMENT '是否系统词汇书',
|
||||
`is_active` BOOLEAN DEFAULT TRUE COMMENT '是否启用',
|
||||
`sort_order` INT DEFAULT 0 COMMENT '排序',
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_category` (`category`),
|
||||
KEY `idx_level` (`level`),
|
||||
KEY `idx_is_system` (`is_system`, `is_active`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='词汇书表';
|
||||
|
||||
-- 创建词汇书单词关联表
|
||||
CREATE TABLE IF NOT EXISTS `ai_vocabulary_book_words` (
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '关联ID',
|
||||
`book_id` VARCHAR(36) NOT NULL COMMENT '词汇书ID',
|
||||
`vocabulary_id` VARCHAR(36) NOT NULL COMMENT '词汇ID',
|
||||
`sort_order` INT DEFAULT 0 COMMENT '排序',
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_book_vocabulary` (`book_id`, `vocabulary_id`),
|
||||
KEY `idx_book_id` (`book_id`),
|
||||
KEY `idx_vocabulary_id` (`vocabulary_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='词汇书单词关联表';
|
||||
|
||||
-- 插入系统词汇书数据
|
||||
INSERT INTO `ai_vocabulary_books` (`id`, `name`, `description`, `category`, `level`, `total_words`, `icon`, `color`, `is_system`, `is_active`, `sort_order`) VALUES
|
||||
('cet4_core_2500', '大学英语四级核心词汇', '涵盖CET-4考试核心词汇2500个', 'CET-4核心词汇', 'intermediate', 2500, '📚', '#4CAF50', TRUE, TRUE, 1),
|
||||
('cet6_core_3000', '大学英语六级核心词汇', '涵盖CET-6考试核心词汇3000个', 'CET-6核心词汇', 'advanced', 3000, '📖', '#2196F3', TRUE, TRUE, 2),
|
||||
('toefl_high_3500', '托福高频词汇', '托福考试高频词汇3500个', 'TOEFL高频词汇', 'advanced', 3500, '🎓', '#FF9800', TRUE, TRUE, 3),
|
||||
('ielts_high_3500', '雅思高频词汇', '雅思考试高频词汇3500个', 'IELTS高频词汇', 'advanced', 3500, '🌟', '#9C27B0', TRUE, TRUE, 4),
|
||||
('primary_core_1000', '小学英语核心词汇', '小学阶段必备核心词汇1000个', '小学核心词汇', 'beginner', 1000, '🎈', '#E91E63', TRUE, TRUE, 5),
|
||||
('junior_core_1500', '初中英语核心词汇', '初中阶段必备核心词汇1500个', '初中核心词汇', 'elementary', 1500, '📝', '#00BCD4', TRUE, TRUE, 6),
|
||||
('senior_core_3500', '高中英语核心词汇', '高中阶段必备核心词汇3500个', '高中核心词汇', 'intermediate', 3500, '📕', '#FF5722', TRUE, TRUE, 7),
|
||||
('business_core_1000', '商务英语核心词汇', '商务场景常用核心词汇1000个', '商务英语', 'intermediate', 1000, '💼', '#607D8B', TRUE, TRUE, 8);
|
||||
44
serve/migrations/fix_all_vocabulary_books_sort_order.sql
Normal file
44
serve/migrations/fix_all_vocabulary_books_sort_order.sql
Normal file
@@ -0,0 +1,44 @@
|
||||
-- Fix all vocabulary books sort order
|
||||
|
||||
-- Learning Stage (1-39): Elementary to Advanced
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 1 WHERE `id` = 'primary_core_1000';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 2 WHERE `id` = 'junior_high_1500';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 3 WHERE `id` = 'junior_core_1500';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 4 WHERE `id` = 'senior_high_3500';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 5 WHERE `id` = 'senior_core_3500';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 6 WHERE `id` = 'college_textbook';
|
||||
|
||||
-- Domestic Tests (40-59)
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 40 WHERE `id` = 'cet4_core_2500';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 41 WHERE `id` = 'cet6_core_3000';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 42 WHERE `id` = 'postgraduate_vocabulary';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 43 WHERE `id` = 'tem4_vocabulary';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 44 WHERE `id` = 'tem8_vocabulary';
|
||||
|
||||
-- International Tests (60-79)
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 60 WHERE `id` = 'toefl_high_3500';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 61 WHERE `id` = 'ielts_high_3500';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 62 WHERE `id` = 'ielts_general';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 63 WHERE `id` = 'toeic_vocabulary';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 64 WHERE `id` = 'gre_vocabulary';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 65 WHERE `id` = 'gmat_vocabulary';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 66 WHERE `id` = 'sat_vocabulary';
|
||||
|
||||
-- Professional & Business (80-99)
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 80 WHERE `id` = 'business_core_1000';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 81 WHERE `id` = 'bec_preliminary';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 82 WHERE `id` = 'bec_vantage';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 83 WHERE `id` = 'bec_higher';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 84 WHERE `id` = 'mba_finance';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 85 WHERE `id` = 'medical_english';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 86 WHERE `id` = 'legal_english';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 87 WHERE `id` = 'it_engineering';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 88 WHERE `id` = 'academic_english';
|
||||
|
||||
-- Functional (100-119)
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 100 WHERE `id` = 'word_roots_affixes';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 101 WHERE `id` = 'synonyms_antonyms';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 102 WHERE `id` = 'daily_spoken_collocations';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 103 WHERE `id` = 'academic_spoken_collocations';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 104 WHERE `id` = 'academic_writing_collocations';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 105 WHERE `id` = 'daily_life_english';
|
||||
10
serve/migrations/update_vocabulary_books_sort_order.sql
Normal file
10
serve/migrations/update_vocabulary_books_sort_order.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
-- Update vocabulary books sort order by learning stage and difficulty level
|
||||
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 10 WHERE `id` = 'primary_core_1000';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 20 WHERE `id` = 'junior_core_1500';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 30 WHERE `id` = 'senior_core_3500';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 40 WHERE `id` = 'cet4_core_2500';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 50 WHERE `id` = 'cet6_core_3000';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 60 WHERE `id` = 'toefl_high_3500';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 70 WHERE `id` = 'ielts_high_3500';
|
||||
UPDATE `ai_vocabulary_books` SET `sort_order` = 80 WHERE `id` = 'business_core_1000';
|
||||
Reference in New Issue
Block a user