fix upser daily checklist status rejected; fix search list daily checklist

This commit is contained in:
giovanni
2026-04-02 11:24:53 +07:00
parent 9ce69ddeb0
commit 36b0f97897
3 changed files with 70 additions and 14 deletions
@@ -0,0 +1,5 @@
DROP INDEX IF EXISTS idx_daily_checklists_unique_non_rejected;
ALTER TABLE daily_checklists
ADD CONSTRAINT daily_checklists_date_kandang_category_key
UNIQUE (date, kandang_id, category);
@@ -0,0 +1,6 @@
ALTER TABLE daily_checklists
DROP CONSTRAINT IF EXISTS daily_checklists_date_kandang_category_key;
CREATE UNIQUE INDEX IF NOT EXISTS idx_daily_checklists_unique_non_rejected
ON daily_checklists (date, kandang_id, category)
WHERE (status IS NULL OR status <> 'REJECTED');