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

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
+98 -2
View File
@@ -161,6 +161,9 @@ CREATE TABLE public.faq_items (
id uuid NOT NULL,
study_id uuid,
category_id uuid NOT NULL,
best_reply_id uuid,
status character varying(20) DEFAULT 'PENDING'::character varying NOT NULL,
resolved_by_confirm boolean DEFAULT false NOT NULL,
question text NOT NULL,
answer text NOT NULL,
keywords character varying(255),
@@ -174,6 +177,24 @@ CREATE TABLE public.faq_items (
ALTER TABLE public.faq_items OWNER TO ctms_user;
--
-- Name: faq_replies; Type: TABLE; Schema: public; Owner: ctms_user
--
CREATE TABLE public.faq_replies (
id uuid NOT NULL,
faq_id uuid NOT NULL,
study_id uuid,
content text NOT NULL,
created_by uuid NOT NULL,
created_at timestamp with time zone DEFAULT now() NOT NULL,
quote_reply_id uuid,
is_deleted boolean DEFAULT false NOT NULL
);
ALTER TABLE public.faq_replies OWNER TO ctms_user;
--
-- Name: finance_items; Type: TABLE; Schema: public; Owner: ctms_user
--
@@ -541,8 +562,16 @@ eeeeeee1-eeee-eeee-eeee-eeeeeeeeeee1 44444444-4444-4444-4444-444444444444 访视
-- Data for Name: faq_items; Type: TABLE DATA; Schema: public; Owner: ctms_user
--
COPY public.faq_items (id, study_id, category_id, question, answer, keywords, version, is_active, created_by, created_at, updated_at) FROM stdin;
fffffff1-ffff-ffff-ffff-fffffffffff1 44444444-4444-4444-4444-444444444444 eeeeeee1-eeee-eeee-eeee-eeeeeeeeeee1 V1 访 访, 1 t 22222222-2222-2222-2222-222222222222 2025-12-18 00:55:17.568504+00 2025-12-18 00:55:17.568504+00
COPY public.faq_items (id, study_id, category_id, best_reply_id, status, resolved_by_confirm, question, answer, keywords, version, is_active, created_by, created_at, updated_at) FROM stdin;
fffffff1-ffff-ffff-ffff-fffffffffff1 44444444-4444-4444-4444-444444444444 eeeeeee1-eeee-eeee-eeee-eeeeeeeeeee1 \N PENDING f V1 访 访, 1 t 22222222-2222-2222-2222-222222222222 2025-12-18 00:55:17.568504+00 2025-12-18 00:55:17.568504+00
\.
--
-- Data for Name: faq_replies; Type: TABLE DATA; Schema: public; Owner: ctms_user
--
COPY public.faq_replies (id, faq_id, study_id, content, created_by, created_at, quote_reply_id, is_deleted) FROM stdin;
\.
@@ -739,6 +768,14 @@ ALTER TABLE ONLY public.faq_items
ADD CONSTRAINT faq_items_pkey PRIMARY KEY (id);
--
-- Name: faq_replies faq_replies_pkey; Type: CONSTRAINT; Schema: public; Owner: ctms_user
--
ALTER TABLE ONLY public.faq_replies
ADD CONSTRAINT faq_replies_pkey PRIMARY KEY (id);
--
-- Name: finance_items finance_items_pkey; Type: CONSTRAINT; Schema: public; Owner: ctms_user
--
@@ -974,6 +1011,12 @@ CREATE INDEX ix_faq_categories_study_id ON public.faq_categories USING btree (st
CREATE INDEX ix_faq_items_category_id ON public.faq_items USING btree (category_id);
--
-- Name: ix_faq_items_best_reply_id; Type: INDEX; Schema: public; Owner: ctms_user
--
CREATE INDEX ix_faq_items_best_reply_id ON public.faq_items USING btree (best_reply_id);
--
-- Name: ix_faq_items_study_id; Type: INDEX; Schema: public; Owner: ctms_user
@@ -982,6 +1025,20 @@ CREATE INDEX ix_faq_items_category_id ON public.faq_items USING btree (category_
CREATE INDEX ix_faq_items_study_id ON public.faq_items USING btree (study_id);
--
-- Name: ix_faq_replies_faq_id; Type: INDEX; Schema: public; Owner: ctms_user
--
CREATE INDEX ix_faq_replies_faq_id ON public.faq_replies USING btree (faq_id);
--
-- Name: ix_faq_replies_study_id; Type: INDEX; Schema: public; Owner: ctms_user
--
CREATE INDEX ix_faq_replies_study_id ON public.faq_replies USING btree (study_id);
--
-- Name: ix_finance_items_site_id; Type: INDEX; Schema: public; Owner: ctms_user
--
@@ -1304,6 +1361,13 @@ ALTER TABLE ONLY public.faq_categories
ALTER TABLE ONLY public.faq_items
ADD CONSTRAINT faq_items_category_id_fkey FOREIGN KEY (category_id) REFERENCES public.faq_categories(id);
--
-- Name: faq_items faq_items_best_reply_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: ctms_user
--
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;
--
-- Name: faq_items faq_items_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: ctms_user
@@ -1321,6 +1385,38 @@ ALTER TABLE ONLY public.faq_items
ADD CONSTRAINT faq_items_study_id_fkey FOREIGN KEY (study_id) REFERENCES public.studies(id);
--
-- Name: faq_replies faq_replies_created_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: ctms_user
--
ALTER TABLE ONLY public.faq_replies
ADD CONSTRAINT faq_replies_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.users(id);
--
-- Name: faq_replies faq_replies_faq_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: ctms_user
--
ALTER TABLE ONLY public.faq_replies
ADD CONSTRAINT faq_replies_faq_id_fkey FOREIGN KEY (faq_id) REFERENCES public.faq_items(id);
--
-- Name: faq_replies faq_replies_quote_reply_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: ctms_user
--
ALTER TABLE ONLY public.faq_replies
ADD CONSTRAINT faq_replies_quote_reply_id_fkey FOREIGN KEY (quote_reply_id) REFERENCES public.faq_replies(id);
--
-- Name: faq_replies faq_replies_study_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: ctms_user
--
ALTER TABLE ONLY public.faq_replies
ADD CONSTRAINT faq_replies_study_id_fkey FOREIGN KEY (study_id) REFERENCES public.studies(id);
--
-- Name: finance_items finance_items_approver_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: ctms_user
--