fix: deliver validated AI insight responses
This commit is contained in:
19
migrations/000006_growth_coach_completion_guard.sql
Normal file
19
migrations/000006_growth_coach_completion_guard.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
BEGIN;
|
||||
|
||||
UPDATE golden_steps
|
||||
SET status = 'IN_PROGRESS',
|
||||
completed_at = NULL,
|
||||
updated_at = now()
|
||||
WHERE action_type = 'METRIC'
|
||||
AND status = 'COMPLETED'
|
||||
AND (
|
||||
current_value IS NULL
|
||||
OR target IS NULL
|
||||
OR metric_direction IS NULL
|
||||
OR (metric_direction = 'INCREASE' AND current_value < target)
|
||||
OR (metric_direction = 'DECREASE' AND current_value > target)
|
||||
);
|
||||
|
||||
INSERT INTO schema_migrations(version) VALUES (6);
|
||||
|
||||
COMMIT;
|
||||
Reference in New Issue
Block a user