Update Saqel Platform: 2026-09-02 00:55:56
This commit is contained in:
@@ -226,7 +226,11 @@ CREATE TABLE IF NOT EXISTS `lessons` (
|
||||
|
||||
-- المعلم الحقيقي (Teacher Video)
|
||||
`video_uuid` VARCHAR(64) DEFAULT NULL,
|
||||
`storage_type` ENUM('bunny_stream', 'api_upload', 'external_url') NOT NULL DEFAULT 'bunny_stream',
|
||||
`local_path` VARCHAR(500) DEFAULT NULL,
|
||||
`hls_url` VARCHAR(500) DEFAULT NULL,
|
||||
`thumbnail_url` VARCHAR(500) DEFAULT NULL,
|
||||
`encoding_status` ENUM('pending', 'processing', 'ready', 'failed') NOT NULL DEFAULT 'ready',
|
||||
`timeline_chapters_json` JSON DEFAULT NULL,
|
||||
`bunny_video_id` VARCHAR(100) DEFAULT NULL,
|
||||
`duration_seconds` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
@@ -249,6 +253,46 @@ CREATE TABLE IF NOT EXISTS `lessons` (
|
||||
CONSTRAINT `fk_lessons_course` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- ------------------------------------------------------------------------------
|
||||
-- 10.6. Table: lesson_progress (تقدم المشاهدة الفعلي لكل طالب)
|
||||
-- ------------------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `lesson_progress` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`student_id` BIGINT UNSIGNED NOT NULL,
|
||||
`lesson_id` BIGINT UNSIGNED NOT NULL,
|
||||
`position_seconds` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`watched_seconds` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`completion_percentage` DECIMAL(5,2) NOT NULL DEFAULT 0.00,
|
||||
`is_completed` TINYINT(1) NOT NULL DEFAULT 0,
|
||||
`last_seen_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`completed_at` TIMESTAMP NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `idx_progress_student_lesson` (`student_id`, `lesson_id`),
|
||||
KEY `idx_progress_lesson` (`lesson_id`),
|
||||
CONSTRAINT `fk_progress_student` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_progress_lesson` FOREIGN KEY (`lesson_id`) REFERENCES `lessons` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- ------------------------------------------------------------------------------
|
||||
-- 10.7. Table: student_mastery_analytics (المؤشر التراكمي للطالب)
|
||||
-- ------------------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `student_mastery_analytics` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`student_id` BIGINT UNSIGNED NOT NULL,
|
||||
`course_id` BIGINT UNSIGNED NOT NULL,
|
||||
`subject_id` BIGINT UNSIGNED NOT NULL,
|
||||
`mastery_percentage` DECIMAL(5,2) NOT NULL DEFAULT 0.00,
|
||||
`tawjihi_readiness_score` DECIMAL(5,2) NOT NULL DEFAULT 0.00,
|
||||
`exams_passed_count` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`exams_total_count` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`updated_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `idx_mastery_student_course` (`student_id`, `course_id`),
|
||||
CONSTRAINT `fk_mastery_student` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_mastery_course` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_mastery_subject` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- ------------------------------------------------------------------------------
|
||||
-- 10.5. Table: lesson_resources (المصادر المرفقة للدرس: كتب، ملخصات، أوراق عمل PDF)
|
||||
-- ------------------------------------------------------------------------------
|
||||
@@ -361,6 +405,7 @@ CREATE TABLE IF NOT EXISTS `exam_attempts` (
|
||||
`time_spent_seconds` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`weak_topics_json` JSON DEFAULT NULL,
|
||||
`ai_diagnostic_report` TEXT DEFAULT NULL,
|
||||
`completed_at` TIMESTAMP NULL DEFAULT NULL,
|
||||
`created_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_attempts_student` (`student_id`),
|
||||
@@ -369,6 +414,25 @@ CREATE TABLE IF NOT EXISTS `exam_attempts` (
|
||||
CONSTRAINT `fk_attempts_exam` FOREIGN KEY (`exam_id`) REFERENCES `exams` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- ------------------------------------------------------------------------------
|
||||
-- 15.5. Table: student_question_answers (تفاصيل إجابات الطالب)
|
||||
-- ------------------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `student_question_answers` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`attempt_id` BIGINT UNSIGNED NOT NULL,
|
||||
`student_id` BIGINT UNSIGNED NOT NULL,
|
||||
`question_id` BIGINT UNSIGNED NOT NULL,
|
||||
`selected_option_id` BIGINT UNSIGNED DEFAULT NULL,
|
||||
`is_correct` TINYINT(1) NOT NULL DEFAULT 0,
|
||||
`points_awarded` DECIMAL(6,2) NOT NULL DEFAULT 0.00,
|
||||
`time_spent_seconds` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_sqa_attempt` (`attempt_id`),
|
||||
CONSTRAINT `fk_sqa_attempt` FOREIGN KEY (`attempt_id`) REFERENCES `exam_attempts` (`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_sqa_student` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_sqa_question` FOREIGN KEY (`question_id`) REFERENCES `questions` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- ------------------------------------------------------------------------------
|
||||
-- 16. Table: teacher_reviews (تقييمات الطلاب المحصنة بالأوزان وخاصية كشف الكيد)
|
||||
-- ------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user