From: rich Date: Sun, 10 Oct 2004 20:57:02 +0000 (+0000) Subject: Database support for implementing JWZ's message threading X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=bb882f46f4f695469eb05d56fb5aee7bef0077df;p=cocanwiki.git Database support for implementing JWZ's message threading algorithm. [http://www.jwz.org/doc/threading.html] When we use mail2wiki to import a message, we will add the subject and inet message ID to the database. After importing messages, we will rebuild the thread and subject indexes for any affected months. --- diff --git a/cocanwiki.sql b/cocanwiki.sql index 6a96318..dbd87b2 100644 --- a/cocanwiki.sql +++ b/cocanwiki.sql @@ -48,7 +48,7 @@ GRANT ALL ON TABLE pages TO "www-data"; -- --- TOC entry 44 (OID 536004) +-- TOC entry 48 (OID 536004) -- Name: pages_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -81,7 +81,7 @@ GRANT ALL ON TABLE contents TO "www-data"; -- --- TOC entry 45 (OID 536021) +-- TOC entry 49 (OID 536021) -- Name: contents_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -120,7 +120,7 @@ GRANT ALL ON TABLE hosts TO "www-data"; -- --- TOC entry 46 (OID 536371) +-- TOC entry 50 (OID 536371) -- Name: hosts_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -205,7 +205,7 @@ GRANT ALL ON TABLE images TO "www-data"; -- --- TOC entry 47 (OID 537151) +-- TOC entry 51 (OID 537151) -- Name: images_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -240,7 +240,7 @@ GRANT ALL ON TABLE files TO "www-data"; -- --- TOC entry 48 (OID 537166) +-- TOC entry 52 (OID 537166) -- Name: files_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -279,7 +279,7 @@ GRANT ALL ON TABLE users TO "www-data"; -- --- TOC entry 49 (OID 540816) +-- TOC entry 53 (OID 540816) -- Name: users_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -352,7 +352,7 @@ GRANT ALL ON TABLE contacts TO "www-data"; -- --- TOC entry 50 (OID 542605) +-- TOC entry 54 (OID 542605) -- Name: contacts_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -517,7 +517,7 @@ GRANT SELECT ON TABLE templates TO "www-data"; -- --- TOC entry 51 (OID 547939) +-- TOC entry 55 (OID 547939) -- Name: templates_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -547,7 +547,59 @@ GRANT ALL ON TABLE recently_visited TO "www-data"; -- --- TOC entry 56 (OID 536388) +-- TOC entry 44 (OID 551675) +-- Name: messages; Type: TABLE; Schema: public; Owner: rich +-- + +CREATE TABLE messages ( + id serial NOT NULL, + subject text NOT NULL, + inet_message_id text NOT NULL, + message_date timestamp with time zone NOT NULL, + hostid integer NOT NULL +); + + +-- +-- TOC entry 45 (OID 551675) +-- Name: messages; Type: ACL; Schema: public; Owner: rich +-- + +REVOKE ALL ON TABLE messages FROM PUBLIC; +GRANT ALL ON TABLE messages TO "www-data"; + + +-- +-- TOC entry 56 (OID 551675) +-- Name: messages_id_seq; Type: ACL; Schema: public; Owner: rich +-- + +REVOKE ALL ON TABLE messages_id_seq FROM PUBLIC; +GRANT ALL ON TABLE messages_id_seq TO "www-data"; + + +-- +-- TOC entry 46 (OID 551685) +-- Name: msg_references; Type: TABLE; Schema: public; Owner: rich +-- + +CREATE TABLE msg_references ( + message_id integer NOT NULL, + inet_message_id text NOT NULL +); + + +-- +-- TOC entry 47 (OID 551685) +-- Name: msg_references; Type: ACL; Schema: public; Owner: rich +-- + +REVOKE ALL ON TABLE msg_references FROM PUBLIC; +GRANT ALL ON TABLE msg_references TO "www-data"; + + +-- +-- TOC entry 61 (OID 536388) -- Name: hostnames_hostid_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -555,7 +607,7 @@ CREATE UNIQUE INDEX hostnames_hostid_name_uq ON hostnames USING btree (hostid, n -- --- TOC entry 57 (OID 536389) +-- TOC entry 62 (OID 536389) -- Name: hostnams_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -563,7 +615,7 @@ CREATE UNIQUE INDEX hostnams_name_uq ON hostnames USING btree (name); -- --- TOC entry 53 (OID 536419) +-- TOC entry 58 (OID 536419) -- Name: pages_url_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -571,7 +623,7 @@ CREATE UNIQUE INDEX pages_url_uq ON pages USING btree (hostid, url); -- --- TOC entry 58 (OID 536924) +-- TOC entry 63 (OID 536924) -- Name: email_notify_email_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -579,7 +631,7 @@ CREATE UNIQUE INDEX email_notify_email_uq ON email_notify USING btree (hostid, e -- --- TOC entry 59 (OID 540251) +-- TOC entry 64 (OID 540251) -- Name: images_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -587,7 +639,7 @@ CREATE UNIQUE INDEX images_name_uq ON images USING btree (hostid, name); -- --- TOC entry 61 (OID 540252) +-- TOC entry 66 (OID 540252) -- Name: files_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -595,7 +647,7 @@ CREATE UNIQUE INDEX files_name_uq ON files USING btree (hostid, name); -- --- TOC entry 64 (OID 540831) +-- TOC entry 69 (OID 540831) -- Name: users_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -603,7 +655,7 @@ CREATE UNIQUE INDEX users_name_uq ON users USING btree (hostid, name); -- --- TOC entry 63 (OID 540946) +-- TOC entry 68 (OID 540946) -- Name: users_id_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -611,7 +663,7 @@ CREATE UNIQUE INDEX users_id_uq ON users USING btree (hostid, id); -- --- TOC entry 66 (OID 540970) +-- TOC entry 71 (OID 540970) -- Name: sitemenu_ordering_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -619,7 +671,7 @@ CREATE UNIQUE INDEX sitemenu_ordering_uq ON sitemenu USING btree (hostid, orderi -- --- TOC entry 67 (OID 540971) +-- TOC entry 72 (OID 540971) -- Name: sitemenu_url_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -627,7 +679,7 @@ CREATE UNIQUE INDEX sitemenu_url_uq ON sitemenu USING btree (hostid, url); -- --- TOC entry 70 (OID 542626) +-- TOC entry 75 (OID 542626) -- Name: contact_emails_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -635,7 +687,7 @@ CREATE UNIQUE INDEX contact_emails_uq ON contact_emails USING btree (contactid, -- --- TOC entry 71 (OID 543505) +-- TOC entry 76 (OID 543505) -- Name: themes_theme_css_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -643,7 +695,7 @@ CREATE UNIQUE INDEX themes_theme_css_uq ON themes USING btree (theme_css); -- --- TOC entry 72 (OID 543763) +-- TOC entry 77 (OID 543763) -- Name: page_emails_email_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -651,7 +703,7 @@ CREATE UNIQUE INDEX page_emails_email_uq ON page_emails USING btree (hostid, url -- --- TOC entry 73 (OID 543795) +-- TOC entry 78 (OID 543795) -- Name: mailing_lists_email_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -659,7 +711,7 @@ CREATE UNIQUE INDEX mailing_lists_email_uq ON mailing_lists USING btree (hostid, -- --- TOC entry 68 (OID 543880) +-- TOC entry 73 (OID 543880) -- Name: contacts_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -667,7 +719,7 @@ CREATE UNIQUE INDEX contacts_name_uq ON contacts USING btree (hostid, name); -- --- TOC entry 74 (OID 544454) +-- TOC entry 79 (OID 544454) -- Name: links_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -675,7 +727,7 @@ CREATE UNIQUE INDEX links_uq ON links USING btree (hostid, from_url, to_url); -- --- TOC entry 75 (OID 547951) +-- TOC entry 80 (OID 547951) -- Name: templates_ext_ord_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -683,7 +735,7 @@ CREATE UNIQUE INDEX templates_ext_ord_uq ON templates USING btree (extension, or -- --- TOC entry 77 (OID 547952) +-- TOC entry 82 (OID 547952) -- Name: templates_title_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -691,7 +743,7 @@ CREATE UNIQUE INDEX templates_title_uq ON templates USING btree (title_regexp); -- --- TOC entry 78 (OID 547953) +-- TOC entry 83 (OID 547953) -- Name: templates_url_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -699,7 +751,7 @@ CREATE UNIQUE INDEX templates_url_uq ON templates USING btree (url_regexp); -- --- TOC entry 79 (OID 551151) +-- TOC entry 84 (OID 551151) -- Name: recently_visited_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -707,7 +759,7 @@ CREATE UNIQUE INDEX recently_visited_uq ON recently_visited USING btree (userid, -- --- TOC entry 52 (OID 536012) +-- TOC entry 57 (OID 536012) -- Name: pages_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -716,7 +768,7 @@ ALTER TABLE ONLY pages -- --- TOC entry 54 (OID 536027) +-- TOC entry 59 (OID 536027) -- Name: contents_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -725,7 +777,7 @@ ALTER TABLE ONLY contents -- --- TOC entry 55 (OID 536377) +-- TOC entry 60 (OID 536377) -- Name: hosts_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -734,7 +786,7 @@ ALTER TABLE ONLY hosts -- --- TOC entry 60 (OID 537158) +-- TOC entry 65 (OID 537158) -- Name: images_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -743,7 +795,7 @@ ALTER TABLE ONLY images -- --- TOC entry 62 (OID 537173) +-- TOC entry 67 (OID 537173) -- Name: files_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -752,7 +804,7 @@ ALTER TABLE ONLY files -- --- TOC entry 65 (OID 540825) +-- TOC entry 70 (OID 540825) -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -761,7 +813,7 @@ ALTER TABLE ONLY users -- --- TOC entry 69 (OID 542611) +-- TOC entry 74 (OID 542611) -- Name: contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -770,7 +822,7 @@ ALTER TABLE ONLY contacts -- --- TOC entry 76 (OID 547945) +-- TOC entry 81 (OID 547945) -- Name: templates_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -779,7 +831,25 @@ ALTER TABLE ONLY templates -- --- TOC entry 84 (OID 536029) +-- TOC entry 86 (OID 551681) +-- Name: messages_pkey; Type: CONSTRAINT; Schema: public; Owner: rich +-- + +ALTER TABLE ONLY messages + ADD CONSTRAINT messages_pkey PRIMARY KEY (id); + + +-- +-- TOC entry 85 (OID 551683) +-- Name: messages_inet_message_id_key; Type: CONSTRAINT; Schema: public; Owner: rich +-- + +ALTER TABLE ONLY messages + ADD CONSTRAINT messages_inet_message_id_key UNIQUE (inet_message_id); + + +-- +-- TOC entry 91 (OID 536029) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -788,7 +858,7 @@ ALTER TABLE ONLY contents -- --- TOC entry 87 (OID 536384) +-- TOC entry 94 (OID 536384) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -797,7 +867,7 @@ ALTER TABLE ONLY hostnames -- --- TOC entry 85 (OID 536394) +-- TOC entry 92 (OID 536394) -- Name: hosts_hostname_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -806,7 +876,7 @@ ALTER TABLE ONLY hosts -- --- TOC entry 80 (OID 536404) +-- TOC entry 87 (OID 536404) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -815,7 +885,7 @@ ALTER TABLE ONLY pages -- --- TOC entry 88 (OID 536920) +-- TOC entry 95 (OID 536920) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -824,7 +894,7 @@ ALTER TABLE ONLY email_notify -- --- TOC entry 89 (OID 537160) +-- TOC entry 96 (OID 537160) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -833,7 +903,7 @@ ALTER TABLE ONLY images -- --- TOC entry 90 (OID 537175) +-- TOC entry 97 (OID 537175) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -842,7 +912,7 @@ ALTER TABLE ONLY files -- --- TOC entry 81 (OID 539155) +-- TOC entry 88 (OID 539155) -- Name: pages_redirect_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -851,7 +921,7 @@ ALTER TABLE ONLY pages -- --- TOC entry 91 (OID 540827) +-- TOC entry 98 (OID 540827) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -860,7 +930,7 @@ ALTER TABLE ONLY users -- --- TOC entry 92 (OID 540837) +-- TOC entry 99 (OID 540837) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -869,7 +939,7 @@ ALTER TABLE ONLY usercookies -- --- TOC entry 82 (OID 540942) +-- TOC entry 89 (OID 540942) -- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -878,7 +948,7 @@ ALTER TABLE ONLY pages -- --- TOC entry 83 (OID 540947) +-- TOC entry 90 (OID 540947) -- Name: pages_user_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -887,7 +957,7 @@ ALTER TABLE ONLY pages -- --- TOC entry 93 (OID 540966) +-- TOC entry 100 (OID 540966) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -896,7 +966,7 @@ ALTER TABLE ONLY sitemenu -- --- TOC entry 94 (OID 540972) +-- TOC entry 101 (OID 540972) -- Name: sitemenu_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -905,7 +975,7 @@ ALTER TABLE ONLY sitemenu -- --- TOC entry 95 (OID 542613) +-- TOC entry 102 (OID 542613) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -914,7 +984,7 @@ ALTER TABLE ONLY contacts -- --- TOC entry 96 (OID 542622) +-- TOC entry 103 (OID 542622) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -923,7 +993,7 @@ ALTER TABLE ONLY contact_emails -- --- TOC entry 86 (OID 543506) +-- TOC entry 93 (OID 543506) -- Name: hosts_theme_css_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -932,7 +1002,7 @@ ALTER TABLE ONLY hosts -- --- TOC entry 97 (OID 543759) +-- TOC entry 104 (OID 543759) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -941,7 +1011,7 @@ ALTER TABLE ONLY page_emails -- --- TOC entry 98 (OID 543764) +-- TOC entry 105 (OID 543764) -- Name: page_emails_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -950,7 +1020,7 @@ ALTER TABLE ONLY page_emails -- --- TOC entry 99 (OID 543791) +-- TOC entry 106 (OID 543791) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -959,7 +1029,7 @@ ALTER TABLE ONLY mailing_lists -- --- TOC entry 100 (OID 544450) +-- TOC entry 107 (OID 544450) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -968,7 +1038,7 @@ ALTER TABLE ONLY links -- --- TOC entry 101 (OID 544455) +-- TOC entry 108 (OID 544455) -- Name: links_from_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -977,7 +1047,7 @@ ALTER TABLE ONLY links -- --- TOC entry 102 (OID 551129) +-- TOC entry 109 (OID 551129) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -986,7 +1056,7 @@ ALTER TABLE ONLY recently_visited -- --- TOC entry 103 (OID 551133) +-- TOC entry 110 (OID 551133) -- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -995,7 +1065,7 @@ ALTER TABLE ONLY recently_visited -- --- TOC entry 104 (OID 551137) +-- TOC entry 111 (OID 551137) -- Name: recently_visited_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -1004,7 +1074,7 @@ ALTER TABLE ONLY recently_visited -- --- TOC entry 105 (OID 551141) +-- TOC entry 112 (OID 551141) -- Name: recently_visited_userid_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -1013,6 +1083,24 @@ ALTER TABLE ONLY recently_visited -- +-- TOC entry 114 (OID 551690) +-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich +-- + +ALTER TABLE ONLY msg_references + ADD CONSTRAINT "$1" FOREIGN KEY (message_id) REFERENCES messages(id); + + +-- +-- TOC entry 113 (OID 551694) +-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich +-- + +ALTER TABLE ONLY messages + ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id); + + +-- -- TOC entry 3 (OID 2200) -- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres --