diff --git a/backend/migrations/019_exercises_optional_fields.sql b/backend/migrations/019_exercises_optional_fields.sql new file mode 100644 index 0000000..b8ccb62 --- /dev/null +++ b/backend/migrations/019_exercises_optional_fields.sql @@ -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);