23 lines
671 B
PL/PgSQL
23 lines
671 B
PL/PgSQL
BEGIN;
|
|
|
|
SET ROLE continuity_role;
|
|
|
|
ALTER TABLE continuity.attention_items
|
|
DROP CONSTRAINT IF EXISTS attention_items_response_projection_check;
|
|
|
|
ALTER TABLE continuity.attention_items
|
|
ADD CONSTRAINT attention_items_response_projection_check
|
|
CHECK (
|
|
state <> 'RESOLVED'
|
|
OR (
|
|
response_id <> ''
|
|
AND response_utterance_id <> ''
|
|
AND response_operation IN ('ACKNOWLEDGE','COMPLETE','SNOOZE','CANCEL','DISMISS','CONTINUE','REJECT')
|
|
AND response_outcome IN ('USER_REPORTED_COMPLETE','SNOOZED','CANCELLED','DISMISSED','CLARIFICATION_NEEDED','CONTINUED','REJECTED','NOOP')
|
|
AND responded_at_unix_millis > 0
|
|
)
|
|
);
|
|
|
|
RESET ROLE;
|
|
COMMIT;
|