优化“知识库模块“--基本完善

This commit is contained in:
Cheng Zhou
2025-12-26 14:07:28 +08:00
parent a1a4964cd2
commit 7c9befc3c9
23 changed files with 1345 additions and 110 deletions
@@ -0,0 +1,15 @@
ALTER TABLE public.faq_items
ADD COLUMN IF NOT EXISTS best_reply_id uuid;
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1 FROM pg_constraint WHERE conname = 'faq_items_best_reply_id_fkey'
) THEN
ALTER TABLE ONLY public.faq_items
ADD CONSTRAINT faq_items_best_reply_id_fkey
FOREIGN KEY (best_reply_id) REFERENCES public.faq_replies(id) ON DELETE SET NULL;
END IF;
END $$;
CREATE INDEX IF NOT EXISTS ix_faq_items_best_reply_id ON public.faq_items USING btree (best_reply_id);