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