fix: make exercise goal and execution optional (at least one required)
Some checks failed
Deploy Development / deploy (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m54s

Error: 224/225 exercises failed with NOT NULL constraint violations
Root cause: exercises table requires BOTH goal AND execution (NOT NULL)
Reality: Many wiki exercises have only ONE of these fields

Migration 019:
- ALTER COLUMN goal DROP NOT NULL
- ALTER COLUMN execution DROP NOT NULL
- ADD CHECK constraint: (goal IS NOT NULL OR execution IS NOT NULL)

This allows:
✓ Exercises with only goal
✓ Exercises with only execution
✓ Exercises with both
✗ Exercises with neither (CHECK constraint fails)

Import validation already correct (line 312):
required_ok = bool(mapped.get('goal') or mapped.get('execution'))

DB schema was blocking valid exercises.
This commit is contained in:
Lars 2026-04-24 20:42:21 +02:00
parent a37400bb22
commit bcc7d61d07

View File

@ -0,0 +1,11 @@
-- Migration 019: Make exercise goal and execution optional
-- Many wiki exercises have only goal OR execution, not both
ALTER TABLE exercises
ALTER COLUMN goal DROP NOT NULL,
ALTER COLUMN execution DROP NOT NULL;
-- Add CHECK constraint: at least one of goal/execution must be present
ALTER TABLE exercises
ADD CONSTRAINT exercises_goal_or_execution_required
CHECK (goal IS NOT NULL OR execution IS NOT NULL);