- Raise Traefik read timeout to 1h (compose dev/prod + k3s HelmChartConfig) so admin video uploads up to 200MB no longer 502 mid-upload. - Migration 0029: cascade watch/quiz history on lesson delete and unlink dependent lessons, so removing a lesson or chapter stops 500ing. - Add the Apollo cluster Helm overlay (values-apollo.yaml) for the deployed environment. - k3s Traefik chart config also enables access logs, cross-namespace IngressRoutes, and fixes the Prometheus scrape port. Bump appVersion/product.go/values tags to 0.2.1; chart version 0.2.3.
27 lines
1.5 KiB
SQL
27 lines
1.5 KiB
SQL
-- 0029_lesson_delete_cascades.sql
|
|
-- Make deleting a lesson (directly, or via its chapter) work cleanly.
|
|
--
|
|
-- Previously only mcq_questions cascaded; watch/quiz history blocked the delete
|
|
-- with a 500. Progress/history rows now go away with the lesson, while lessons
|
|
-- that merely *required* the deleted one are unlinked (never deleted).
|
|
|
|
ALTER TABLE watch_sessions DROP CONSTRAINT IF EXISTS watch_sessions_lesson_id_fkey;
|
|
ALTER TABLE watch_sessions ADD CONSTRAINT watch_sessions_lesson_id_fkey
|
|
FOREIGN KEY (lesson_id) REFERENCES lessons(id) ON DELETE CASCADE;
|
|
|
|
ALTER TABLE watch_heartbeats DROP CONSTRAINT IF EXISTS watch_heartbeats_lesson_id_fkey;
|
|
ALTER TABLE watch_heartbeats ADD CONSTRAINT watch_heartbeats_lesson_id_fkey
|
|
FOREIGN KEY (lesson_id) REFERENCES lessons(id) ON DELETE CASCADE;
|
|
|
|
ALTER TABLE lesson_progress DROP CONSTRAINT IF EXISTS lesson_progress_lesson_id_fkey;
|
|
ALTER TABLE lesson_progress ADD CONSTRAINT lesson_progress_lesson_id_fkey
|
|
FOREIGN KEY (lesson_id) REFERENCES lessons(id) ON DELETE CASCADE;
|
|
|
|
ALTER TABLE quiz_attempts DROP CONSTRAINT IF EXISTS quiz_attempts_lesson_id_fkey;
|
|
ALTER TABLE quiz_attempts ADD CONSTRAINT quiz_attempts_lesson_id_fkey
|
|
FOREIGN KEY (lesson_id) REFERENCES lessons(id) ON DELETE CASCADE;
|
|
|
|
ALTER TABLE lessons DROP CONSTRAINT IF EXISTS lessons_requires_lesson_id_fkey;
|
|
ALTER TABLE lessons ADD CONSTRAINT lessons_requires_lesson_id_fkey
|
|
FOREIGN KEY (requires_lesson_id) REFERENCES lessons(id) ON DELETE SET NULL;
|