9e657caecef90f9593f9610a7e95df03f5a10155
[cocanwiki.git] / cocanwiki.sql
1 --
2 -- PostgreSQL database dump
3 --
4
5 SET client_encoding = 'UNICODE';
6 SET check_function_bodies = false;
7
8 --
9 -- TOC entry 4 (OID 2200)
10 -- Name: public; Type: ACL; Schema: -; Owner: postgres
11 --
12
13 REVOKE ALL ON SCHEMA public FROM PUBLIC;
14 REVOKE ALL ON SCHEMA public FROM postgres;
15 GRANT ALL ON SCHEMA public TO PUBLIC;
16
17
18 SET search_path = public, pg_catalog;
19
20 --
21 -- TOC entry 5 (OID 536004)
22 -- Name: pages; Type: TABLE; Schema: public; Owner: rich
23 --
24
25 CREATE TABLE pages (
26     id serial NOT NULL,
27     url text,
28     url_deleted text,
29     title text NOT NULL,
30     description text NOT NULL,
31     creation_date timestamp without time zone DEFAULT ('now'::text)::timestamp(6) with time zone NOT NULL,
32     last_modified_date timestamp without time zone DEFAULT ('now'::text)::timestamp(6) with time zone NOT NULL,
33     hostid integer NOT NULL,
34     logged_ip text,
35     redirect text,
36     css text,
37     logged_user integer
38 );
39
40
41 --
42 -- TOC entry 6 (OID 536004)
43 -- Name: pages; Type: ACL; Schema: public; Owner: rich
44 --
45
46 REVOKE ALL ON TABLE pages FROM PUBLIC;
47 GRANT ALL ON TABLE pages TO "www-data";
48
49
50 --
51 -- TOC entry 48 (OID 536004)
52 -- Name: pages_id_seq; Type: ACL; Schema: public; Owner: rich
53 --
54
55 REVOKE ALL ON TABLE pages_id_seq FROM PUBLIC;
56 GRANT ALL ON TABLE pages_id_seq TO "www-data";
57
58
59 --
60 -- TOC entry 7 (OID 536021)
61 -- Name: contents; Type: TABLE; Schema: public; Owner: rich
62 --
63
64 CREATE TABLE contents (
65     id serial NOT NULL,
66     pageid integer NOT NULL,
67     ordering integer NOT NULL,
68     sectionname text,
69     content text NOT NULL,
70     divname text
71 );
72
73
74 --
75 -- TOC entry 8 (OID 536021)
76 -- Name: contents; Type: ACL; Schema: public; Owner: rich
77 --
78
79 REVOKE ALL ON TABLE contents FROM PUBLIC;
80 GRANT ALL ON TABLE contents TO "www-data";
81
82
83 --
84 -- TOC entry 49 (OID 536021)
85 -- Name: contents_id_seq; Type: ACL; Schema: public; Owner: rich
86 --
87
88 REVOKE ALL ON TABLE contents_id_seq FROM PUBLIC;
89 GRANT ALL ON TABLE contents_id_seq TO "www-data";
90
91
92 --
93 -- TOC entry 9 (OID 536371)
94 -- Name: hosts; Type: TABLE; Schema: public; Owner: rich
95 --
96
97 CREATE TABLE hosts (
98     id serial NOT NULL,
99     canonical_hostname text NOT NULL,
100     css text,
101     edit_anon boolean DEFAULT true NOT NULL,
102     create_account_anon boolean DEFAULT true NOT NULL,
103     theme_css text,
104     feedback_email text,
105     mailing_list boolean DEFAULT false NOT NULL,
106     is_template boolean DEFAULT false NOT NULL,
107     search_box boolean DEFAULT true NOT NULL,
108     view_anon boolean DEFAULT true NOT NULL,
109     navigation boolean DEFAULT false NOT NULL
110 );
111
112
113 --
114 -- TOC entry 10 (OID 536371)
115 -- Name: hosts; Type: ACL; Schema: public; Owner: rich
116 --
117
118 REVOKE ALL ON TABLE hosts FROM PUBLIC;
119 GRANT ALL ON TABLE hosts TO "www-data";
120
121
122 --
123 -- TOC entry 50 (OID 536371)
124 -- Name: hosts_id_seq; Type: ACL; Schema: public; Owner: rich
125 --
126
127 REVOKE ALL ON TABLE hosts_id_seq FROM PUBLIC;
128 GRANT ALL ON TABLE hosts_id_seq TO "www-data";
129
130
131 --
132 -- TOC entry 11 (OID 536379)
133 -- Name: hostnames; Type: TABLE; Schema: public; Owner: rich
134 --
135
136 CREATE TABLE hostnames (
137     hostid integer NOT NULL,
138     name text NOT NULL
139 );
140
141
142 --
143 -- TOC entry 12 (OID 536379)
144 -- Name: hostnames; Type: ACL; Schema: public; Owner: rich
145 --
146
147 REVOKE ALL ON TABLE hostnames FROM PUBLIC;
148 GRANT ALL ON TABLE hostnames TO "www-data";
149
150
151 --
152 -- TOC entry 13 (OID 536915)
153 -- Name: email_notify; Type: TABLE; Schema: public; Owner: rich
154 --
155
156 CREATE TABLE email_notify (
157     hostid integer NOT NULL,
158     email text NOT NULL,
159     name text
160 );
161
162
163 --
164 -- TOC entry 14 (OID 536915)
165 -- Name: email_notify; Type: ACL; Schema: public; Owner: rich
166 --
167
168 REVOKE ALL ON TABLE email_notify FROM PUBLIC;
169 GRANT ALL ON TABLE email_notify TO "www-data";
170
171
172 --
173 -- TOC entry 15 (OID 537151)
174 -- Name: images; Type: TABLE; Schema: public; Owner: rich
175 --
176
177 CREATE TABLE images (
178     id serial NOT NULL,
179     hostid integer NOT NULL,
180     name text,
181     name_deleted text,
182     image bytea NOT NULL,
183     width integer NOT NULL,
184     height integer NOT NULL,
185     alt text NOT NULL,
186     title text,
187     longdesc text,
188     "class" text,
189     mime_type text NOT NULL,
190     thumbnail bytea,
191     tn_width integer,
192     tn_height integer,
193     tn_mime_type text,
194     upload_date timestamp without time zone DEFAULT ('now'::text)::timestamp(6) with time zone NOT NULL
195 );
196
197
198 --
199 -- TOC entry 16 (OID 537151)
200 -- Name: images; Type: ACL; Schema: public; Owner: rich
201 --
202
203 REVOKE ALL ON TABLE images FROM PUBLIC;
204 GRANT ALL ON TABLE images TO "www-data";
205
206
207 --
208 -- TOC entry 51 (OID 537151)
209 -- Name: images_id_seq; Type: ACL; Schema: public; Owner: rich
210 --
211
212 REVOKE ALL ON TABLE images_id_seq FROM PUBLIC;
213 GRANT ALL ON TABLE images_id_seq TO "www-data";
214
215
216 --
217 -- TOC entry 17 (OID 537166)
218 -- Name: files; Type: TABLE; Schema: public; Owner: rich
219 --
220
221 CREATE TABLE files (
222     id serial NOT NULL,
223     hostid integer NOT NULL,
224     name text,
225     name_deleted text,
226     content bytea NOT NULL,
227     title text,
228     mime_type text NOT NULL,
229     upload_date timestamp without time zone DEFAULT ('now'::text)::timestamp(6) with time zone NOT NULL
230 );
231
232
233 --
234 -- TOC entry 18 (OID 537166)
235 -- Name: files; Type: ACL; Schema: public; Owner: rich
236 --
237
238 REVOKE ALL ON TABLE files FROM PUBLIC;
239 GRANT ALL ON TABLE files TO "www-data";
240
241
242 --
243 -- TOC entry 52 (OID 537166)
244 -- Name: files_id_seq; Type: ACL; Schema: public; Owner: rich
245 --
246
247 REVOKE ALL ON TABLE files_id_seq FROM PUBLIC;
248 GRANT ALL ON TABLE files_id_seq TO "www-data";
249
250
251 --
252 -- TOC entry 19 (OID 540816)
253 -- Name: users; Type: TABLE; Schema: public; Owner: rich
254 --
255
256 CREATE TABLE users (
257     id serial NOT NULL,
258     hostid integer NOT NULL,
259     name text NOT NULL,
260     "password" text NOT NULL,
261     email text,
262     registration_date date DEFAULT ('now'::text)::date NOT NULL,
263     can_edit boolean DEFAULT true NOT NULL,
264     can_manage_users boolean DEFAULT false NOT NULL,
265     can_manage_contacts boolean DEFAULT false NOT NULL,
266     can_manage_site boolean DEFAULT false NOT NULL,
267     can_edit_global_css boolean DEFAULT false NOT NULL,
268     force_password_change boolean DEFAULT false NOT NULL,
269     can_import_mail boolean DEFAULT false NOT NULL,
270     email_notify boolean DEFAULT true NOT NULL
271 );
272
273
274 --
275 -- TOC entry 20 (OID 540816)
276 -- Name: users; Type: ACL; Schema: public; Owner: rich
277 --
278
279 REVOKE ALL ON TABLE users FROM PUBLIC;
280 GRANT ALL ON TABLE users TO "www-data";
281
282
283 --
284 -- TOC entry 53 (OID 540816)
285 -- Name: users_id_seq; Type: ACL; Schema: public; Owner: rich
286 --
287
288 REVOKE ALL ON TABLE users_id_seq FROM PUBLIC;
289 GRANT ALL ON TABLE users_id_seq TO "www-data";
290
291
292 --
293 -- TOC entry 21 (OID 540832)
294 -- Name: usercookies; Type: TABLE; Schema: public; Owner: rich
295 --
296
297 CREATE TABLE usercookies (
298     userid integer NOT NULL,
299     cookie text NOT NULL
300 );
301
302
303 --
304 -- TOC entry 22 (OID 540832)
305 -- Name: usercookies; Type: ACL; Schema: public; Owner: rich
306 --
307
308 REVOKE ALL ON TABLE usercookies FROM PUBLIC;
309 GRANT ALL ON TABLE usercookies TO "www-data";
310
311
312 --
313 -- TOC entry 23 (OID 540961)
314 -- Name: sitemenu; Type: TABLE; Schema: public; Owner: rich
315 --
316
317 CREATE TABLE sitemenu (
318     hostid integer NOT NULL,
319     url text NOT NULL,
320     label text NOT NULL,
321     ordering integer NOT NULL
322 );
323
324
325 --
326 -- TOC entry 24 (OID 540961)
327 -- Name: sitemenu; Type: ACL; Schema: public; Owner: rich
328 --
329
330 REVOKE ALL ON TABLE sitemenu FROM PUBLIC;
331 GRANT ALL ON TABLE sitemenu TO "www-data";
332
333
334 --
335 -- TOC entry 25 (OID 542605)
336 -- Name: contacts; Type: TABLE; Schema: public; Owner: rich
337 --
338
339 CREATE TABLE contacts (
340     id serial NOT NULL,
341     hostid integer NOT NULL,
342     name text NOT NULL,
343     subject text NOT NULL
344 );
345
346
347 --
348 -- TOC entry 26 (OID 542605)
349 -- Name: contacts; Type: ACL; Schema: public; Owner: rich
350 --
351
352 REVOKE ALL ON TABLE contacts FROM PUBLIC;
353 GRANT ALL ON TABLE contacts TO "www-data";
354
355
356 --
357 -- TOC entry 54 (OID 542605)
358 -- Name: contacts_id_seq; Type: ACL; Schema: public; Owner: rich
359 --
360
361 REVOKE ALL ON TABLE contacts_id_seq FROM PUBLIC;
362 GRANT ALL ON TABLE contacts_id_seq TO "www-data";
363
364
365 --
366 -- TOC entry 27 (OID 542617)
367 -- Name: contact_emails; Type: TABLE; Schema: public; Owner: rich
368 --
369
370 CREATE TABLE contact_emails (
371     contactid integer NOT NULL,
372     email text NOT NULL
373 );
374
375
376 --
377 -- TOC entry 28 (OID 542617)
378 -- Name: contact_emails; Type: ACL; Schema: public; Owner: rich
379 --
380
381 REVOKE ALL ON TABLE contact_emails FROM PUBLIC;
382 GRANT ALL ON TABLE contact_emails TO "www-data";
383
384
385 --
386 -- TOC entry 29 (OID 543499)
387 -- Name: themes; Type: TABLE; Schema: public; Owner: rich
388 --
389
390 CREATE TABLE themes (
391     theme_css text NOT NULL,
392     name text NOT NULL,
393     description text NOT NULL
394 );
395
396
397 --
398 -- TOC entry 30 (OID 543499)
399 -- Name: themes; Type: ACL; Schema: public; Owner: rich
400 --
401
402 REVOKE ALL ON TABLE themes FROM PUBLIC;
403 GRANT SELECT ON TABLE themes TO "www-data";
404
405
406 --
407 -- TOC entry 31 (OID 543592)
408 -- Name: server_settings; Type: TABLE; Schema: public; Owner: rich
409 --
410
411 CREATE TABLE server_settings (
412     "version" integer NOT NULL,
413     stats_page text,
414     crash_email text
415 );
416
417
418 --
419 -- TOC entry 33 (OID 543592)
420 -- Name: server_settings; Type: ACL; Schema: public; Owner: rich
421 --
422
423 REVOKE ALL ON TABLE server_settings FROM PUBLIC;
424 GRANT SELECT ON TABLE server_settings TO "www-data";
425
426
427 --
428 -- TOC entry 34 (OID 543754)
429 -- Name: page_emails; Type: TABLE; Schema: public; Owner: rich
430 --
431
432 CREATE TABLE page_emails (
433     hostid integer NOT NULL,
434     url text NOT NULL,
435     email text NOT NULL,
436     entry_date date DEFAULT ('now'::text)::date NOT NULL,
437     last_sent date DEFAULT ('now'::text)::date NOT NULL,
438     pending text,
439     opt_out text NOT NULL
440 );
441
442
443 --
444 -- TOC entry 35 (OID 543754)
445 -- Name: page_emails; Type: ACL; Schema: public; Owner: rich
446 --
447
448 REVOKE ALL ON TABLE page_emails FROM PUBLIC;
449 GRANT ALL ON TABLE page_emails TO "www-data";
450
451
452 --
453 -- TOC entry 36 (OID 543785)
454 -- Name: mailing_lists; Type: TABLE; Schema: public; Owner: rich
455 --
456
457 CREATE TABLE mailing_lists (
458     hostid integer NOT NULL,
459     email text NOT NULL,
460     entry_date date DEFAULT ('now'::text)::date NOT NULL,
461     pending text,
462     opt_out text NOT NULL,
463     name text NOT NULL
464 );
465
466
467 --
468 -- TOC entry 37 (OID 543785)
469 -- Name: mailing_lists; Type: ACL; Schema: public; Owner: rich
470 --
471
472 REVOKE ALL ON TABLE mailing_lists FROM PUBLIC;
473 GRANT ALL ON TABLE mailing_lists TO "www-data";
474
475
476 --
477 -- TOC entry 38 (OID 544445)
478 -- Name: links; Type: TABLE; Schema: public; Owner: rich
479 --
480
481 CREATE TABLE links (
482     hostid integer NOT NULL,
483     from_url text NOT NULL,
484     to_url text NOT NULL,
485     CONSTRAINT links_not_selfref_cn CHECK ((from_url <> to_url))
486 );
487
488
489 --
490 -- TOC entry 39 (OID 544445)
491 -- Name: links; Type: ACL; Schema: public; Owner: rich
492 --
493
494 REVOKE ALL ON TABLE links FROM PUBLIC;
495 GRANT ALL ON TABLE links TO "www-data";
496
497
498 --
499 -- TOC entry 40 (OID 547939)
500 -- Name: templates; Type: TABLE; Schema: public; Owner: rich
501 --
502
503 CREATE TABLE templates (
504     id serial NOT NULL,
505     title_regexp text NOT NULL,
506     url_regexp text NOT NULL,
507     extension text NOT NULL,
508     ordering integer NOT NULL
509 );
510
511
512 --
513 -- TOC entry 41 (OID 547939)
514 -- Name: templates; Type: ACL; Schema: public; Owner: rich
515 --
516
517 REVOKE ALL ON TABLE templates FROM PUBLIC;
518 GRANT SELECT ON TABLE templates TO "www-data";
519
520
521 --
522 -- TOC entry 55 (OID 547939)
523 -- Name: templates_id_seq; Type: ACL; Schema: public; Owner: rich
524 --
525
526 REVOKE ALL ON TABLE templates_id_seq FROM PUBLIC;
527
528
529 --
530 -- TOC entry 42 (OID 551123)
531 -- Name: recently_visited; Type: TABLE; Schema: public; Owner: rich
532 --
533
534 CREATE TABLE recently_visited (
535     userid integer NOT NULL,
536     hostid integer NOT NULL,
537     url text NOT NULL,
538     visit_time timestamp without time zone DEFAULT ('now'::text)::timestamp(6) with time zone NOT NULL
539 );
540
541
542 --
543 -- TOC entry 43 (OID 551123)
544 -- Name: recently_visited; Type: ACL; Schema: public; Owner: rich
545 --
546
547 REVOKE ALL ON TABLE recently_visited FROM PUBLIC;
548 GRANT ALL ON TABLE recently_visited TO "www-data";
549
550
551 --
552 -- TOC entry 44 (OID 551675)
553 -- Name: messages; Type: TABLE; Schema: public; Owner: rich
554 --
555
556 CREATE TABLE messages (
557     id serial NOT NULL,
558     subject text NOT NULL,
559     inet_message_id text NOT NULL,
560     message_date timestamp with time zone NOT NULL,
561     hostid integer NOT NULL
562 );
563
564
565 --
566 -- TOC entry 45 (OID 551675)
567 -- Name: messages; Type: ACL; Schema: public; Owner: rich
568 --
569
570 REVOKE ALL ON TABLE messages FROM PUBLIC;
571 GRANT ALL ON TABLE messages TO "www-data";
572
573
574 --
575 -- TOC entry 56 (OID 551675)
576 -- Name: messages_id_seq; Type: ACL; Schema: public; Owner: rich
577 --
578
579 REVOKE ALL ON TABLE messages_id_seq FROM PUBLIC;
580 GRANT ALL ON TABLE messages_id_seq TO "www-data";
581
582
583 --
584 -- TOC entry 46 (OID 551685)
585 -- Name: msg_references; Type: TABLE; Schema: public; Owner: rich
586 --
587
588 CREATE TABLE msg_references (
589     message_id integer NOT NULL,
590     inet_message_id text NOT NULL,
591     ordering integer NOT NULL
592 );
593
594
595 --
596 -- TOC entry 47 (OID 551685)
597 -- Name: msg_references; Type: ACL; Schema: public; Owner: rich
598 --
599
600 REVOKE ALL ON TABLE msg_references FROM PUBLIC;
601 GRANT ALL ON TABLE msg_references TO "www-data";
602
603
604 --
605 -- TOC entry 63 (OID 536388)
606 -- Name: hostnames_hostid_name_uq; Type: INDEX; Schema: public; Owner: rich
607 --
608
609 CREATE UNIQUE INDEX hostnames_hostid_name_uq ON hostnames USING btree (hostid, name);
610
611
612 --
613 -- TOC entry 64 (OID 536389)
614 -- Name: hostnams_name_uq; Type: INDEX; Schema: public; Owner: rich
615 --
616
617 CREATE UNIQUE INDEX hostnams_name_uq ON hostnames USING btree (name);
618
619
620 --
621 -- TOC entry 60 (OID 536419)
622 -- Name: pages_url_uq; Type: INDEX; Schema: public; Owner: rich
623 --
624
625 CREATE UNIQUE INDEX pages_url_uq ON pages USING btree (hostid, url);
626
627
628 --
629 -- TOC entry 65 (OID 536924)
630 -- Name: email_notify_email_uq; Type: INDEX; Schema: public; Owner: rich
631 --
632
633 CREATE UNIQUE INDEX email_notify_email_uq ON email_notify USING btree (hostid, email);
634
635
636 --
637 -- TOC entry 66 (OID 540251)
638 -- Name: images_name_uq; Type: INDEX; Schema: public; Owner: rich
639 --
640
641 CREATE UNIQUE INDEX images_name_uq ON images USING btree (hostid, name);
642
643
644 --
645 -- TOC entry 68 (OID 540252)
646 -- Name: files_name_uq; Type: INDEX; Schema: public; Owner: rich
647 --
648
649 CREATE UNIQUE INDEX files_name_uq ON files USING btree (hostid, name);
650
651
652 --
653 -- TOC entry 71 (OID 540831)
654 -- Name: users_name_uq; Type: INDEX; Schema: public; Owner: rich
655 --
656
657 CREATE UNIQUE INDEX users_name_uq ON users USING btree (hostid, name);
658
659
660 --
661 -- TOC entry 70 (OID 540946)
662 -- Name: users_id_uq; Type: INDEX; Schema: public; Owner: rich
663 --
664
665 CREATE UNIQUE INDEX users_id_uq ON users USING btree (hostid, id);
666
667
668 --
669 -- TOC entry 73 (OID 540970)
670 -- Name: sitemenu_ordering_uq; Type: INDEX; Schema: public; Owner: rich
671 --
672
673 CREATE UNIQUE INDEX sitemenu_ordering_uq ON sitemenu USING btree (hostid, ordering);
674
675
676 --
677 -- TOC entry 74 (OID 540971)
678 -- Name: sitemenu_url_uq; Type: INDEX; Schema: public; Owner: rich
679 --
680
681 CREATE UNIQUE INDEX sitemenu_url_uq ON sitemenu USING btree (hostid, url);
682
683
684 --
685 -- TOC entry 77 (OID 542626)
686 -- Name: contact_emails_uq; Type: INDEX; Schema: public; Owner: rich
687 --
688
689 CREATE UNIQUE INDEX contact_emails_uq ON contact_emails USING btree (contactid, email);
690
691
692 --
693 -- TOC entry 78 (OID 543505)
694 -- Name: themes_theme_css_uq; Type: INDEX; Schema: public; Owner: rich
695 --
696
697 CREATE UNIQUE INDEX themes_theme_css_uq ON themes USING btree (theme_css);
698
699
700 --
701 -- TOC entry 79 (OID 543763)
702 -- Name: page_emails_email_uq; Type: INDEX; Schema: public; Owner: rich
703 --
704
705 CREATE UNIQUE INDEX page_emails_email_uq ON page_emails USING btree (hostid, url, email);
706
707
708 --
709 -- TOC entry 80 (OID 543795)
710 -- Name: mailing_lists_email_uq; Type: INDEX; Schema: public; Owner: rich
711 --
712
713 CREATE UNIQUE INDEX mailing_lists_email_uq ON mailing_lists USING btree (hostid, email);
714
715
716 --
717 -- TOC entry 75 (OID 543880)
718 -- Name: contacts_name_uq; Type: INDEX; Schema: public; Owner: rich
719 --
720
721 CREATE UNIQUE INDEX contacts_name_uq ON contacts USING btree (hostid, name);
722
723
724 --
725 -- TOC entry 81 (OID 544454)
726 -- Name: links_uq; Type: INDEX; Schema: public; Owner: rich
727 --
728
729 CREATE UNIQUE INDEX links_uq ON links USING btree (hostid, from_url, to_url);
730
731
732 --
733 -- TOC entry 82 (OID 547951)
734 -- Name: templates_ext_ord_uq; Type: INDEX; Schema: public; Owner: rich
735 --
736
737 CREATE UNIQUE INDEX templates_ext_ord_uq ON templates USING btree (extension, ordering);
738
739
740 --
741 -- TOC entry 84 (OID 547952)
742 -- Name: templates_title_uq; Type: INDEX; Schema: public; Owner: rich
743 --
744
745 CREATE UNIQUE INDEX templates_title_uq ON templates USING btree (title_regexp);
746
747
748 --
749 -- TOC entry 85 (OID 547953)
750 -- Name: templates_url_uq; Type: INDEX; Schema: public; Owner: rich
751 --
752
753 CREATE UNIQUE INDEX templates_url_uq ON templates USING btree (url_regexp);
754
755
756 --
757 -- TOC entry 86 (OID 551151)
758 -- Name: recently_visited_uq; Type: INDEX; Schema: public; Owner: rich
759 --
760
761 CREATE UNIQUE INDEX recently_visited_uq ON recently_visited USING btree (userid, hostid, url);
762
763
764 --
765 -- TOC entry 87 (OID 552155)
766 -- Name: messages_inet_message_id_uq; Type: INDEX; Schema: public; Owner: rich
767 --
768
769 CREATE UNIQUE INDEX messages_inet_message_id_uq ON messages USING btree (hostid, inet_message_id);
770
771
772 --
773 -- TOC entry 59 (OID 552684)
774 -- Name: pages_url_ix; Type: INDEX; Schema: public; Owner: rich
775 --
776
777 CREATE INDEX pages_url_ix ON pages USING btree (url);
778
779
780 --
781 -- TOC entry 58 (OID 552685)
782 -- Name: pages_redirect_ix; Type: INDEX; Schema: public; Owner: rich
783 --
784
785 CREATE INDEX pages_redirect_ix ON pages USING btree (redirect);
786
787
788 --
789 -- TOC entry 57 (OID 536012)
790 -- Name: pages_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
791 --
792
793 ALTER TABLE ONLY pages
794     ADD CONSTRAINT pages_pkey PRIMARY KEY (id);
795
796
797 --
798 -- TOC entry 61 (OID 536027)
799 -- Name: contents_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
800 --
801
802 ALTER TABLE ONLY contents
803     ADD CONSTRAINT contents_pkey PRIMARY KEY (id);
804
805
806 --
807 -- TOC entry 62 (OID 536377)
808 -- Name: hosts_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
809 --
810
811 ALTER TABLE ONLY hosts
812     ADD CONSTRAINT hosts_pkey PRIMARY KEY (id);
813
814
815 --
816 -- TOC entry 67 (OID 537158)
817 -- Name: images_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
818 --
819
820 ALTER TABLE ONLY images
821     ADD CONSTRAINT images_pkey PRIMARY KEY (id);
822
823
824 --
825 -- TOC entry 69 (OID 537173)
826 -- Name: files_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
827 --
828
829 ALTER TABLE ONLY files
830     ADD CONSTRAINT files_pkey PRIMARY KEY (id);
831
832
833 --
834 -- TOC entry 72 (OID 540825)
835 -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
836 --
837
838 ALTER TABLE ONLY users
839     ADD CONSTRAINT users_pkey PRIMARY KEY (id);
840
841
842 --
843 -- TOC entry 76 (OID 542611)
844 -- Name: contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
845 --
846
847 ALTER TABLE ONLY contacts
848     ADD CONSTRAINT contacts_pkey PRIMARY KEY (id);
849
850
851 --
852 -- TOC entry 83 (OID 547945)
853 -- Name: templates_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
854 --
855
856 ALTER TABLE ONLY templates
857     ADD CONSTRAINT templates_pkey PRIMARY KEY (id);
858
859
860 --
861 -- TOC entry 88 (OID 551681)
862 -- Name: messages_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
863 --
864
865 ALTER TABLE ONLY messages
866     ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
867
868
869 --
870 -- TOC entry 93 (OID 536029)
871 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
872 --
873
874 ALTER TABLE ONLY contents
875     ADD CONSTRAINT "$1" FOREIGN KEY (pageid) REFERENCES pages(id);
876
877
878 --
879 -- TOC entry 96 (OID 536384)
880 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
881 --
882
883 ALTER TABLE ONLY hostnames
884     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
885
886
887 --
888 -- TOC entry 94 (OID 536394)
889 -- Name: hosts_hostname_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
890 --
891
892 ALTER TABLE ONLY hosts
893     ADD CONSTRAINT hosts_hostname_cn FOREIGN KEY (id, canonical_hostname) REFERENCES hostnames(hostid, name) DEFERRABLE;
894
895
896 --
897 -- TOC entry 89 (OID 536404)
898 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
899 --
900
901 ALTER TABLE ONLY pages
902     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
903
904
905 --
906 -- TOC entry 97 (OID 536920)
907 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
908 --
909
910 ALTER TABLE ONLY email_notify
911     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
912
913
914 --
915 -- TOC entry 98 (OID 537160)
916 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
917 --
918
919 ALTER TABLE ONLY images
920     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
921
922
923 --
924 -- TOC entry 99 (OID 537175)
925 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
926 --
927
928 ALTER TABLE ONLY files
929     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
930
931
932 --
933 -- TOC entry 90 (OID 539155)
934 -- Name: pages_redirect_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
935 --
936
937 ALTER TABLE ONLY pages
938     ADD CONSTRAINT pages_redirect_cn FOREIGN KEY (hostid, redirect) REFERENCES pages(hostid, url) DEFERRABLE;
939
940
941 --
942 -- TOC entry 100 (OID 540827)
943 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
944 --
945
946 ALTER TABLE ONLY users
947     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
948
949
950 --
951 -- TOC entry 101 (OID 540837)
952 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
953 --
954
955 ALTER TABLE ONLY usercookies
956     ADD CONSTRAINT "$1" FOREIGN KEY (userid) REFERENCES users(id);
957
958
959 --
960 -- TOC entry 91 (OID 540942)
961 -- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: rich
962 --
963
964 ALTER TABLE ONLY pages
965     ADD CONSTRAINT "$2" FOREIGN KEY (logged_user) REFERENCES users(id);
966
967
968 --
969 -- TOC entry 92 (OID 540947)
970 -- Name: pages_user_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
971 --
972
973 ALTER TABLE ONLY pages
974     ADD CONSTRAINT pages_user_cn FOREIGN KEY (hostid, logged_user) REFERENCES users(hostid, id);
975
976
977 --
978 -- TOC entry 102 (OID 540966)
979 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
980 --
981
982 ALTER TABLE ONLY sitemenu
983     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
984
985
986 --
987 -- TOC entry 103 (OID 540972)
988 -- Name: sitemenu_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
989 --
990
991 ALTER TABLE ONLY sitemenu
992     ADD CONSTRAINT sitemenu_url_cn FOREIGN KEY (hostid, url) REFERENCES pages(hostid, url) DEFERRABLE;
993
994
995 --
996 -- TOC entry 104 (OID 542613)
997 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
998 --
999
1000 ALTER TABLE ONLY contacts
1001     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
1002
1003
1004 --
1005 -- TOC entry 105 (OID 542622)
1006 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
1007 --
1008
1009 ALTER TABLE ONLY contact_emails
1010     ADD CONSTRAINT "$1" FOREIGN KEY (contactid) REFERENCES contacts(id);
1011
1012
1013 --
1014 -- TOC entry 95 (OID 543506)
1015 -- Name: hosts_theme_css_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
1016 --
1017
1018 ALTER TABLE ONLY hosts
1019     ADD CONSTRAINT hosts_theme_css_cn FOREIGN KEY (theme_css) REFERENCES themes(theme_css);
1020
1021
1022 --
1023 -- TOC entry 106 (OID 543759)
1024 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
1025 --
1026
1027 ALTER TABLE ONLY page_emails
1028     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
1029
1030
1031 --
1032 -- TOC entry 107 (OID 543764)
1033 -- Name: page_emails_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
1034 --
1035
1036 ALTER TABLE ONLY page_emails
1037     ADD CONSTRAINT page_emails_url_cn FOREIGN KEY (hostid, url) REFERENCES pages(hostid, url) DEFERRABLE;
1038
1039
1040 --
1041 -- TOC entry 108 (OID 543791)
1042 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
1043 --
1044
1045 ALTER TABLE ONLY mailing_lists
1046     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
1047
1048
1049 --
1050 -- TOC entry 109 (OID 544450)
1051 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
1052 --
1053
1054 ALTER TABLE ONLY links
1055     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
1056
1057
1058 --
1059 -- TOC entry 110 (OID 544455)
1060 -- Name: links_from_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
1061 --
1062
1063 ALTER TABLE ONLY links
1064     ADD CONSTRAINT links_from_cn FOREIGN KEY (hostid, from_url) REFERENCES pages(hostid, url) DEFERRABLE;
1065
1066
1067 --
1068 -- TOC entry 111 (OID 551129)
1069 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
1070 --
1071
1072 ALTER TABLE ONLY recently_visited
1073     ADD CONSTRAINT "$1" FOREIGN KEY (userid) REFERENCES users(id);
1074
1075
1076 --
1077 -- TOC entry 112 (OID 551133)
1078 -- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: rich
1079 --
1080
1081 ALTER TABLE ONLY recently_visited
1082     ADD CONSTRAINT "$2" FOREIGN KEY (hostid) REFERENCES hosts(id);
1083
1084
1085 --
1086 -- TOC entry 113 (OID 551137)
1087 -- Name: recently_visited_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
1088 --
1089
1090 ALTER TABLE ONLY recently_visited
1091     ADD CONSTRAINT recently_visited_url_cn FOREIGN KEY (hostid, url) REFERENCES pages(hostid, url) DEFERRABLE;
1092
1093
1094 --
1095 -- TOC entry 114 (OID 551141)
1096 -- Name: recently_visited_userid_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
1097 --
1098
1099 ALTER TABLE ONLY recently_visited
1100     ADD CONSTRAINT recently_visited_userid_cn FOREIGN KEY (hostid, userid) REFERENCES users(hostid, id);
1101
1102
1103 --
1104 -- TOC entry 116 (OID 551690)
1105 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
1106 --
1107
1108 ALTER TABLE ONLY msg_references
1109     ADD CONSTRAINT "$1" FOREIGN KEY (message_id) REFERENCES messages(id);
1110
1111
1112 --
1113 -- TOC entry 115 (OID 551694)
1114 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
1115 --
1116
1117 ALTER TABLE ONLY messages
1118     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
1119
1120
1121 --
1122 -- TOC entry 3 (OID 2200)
1123 -- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
1124 --
1125
1126 COMMENT ON SCHEMA public IS 'Standard public namespace';
1127
1128
1129 --
1130 -- TOC entry 32 (OID 543592)
1131 -- Name: TABLE server_settings; Type: COMMENT; Schema: public; Owner: rich
1132 --
1133
1134 COMMENT ON TABLE server_settings IS 'This table contains global settings for the server.  There should be only one row in this table.  If you modify any setting, you must restart the webserver for the change to take effect.  The "version" field is intended to be some sort of database version, but is currently unused.';
1135
1136
1137 --
1138 -- PostgreSQL database dump
1139 --
1140
1141 SET client_encoding = 'UNICODE';
1142 SET check_function_bodies = false;
1143
1144 SET search_path = public, pg_catalog;
1145
1146 --
1147 -- Data for TOC entry 3 (OID 547939)
1148 -- Name: templates; Type: TABLE DATA; Schema: public; Owner: rich
1149 --
1150
1151 COPY templates (id, title_regexp, url_regexp, extension, ordering) FROM stdin;
1152 1       ^(199[0-9]|20[0-9][0-9])/(0[1-9]|1[0-2])/(0[1-9]|1[0-9]|2[0-9]|3[01])$  ^(199[0-9]|20[0-9][0-9])/(0[1-9]|1[0-2])/(0[1-9]|1[0-9]|2[0-9]|3[01])$  calendar        10
1153 3       ^(199[0-9]|20[0-9][0-9])/(0[1-9]|1[0-2])$       ^(199[0-9]|20[0-9][0-9])/(0[1-9]|1[0-2])$       calendar        20
1154 4       ^(199[0-9]|20[0-9][0-9])$       ^(199[0-9]|20[0-9][0-9])$       calendar        30
1155 \.
1156
1157
1158 --
1159 -- TOC entry 2 (OID 547937)
1160 -- Name: templates_id_seq; Type: SEQUENCE SET; Schema: public; Owner: rich
1161 --
1162
1163 SELECT pg_catalog.setval('templates_id_seq', 4, true);
1164
1165
1166 --
1167 -- PostgreSQL database dump
1168 --
1169
1170 SET client_encoding = 'UNICODE';
1171 SET check_function_bodies = false;
1172
1173 SET search_path = public, pg_catalog;
1174
1175 --
1176 -- Data for TOC entry 2 (OID 543499)
1177 -- Name: themes; Type: TABLE DATA; Schema: public; Owner: rich
1178 --
1179
1180 COPY themes (theme_css, name, description) FROM stdin;
1181 /_css/easyweb.css       Merjis Easy Web Marketing       This is the easy web marketing stylesheet developed by Merjis Ltd.  Please see http://www.merjis.com/
1182 /_css/basic.css Basic styles only       Only the most essential styles.  This is a good starting point if you want to completely restyle pages using site-specific CSS.
1183 \.
1184
1185