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.
12 lines
429 B
SQL
12 lines
429 B
SQL
-- 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);
|