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