From: rich Date: Tue, 28 Sep 2004 09:28:29 +0000 (+0000) Subject: Added 'links' table which will contain the link structure of the wiki. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=ac2a76279ca3a56e870206c6a038cd1ab2514b4b;p=cocanwiki.git Added 'links' table which will contain the link structure of the wiki. The links table will be updated whenever we edit a page, and there will be a central way to rebuild links too. This means that the links data might become slightly out of synch with the true wiki structure, but this is considered unimportant. --- diff --git a/cocanwiki.sql b/cocanwiki.sql index ddd95df..15a09af 100644 --- a/cocanwiki.sql +++ b/cocanwiki.sql @@ -48,7 +48,7 @@ GRANT ALL ON TABLE pages TO "www-data"; -- --- TOC entry 38 (OID 536004) +-- TOC entry 39 (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 39 (OID 536021) +-- TOC entry 40 (OID 536021) -- Name: contents_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -118,7 +118,7 @@ GRANT ALL ON TABLE hosts TO "www-data"; -- --- TOC entry 40 (OID 536371) +-- TOC entry 41 (OID 536371) -- Name: hosts_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -203,7 +203,7 @@ GRANT ALL ON TABLE images TO "www-data"; -- --- TOC entry 41 (OID 537151) +-- TOC entry 42 (OID 537151) -- Name: images_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -238,7 +238,7 @@ GRANT ALL ON TABLE files TO "www-data"; -- --- TOC entry 42 (OID 537166) +-- TOC entry 43 (OID 537166) -- Name: files_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -277,7 +277,7 @@ GRANT ALL ON TABLE users TO "www-data"; -- --- TOC entry 43 (OID 540816) +-- TOC entry 44 (OID 540816) -- Name: users_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -350,7 +350,7 @@ GRANT ALL ON TABLE contacts TO "www-data"; -- --- TOC entry 44 (OID 542605) +-- TOC entry 45 (OID 542605) -- Name: contacts_id_seq; Type: ACL; Schema: public; Owner: rich -- @@ -469,7 +469,19 @@ GRANT ALL ON TABLE mailing_lists TO "www-data"; -- --- TOC entry 49 (OID 536388) +-- TOC entry 38 (OID 544445) +-- Name: links; Type: TABLE; Schema: public; Owner: rich +-- + +CREATE TABLE links ( + hostid integer NOT NULL, + from_url text NOT NULL, + to_url text NOT NULL +); + + +-- +-- TOC entry 50 (OID 536388) -- Name: hostnames_hostid_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -477,7 +489,7 @@ CREATE UNIQUE INDEX hostnames_hostid_name_uq ON hostnames USING btree (hostid, n -- --- TOC entry 50 (OID 536389) +-- TOC entry 51 (OID 536389) -- Name: hostnams_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -485,7 +497,7 @@ CREATE UNIQUE INDEX hostnams_name_uq ON hostnames USING btree (name); -- --- TOC entry 46 (OID 536419) +-- TOC entry 47 (OID 536419) -- Name: pages_url_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -493,7 +505,7 @@ CREATE UNIQUE INDEX pages_url_uq ON pages USING btree (hostid, url); -- --- TOC entry 51 (OID 536924) +-- TOC entry 52 (OID 536924) -- Name: email_notify_email_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -501,7 +513,7 @@ CREATE UNIQUE INDEX email_notify_email_uq ON email_notify USING btree (hostid, e -- --- TOC entry 52 (OID 540251) +-- TOC entry 53 (OID 540251) -- Name: images_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -509,7 +521,7 @@ CREATE UNIQUE INDEX images_name_uq ON images USING btree (hostid, name); -- --- TOC entry 54 (OID 540252) +-- TOC entry 55 (OID 540252) -- Name: files_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -517,7 +529,7 @@ CREATE UNIQUE INDEX files_name_uq ON files USING btree (hostid, name); -- --- TOC entry 57 (OID 540831) +-- TOC entry 58 (OID 540831) -- Name: users_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -525,7 +537,7 @@ CREATE UNIQUE INDEX users_name_uq ON users USING btree (hostid, name); -- --- TOC entry 56 (OID 540946) +-- TOC entry 57 (OID 540946) -- Name: users_id_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -533,7 +545,7 @@ CREATE UNIQUE INDEX users_id_uq ON users USING btree (hostid, id); -- --- TOC entry 59 (OID 540970) +-- TOC entry 60 (OID 540970) -- Name: sitemenu_ordering_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -541,7 +553,7 @@ CREATE UNIQUE INDEX sitemenu_ordering_uq ON sitemenu USING btree (hostid, orderi -- --- TOC entry 60 (OID 540971) +-- TOC entry 61 (OID 540971) -- Name: sitemenu_url_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -549,7 +561,7 @@ CREATE UNIQUE INDEX sitemenu_url_uq ON sitemenu USING btree (hostid, url); -- --- TOC entry 63 (OID 542626) +-- TOC entry 64 (OID 542626) -- Name: contact_emails_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -557,7 +569,7 @@ CREATE UNIQUE INDEX contact_emails_uq ON contact_emails USING btree (contactid, -- --- TOC entry 64 (OID 543505) +-- TOC entry 65 (OID 543505) -- Name: themes_theme_css_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -565,7 +577,7 @@ CREATE UNIQUE INDEX themes_theme_css_uq ON themes USING btree (theme_css); -- --- TOC entry 65 (OID 543763) +-- TOC entry 66 (OID 543763) -- Name: page_emails_email_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -573,7 +585,7 @@ CREATE UNIQUE INDEX page_emails_email_uq ON page_emails USING btree (hostid, url -- --- TOC entry 66 (OID 543795) +-- TOC entry 67 (OID 543795) -- Name: mailing_lists_email_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -581,7 +593,7 @@ CREATE UNIQUE INDEX mailing_lists_email_uq ON mailing_lists USING btree (hostid, -- --- TOC entry 61 (OID 543880) +-- TOC entry 62 (OID 543880) -- Name: contacts_name_uq; Type: INDEX; Schema: public; Owner: rich -- @@ -589,7 +601,15 @@ CREATE UNIQUE INDEX contacts_name_uq ON contacts USING btree (hostid, name); -- --- TOC entry 45 (OID 536012) +-- TOC entry 68 (OID 544454) +-- Name: links_uq; Type: INDEX; Schema: public; Owner: rich +-- + +CREATE UNIQUE INDEX links_uq ON links USING btree (hostid, from_url, to_url); + + +-- +-- TOC entry 46 (OID 536012) -- Name: pages_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -598,7 +618,7 @@ ALTER TABLE ONLY pages -- --- TOC entry 47 (OID 536027) +-- TOC entry 48 (OID 536027) -- Name: contents_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -607,7 +627,7 @@ ALTER TABLE ONLY contents -- --- TOC entry 48 (OID 536377) +-- TOC entry 49 (OID 536377) -- Name: hosts_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -616,7 +636,7 @@ ALTER TABLE ONLY hosts -- --- TOC entry 53 (OID 537158) +-- TOC entry 54 (OID 537158) -- Name: images_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -625,7 +645,7 @@ ALTER TABLE ONLY images -- --- TOC entry 55 (OID 537173) +-- TOC entry 56 (OID 537173) -- Name: files_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -634,7 +654,7 @@ ALTER TABLE ONLY files -- --- TOC entry 58 (OID 540825) +-- TOC entry 59 (OID 540825) -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -643,7 +663,7 @@ ALTER TABLE ONLY users -- --- TOC entry 62 (OID 542611) +-- TOC entry 63 (OID 542611) -- Name: contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: rich -- @@ -652,7 +672,7 @@ ALTER TABLE ONLY contacts -- --- TOC entry 71 (OID 536029) +-- TOC entry 73 (OID 536029) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -661,7 +681,7 @@ ALTER TABLE ONLY contents -- --- TOC entry 74 (OID 536384) +-- TOC entry 76 (OID 536384) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -670,7 +690,7 @@ ALTER TABLE ONLY hostnames -- --- TOC entry 72 (OID 536394) +-- TOC entry 74 (OID 536394) -- Name: hosts_hostname_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -679,7 +699,7 @@ ALTER TABLE ONLY hosts -- --- TOC entry 67 (OID 536404) +-- TOC entry 69 (OID 536404) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -688,7 +708,7 @@ ALTER TABLE ONLY pages -- --- TOC entry 75 (OID 536920) +-- TOC entry 77 (OID 536920) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -697,7 +717,7 @@ ALTER TABLE ONLY email_notify -- --- TOC entry 76 (OID 537160) +-- TOC entry 78 (OID 537160) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -706,7 +726,7 @@ ALTER TABLE ONLY images -- --- TOC entry 77 (OID 537175) +-- TOC entry 79 (OID 537175) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -715,7 +735,7 @@ ALTER TABLE ONLY files -- --- TOC entry 68 (OID 539155) +-- TOC entry 70 (OID 539155) -- Name: pages_redirect_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -724,7 +744,7 @@ ALTER TABLE ONLY pages -- --- TOC entry 78 (OID 540827) +-- TOC entry 80 (OID 540827) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -733,7 +753,7 @@ ALTER TABLE ONLY users -- --- TOC entry 79 (OID 540837) +-- TOC entry 81 (OID 540837) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -742,7 +762,7 @@ ALTER TABLE ONLY usercookies -- --- TOC entry 69 (OID 540942) +-- TOC entry 71 (OID 540942) -- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -751,7 +771,7 @@ ALTER TABLE ONLY pages -- --- TOC entry 70 (OID 540947) +-- TOC entry 72 (OID 540947) -- Name: pages_user_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -760,7 +780,7 @@ ALTER TABLE ONLY pages -- --- TOC entry 80 (OID 540966) +-- TOC entry 82 (OID 540966) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -769,7 +789,7 @@ ALTER TABLE ONLY sitemenu -- --- TOC entry 81 (OID 540972) +-- TOC entry 83 (OID 540972) -- Name: sitemenu_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -778,7 +798,7 @@ ALTER TABLE ONLY sitemenu -- --- TOC entry 82 (OID 542613) +-- TOC entry 84 (OID 542613) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -787,7 +807,7 @@ ALTER TABLE ONLY contacts -- --- TOC entry 83 (OID 542622) +-- TOC entry 85 (OID 542622) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -796,7 +816,7 @@ ALTER TABLE ONLY contact_emails -- --- TOC entry 73 (OID 543506) +-- TOC entry 75 (OID 543506) -- Name: hosts_theme_css_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -805,7 +825,7 @@ ALTER TABLE ONLY hosts -- --- TOC entry 84 (OID 543759) +-- TOC entry 86 (OID 543759) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -814,7 +834,7 @@ ALTER TABLE ONLY page_emails -- --- TOC entry 85 (OID 543764) +-- TOC entry 87 (OID 543764) -- Name: page_emails_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -823,7 +843,7 @@ ALTER TABLE ONLY page_emails -- --- TOC entry 86 (OID 543791) +-- TOC entry 88 (OID 543791) -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich -- @@ -832,6 +852,33 @@ ALTER TABLE ONLY mailing_lists -- +-- TOC entry 89 (OID 544450) +-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich +-- + +ALTER TABLE ONLY links + ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id); + + +-- +-- TOC entry 90 (OID 544455) +-- Name: links_from_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich +-- + +ALTER TABLE ONLY links + ADD CONSTRAINT links_from_cn FOREIGN KEY (hostid, from_url) REFERENCES pages(hostid, url) DEFERRABLE; + + +-- +-- TOC entry 91 (OID 544459) +-- Name: links_to_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich +-- + +ALTER TABLE ONLY links + ADD CONSTRAINT links_to_cn FOREIGN KEY (hostid, to_url) REFERENCES pages(hostid, url) DEFERRABLE; + + +-- -- TOC entry 3 (OID 2200) -- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres --