Updated schema to support {{shell}} extension.
[cocanwiki.git] / schema / cocanwiki.sql
1 --
2 -- PostgreSQL database dump
3 --
4
5 SET client_encoding = 'UNICODE';
6 SET check_function_bodies = false;
7
8 SET search_path = public, pg_catalog;
9
10 --
11 -- TOC entry 201 (OID 14911565)
12 -- Name: plpgsql_call_handler(); Type: FUNC PROCEDURAL LANGUAGE; Schema: public; Owner: postgres
13 --
14
15 CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler
16     AS '$libdir/plpgsql', 'plpgsql_call_handler'
17     LANGUAGE c;
18
19
20 --
21 -- TOC entry 122 (OID 14911566)
22 -- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: public; Owner: 
23 --
24
25 CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler;
26
27
28 --
29 -- TOC entry 4 (OID 2200)
30 -- Name: public; Type: ACL; Schema: -; Owner: postgres
31 --
32
33 REVOKE ALL ON SCHEMA public FROM PUBLIC;
34 REVOKE ALL ON SCHEMA public FROM postgres;
35 GRANT ALL ON SCHEMA public TO PUBLIC;
36
37
38 --
39 -- TOC entry 12 (OID 11524567)
40 -- Name: pg_ts_dict; Type: TABLE; Schema: public; Owner: postgres
41 --
42
43 CREATE TABLE pg_ts_dict (
44     dict_name text NOT NULL,
45     dict_init oid,
46     dict_initoption text,
47     dict_lexize oid NOT NULL,
48     dict_comment text
49 );
50
51
52 --
53 -- TOC entry 13 (OID 11524567)
54 -- Name: pg_ts_dict; Type: ACL; Schema: public; Owner: postgres
55 --
56
57 REVOKE ALL ON TABLE pg_ts_dict FROM PUBLIC;
58 GRANT SELECT ON TABLE pg_ts_dict TO rich;
59 GRANT SELECT ON TABLE pg_ts_dict TO "www-data";
60
61
62 --
63 -- TOC entry 123 (OID 11524574)
64 -- Name: lexize(oid, text); Type: FUNCTION; Schema: public; Owner: postgres
65 --
66
67 CREATE FUNCTION lexize(oid, text) RETURNS text[]
68     AS '$libdir/tsearch2', 'lexize'
69     LANGUAGE c STRICT;
70
71
72 --
73 -- TOC entry 124 (OID 11524575)
74 -- Name: lexize(text, text); Type: FUNCTION; Schema: public; Owner: postgres
75 --
76
77 CREATE FUNCTION lexize(text, text) RETURNS text[]
78     AS '$libdir/tsearch2', 'lexize_byname'
79     LANGUAGE c STRICT;
80
81
82 --
83 -- TOC entry 125 (OID 11524576)
84 -- Name: lexize(text); Type: FUNCTION; Schema: public; Owner: postgres
85 --
86
87 CREATE FUNCTION lexize(text) RETURNS text[]
88     AS '$libdir/tsearch2', 'lexize_bycurrent'
89     LANGUAGE c STRICT;
90
91
92 --
93 -- TOC entry 126 (OID 11524577)
94 -- Name: set_curdict(integer); Type: FUNCTION; Schema: public; Owner: postgres
95 --
96
97 CREATE FUNCTION set_curdict(integer) RETURNS void
98     AS '$libdir/tsearch2', 'set_curdict'
99     LANGUAGE c STRICT;
100
101
102 --
103 -- TOC entry 127 (OID 11524578)
104 -- Name: set_curdict(text); Type: FUNCTION; Schema: public; Owner: postgres
105 --
106
107 CREATE FUNCTION set_curdict(text) RETURNS void
108     AS '$libdir/tsearch2', 'set_curdict_byname'
109     LANGUAGE c STRICT;
110
111
112 --
113 -- TOC entry 128 (OID 11524579)
114 -- Name: dex_init(internal); Type: FUNCTION; Schema: public; Owner: postgres
115 --
116
117 CREATE FUNCTION dex_init(internal) RETURNS internal
118     AS '$libdir/tsearch2', 'dex_init'
119     LANGUAGE c;
120
121
122 --
123 -- TOC entry 129 (OID 11524580)
124 -- Name: dex_lexize(internal, internal, integer); Type: FUNCTION; Schema: public; Owner: postgres
125 --
126
127 CREATE FUNCTION dex_lexize(internal, internal, integer) RETURNS internal
128     AS '$libdir/tsearch2', 'dex_lexize'
129     LANGUAGE c STRICT;
130
131
132 --
133 -- TOC entry 130 (OID 11524582)
134 -- Name: snb_en_init(internal); Type: FUNCTION; Schema: public; Owner: postgres
135 --
136
137 CREATE FUNCTION snb_en_init(internal) RETURNS internal
138     AS '$libdir/tsearch2', 'snb_en_init'
139     LANGUAGE c;
140
141
142 --
143 -- TOC entry 131 (OID 11524583)
144 -- Name: snb_lexize(internal, internal, integer); Type: FUNCTION; Schema: public; Owner: postgres
145 --
146
147 CREATE FUNCTION snb_lexize(internal, internal, integer) RETURNS internal
148     AS '$libdir/tsearch2', 'snb_lexize'
149     LANGUAGE c STRICT;
150
151
152 --
153 -- TOC entry 132 (OID 11524585)
154 -- Name: snb_ru_init(internal); Type: FUNCTION; Schema: public; Owner: postgres
155 --
156
157 CREATE FUNCTION snb_ru_init(internal) RETURNS internal
158     AS '$libdir/tsearch2', 'snb_ru_init'
159     LANGUAGE c;
160
161
162 --
163 -- TOC entry 133 (OID 11524587)
164 -- Name: spell_init(internal); Type: FUNCTION; Schema: public; Owner: postgres
165 --
166
167 CREATE FUNCTION spell_init(internal) RETURNS internal
168     AS '$libdir/tsearch2', 'spell_init'
169     LANGUAGE c;
170
171
172 --
173 -- TOC entry 134 (OID 11524588)
174 -- Name: spell_lexize(internal, internal, integer); Type: FUNCTION; Schema: public; Owner: postgres
175 --
176
177 CREATE FUNCTION spell_lexize(internal, internal, integer) RETURNS internal
178     AS '$libdir/tsearch2', 'spell_lexize'
179     LANGUAGE c STRICT;
180
181
182 --
183 -- TOC entry 135 (OID 11524590)
184 -- Name: syn_init(internal); Type: FUNCTION; Schema: public; Owner: postgres
185 --
186
187 CREATE FUNCTION syn_init(internal) RETURNS internal
188     AS '$libdir/tsearch2', 'syn_init'
189     LANGUAGE c;
190
191
192 --
193 -- TOC entry 136 (OID 11524591)
194 -- Name: syn_lexize(internal, internal, integer); Type: FUNCTION; Schema: public; Owner: postgres
195 --
196
197 CREATE FUNCTION syn_lexize(internal, internal, integer) RETURNS internal
198     AS '$libdir/tsearch2', 'syn_lexize'
199     LANGUAGE c STRICT;
200
201
202 --
203 -- TOC entry 14 (OID 11524593)
204 -- Name: pg_ts_parser; Type: TABLE; Schema: public; Owner: postgres
205 --
206
207 CREATE TABLE pg_ts_parser (
208     prs_name text NOT NULL,
209     prs_start oid NOT NULL,
210     prs_nexttoken oid NOT NULL,
211     prs_end oid NOT NULL,
212     prs_headline oid NOT NULL,
213     prs_lextype oid NOT NULL,
214     prs_comment text
215 );
216
217
218 --
219 -- TOC entry 15 (OID 11524593)
220 -- Name: pg_ts_parser; Type: ACL; Schema: public; Owner: postgres
221 --
222
223 REVOKE ALL ON TABLE pg_ts_parser FROM PUBLIC;
224 GRANT SELECT ON TABLE pg_ts_parser TO rich;
225 GRANT SELECT ON TABLE pg_ts_parser TO "www-data";
226
227
228 --
229 -- TOC entry 5 (OID 11524601)
230 -- Name: tokentype; Type: TYPE; Schema: public; Owner: postgres
231 --
232
233 CREATE TYPE tokentype AS (
234         tokid integer,
235         alias text,
236         descr text
237 );
238
239
240 --
241 -- TOC entry 137 (OID 11524602)
242 -- Name: token_type(integer); Type: FUNCTION; Schema: public; Owner: postgres
243 --
244
245 CREATE FUNCTION token_type(integer) RETURNS SETOF tokentype
246     AS '$libdir/tsearch2', 'token_type'
247     LANGUAGE c STRICT;
248
249
250 --
251 -- TOC entry 138 (OID 11524603)
252 -- Name: token_type(text); Type: FUNCTION; Schema: public; Owner: postgres
253 --
254
255 CREATE FUNCTION token_type(text) RETURNS SETOF tokentype
256     AS '$libdir/tsearch2', 'token_type_byname'
257     LANGUAGE c STRICT;
258
259
260 --
261 -- TOC entry 139 (OID 11524604)
262 -- Name: token_type(); Type: FUNCTION; Schema: public; Owner: postgres
263 --
264
265 CREATE FUNCTION token_type() RETURNS SETOF tokentype
266     AS '$libdir/tsearch2', 'token_type_current'
267     LANGUAGE c STRICT;
268
269
270 --
271 -- TOC entry 140 (OID 11524605)
272 -- Name: set_curprs(integer); Type: FUNCTION; Schema: public; Owner: postgres
273 --
274
275 CREATE FUNCTION set_curprs(integer) RETURNS void
276     AS '$libdir/tsearch2', 'set_curprs'
277     LANGUAGE c STRICT;
278
279
280 --
281 -- TOC entry 141 (OID 11524606)
282 -- Name: set_curprs(text); Type: FUNCTION; Schema: public; Owner: postgres
283 --
284
285 CREATE FUNCTION set_curprs(text) RETURNS void
286     AS '$libdir/tsearch2', 'set_curprs_byname'
287     LANGUAGE c STRICT;
288
289
290 --
291 -- TOC entry 6 (OID 11524608)
292 -- Name: tokenout; Type: TYPE; Schema: public; Owner: postgres
293 --
294
295 CREATE TYPE tokenout AS (
296         tokid integer,
297         token text
298 );
299
300
301 --
302 -- TOC entry 142 (OID 11524609)
303 -- Name: parse(oid, text); Type: FUNCTION; Schema: public; Owner: postgres
304 --
305
306 CREATE FUNCTION parse(oid, text) RETURNS SETOF tokenout
307     AS '$libdir/tsearch2', 'parse'
308     LANGUAGE c STRICT;
309
310
311 --
312 -- TOC entry 143 (OID 11524610)
313 -- Name: parse(text, text); Type: FUNCTION; Schema: public; Owner: postgres
314 --
315
316 CREATE FUNCTION parse(text, text) RETURNS SETOF tokenout
317     AS '$libdir/tsearch2', 'parse_byname'
318     LANGUAGE c STRICT;
319
320
321 --
322 -- TOC entry 144 (OID 11524611)
323 -- Name: parse(text); Type: FUNCTION; Schema: public; Owner: postgres
324 --
325
326 CREATE FUNCTION parse(text) RETURNS SETOF tokenout
327     AS '$libdir/tsearch2', 'parse_current'
328     LANGUAGE c STRICT;
329
330
331 --
332 -- TOC entry 145 (OID 11524612)
333 -- Name: prsd_start(internal, integer); Type: FUNCTION; Schema: public; Owner: postgres
334 --
335
336 CREATE FUNCTION prsd_start(internal, integer) RETURNS internal
337     AS '$libdir/tsearch2', 'prsd_start'
338     LANGUAGE c;
339
340
341 --
342 -- TOC entry 146 (OID 11524613)
343 -- Name: prsd_getlexeme(internal, internal, internal); Type: FUNCTION; Schema: public; Owner: postgres
344 --
345
346 CREATE FUNCTION prsd_getlexeme(internal, internal, internal) RETURNS integer
347     AS '$libdir/tsearch2', 'prsd_getlexeme'
348     LANGUAGE c;
349
350
351 --
352 -- TOC entry 147 (OID 11524614)
353 -- Name: prsd_end(internal); Type: FUNCTION; Schema: public; Owner: postgres
354 --
355
356 CREATE FUNCTION prsd_end(internal) RETURNS void
357     AS '$libdir/tsearch2', 'prsd_end'
358     LANGUAGE c;
359
360
361 --
362 -- TOC entry 148 (OID 11524615)
363 -- Name: prsd_lextype(internal); Type: FUNCTION; Schema: public; Owner: postgres
364 --
365
366 CREATE FUNCTION prsd_lextype(internal) RETURNS internal
367     AS '$libdir/tsearch2', 'prsd_lextype'
368     LANGUAGE c;
369
370
371 --
372 -- TOC entry 149 (OID 11524616)
373 -- Name: prsd_headline(internal, internal, internal); Type: FUNCTION; Schema: public; Owner: postgres
374 --
375
376 CREATE FUNCTION prsd_headline(internal, internal, internal) RETURNS internal
377     AS '$libdir/tsearch2', 'prsd_headline'
378     LANGUAGE c;
379
380
381 --
382 -- TOC entry 16 (OID 11524618)
383 -- Name: pg_ts_cfg; Type: TABLE; Schema: public; Owner: postgres
384 --
385
386 CREATE TABLE pg_ts_cfg (
387     ts_name text NOT NULL,
388     prs_name text NOT NULL,
389     locale text
390 );
391
392
393 --
394 -- TOC entry 17 (OID 11524618)
395 -- Name: pg_ts_cfg; Type: ACL; Schema: public; Owner: postgres
396 --
397
398 REVOKE ALL ON TABLE pg_ts_cfg FROM PUBLIC;
399 GRANT SELECT ON TABLE pg_ts_cfg TO rich;
400 GRANT SELECT ON TABLE pg_ts_cfg TO "www-data";
401
402
403 --
404 -- TOC entry 18 (OID 11524625)
405 -- Name: pg_ts_cfgmap; Type: TABLE; Schema: public; Owner: postgres
406 --
407
408 CREATE TABLE pg_ts_cfgmap (
409     ts_name text NOT NULL,
410     tok_alias text NOT NULL,
411     dict_name text[]
412 );
413
414
415 --
416 -- TOC entry 19 (OID 11524625)
417 -- Name: pg_ts_cfgmap; Type: ACL; Schema: public; Owner: postgres
418 --
419
420 REVOKE ALL ON TABLE pg_ts_cfgmap FROM PUBLIC;
421 GRANT SELECT ON TABLE pg_ts_cfgmap TO rich;
422 GRANT SELECT ON TABLE pg_ts_cfgmap TO "www-data";
423
424
425 --
426 -- TOC entry 150 (OID 11524632)
427 -- Name: set_curcfg(integer); Type: FUNCTION; Schema: public; Owner: postgres
428 --
429
430 CREATE FUNCTION set_curcfg(integer) RETURNS void
431     AS '$libdir/tsearch2', 'set_curcfg'
432     LANGUAGE c STRICT;
433
434
435 --
436 -- TOC entry 151 (OID 11524633)
437 -- Name: set_curcfg(text); Type: FUNCTION; Schema: public; Owner: postgres
438 --
439
440 CREATE FUNCTION set_curcfg(text) RETURNS void
441     AS '$libdir/tsearch2', 'set_curcfg_byname'
442     LANGUAGE c STRICT;
443
444
445 --
446 -- TOC entry 152 (OID 11524634)
447 -- Name: show_curcfg(); Type: FUNCTION; Schema: public; Owner: postgres
448 --
449
450 CREATE FUNCTION show_curcfg() RETURNS oid
451     AS '$libdir/tsearch2', 'show_curcfg'
452     LANGUAGE c STRICT;
453
454
455 --
456 -- TOC entry 153 (OID 11524696)
457 -- Name: tsvector_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres
458 --
459
460 CREATE FUNCTION tsvector_in(cstring) RETURNS tsvector
461     AS '$libdir/tsearch2', 'tsvector_in'
462     LANGUAGE c STRICT;
463
464
465 --
466 -- TOC entry 154 (OID 11524697)
467 -- Name: tsvector_out(tsvector); Type: FUNCTION; Schema: public; Owner: postgres
468 --
469
470 CREATE FUNCTION tsvector_out(tsvector) RETURNS cstring
471     AS '$libdir/tsearch2', 'tsvector_out'
472     LANGUAGE c STRICT;
473
474
475 --
476 -- TOC entry 7 (OID 11524695)
477 -- Name: tsvector; Type: TYPE; Schema: public; Owner: postgres
478 --
479
480 CREATE TYPE tsvector (
481     INTERNALLENGTH = variable,
482     INPUT = tsvector_in,
483     OUTPUT = tsvector_out,
484     ALIGNMENT = int4,
485     STORAGE = extended
486 );
487
488
489 --
490 -- TOC entry 155 (OID 11524699)
491 -- Name: length(tsvector); Type: FUNCTION; Schema: public; Owner: postgres
492 --
493
494 CREATE FUNCTION length(tsvector) RETURNS integer
495     AS '$libdir/tsearch2', 'tsvector_length'
496     LANGUAGE c IMMUTABLE STRICT;
497
498
499 --
500 -- TOC entry 156 (OID 11524700)
501 -- Name: to_tsvector(oid, text); Type: FUNCTION; Schema: public; Owner: postgres
502 --
503
504 CREATE FUNCTION to_tsvector(oid, text) RETURNS tsvector
505     AS '$libdir/tsearch2', 'to_tsvector'
506     LANGUAGE c IMMUTABLE STRICT;
507
508
509 --
510 -- TOC entry 157 (OID 11524701)
511 -- Name: to_tsvector(text, text); Type: FUNCTION; Schema: public; Owner: postgres
512 --
513
514 CREATE FUNCTION to_tsvector(text, text) RETURNS tsvector
515     AS '$libdir/tsearch2', 'to_tsvector_name'
516     LANGUAGE c IMMUTABLE STRICT;
517
518
519 --
520 -- TOC entry 158 (OID 11524702)
521 -- Name: to_tsvector(text); Type: FUNCTION; Schema: public; Owner: postgres
522 --
523
524 CREATE FUNCTION to_tsvector(text) RETURNS tsvector
525     AS '$libdir/tsearch2', 'to_tsvector_current'
526     LANGUAGE c IMMUTABLE STRICT;
527
528
529 --
530 -- TOC entry 159 (OID 11524703)
531 -- Name: strip(tsvector); Type: FUNCTION; Schema: public; Owner: postgres
532 --
533
534 CREATE FUNCTION strip(tsvector) RETURNS tsvector
535     AS '$libdir/tsearch2', 'strip'
536     LANGUAGE c IMMUTABLE STRICT;
537
538
539 --
540 -- TOC entry 160 (OID 11524704)
541 -- Name: setweight(tsvector, "char"); Type: FUNCTION; Schema: public; Owner: postgres
542 --
543
544 CREATE FUNCTION setweight(tsvector, "char") RETURNS tsvector
545     AS '$libdir/tsearch2', 'setweight'
546     LANGUAGE c IMMUTABLE STRICT;
547
548
549 --
550 -- TOC entry 161 (OID 11524705)
551 -- Name: concat(tsvector, tsvector); Type: FUNCTION; Schema: public; Owner: postgres
552 --
553
554 CREATE FUNCTION concat(tsvector, tsvector) RETURNS tsvector
555     AS '$libdir/tsearch2', 'concat'
556     LANGUAGE c IMMUTABLE STRICT;
557
558
559 --
560 -- TOC entry 203 (OID 11524706)
561 -- Name: ||; Type: OPERATOR; Schema: public; Owner: postgres
562 --
563
564 CREATE OPERATOR || (
565     PROCEDURE = concat,
566     LEFTARG = tsvector,
567     RIGHTARG = tsvector
568 );
569
570
571 --
572 -- TOC entry 162 (OID 11524708)
573 -- Name: tsquery_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres
574 --
575
576 CREATE FUNCTION tsquery_in(cstring) RETURNS tsquery
577     AS '$libdir/tsearch2', 'tsquery_in'
578     LANGUAGE c STRICT;
579
580
581 --
582 -- TOC entry 163 (OID 11524709)
583 -- Name: tsquery_out(tsquery); Type: FUNCTION; Schema: public; Owner: postgres
584 --
585
586 CREATE FUNCTION tsquery_out(tsquery) RETURNS cstring
587     AS '$libdir/tsearch2', 'tsquery_out'
588     LANGUAGE c STRICT;
589
590
591 --
592 -- TOC entry 8 (OID 11524707)
593 -- Name: tsquery; Type: TYPE; Schema: public; Owner: postgres
594 --
595
596 CREATE TYPE tsquery (
597     INTERNALLENGTH = variable,
598     INPUT = tsquery_in,
599     OUTPUT = tsquery_out,
600     ALIGNMENT = int4,
601     STORAGE = plain
602 );
603
604
605 --
606 -- TOC entry 164 (OID 11524711)
607 -- Name: querytree(tsquery); Type: FUNCTION; Schema: public; Owner: postgres
608 --
609
610 CREATE FUNCTION querytree(tsquery) RETURNS text
611     AS '$libdir/tsearch2', 'tsquerytree'
612     LANGUAGE c STRICT;
613
614
615 --
616 -- TOC entry 165 (OID 11524712)
617 -- Name: to_tsquery(oid, text); Type: FUNCTION; Schema: public; Owner: postgres
618 --
619
620 CREATE FUNCTION to_tsquery(oid, text) RETURNS tsquery
621     AS '$libdir/tsearch2', 'to_tsquery'
622     LANGUAGE c IMMUTABLE STRICT;
623
624
625 --
626 -- TOC entry 166 (OID 11524713)
627 -- Name: to_tsquery(text, text); Type: FUNCTION; Schema: public; Owner: postgres
628 --
629
630 CREATE FUNCTION to_tsquery(text, text) RETURNS tsquery
631     AS '$libdir/tsearch2', 'to_tsquery_name'
632     LANGUAGE c IMMUTABLE STRICT;
633
634
635 --
636 -- TOC entry 167 (OID 11524714)
637 -- Name: to_tsquery(text); Type: FUNCTION; Schema: public; Owner: postgres
638 --
639
640 CREATE FUNCTION to_tsquery(text) RETURNS tsquery
641     AS '$libdir/tsearch2', 'to_tsquery_current'
642     LANGUAGE c IMMUTABLE STRICT;
643
644
645 --
646 -- TOC entry 168 (OID 11524715)
647 -- Name: exectsq(tsvector, tsquery); Type: FUNCTION; Schema: public; Owner: postgres
648 --
649
650 CREATE FUNCTION exectsq(tsvector, tsquery) RETURNS boolean
651     AS '$libdir/tsearch2', 'exectsq'
652     LANGUAGE c IMMUTABLE STRICT;
653
654
655 --
656 -- TOC entry 170 (OID 11524716)
657 -- Name: rexectsq(tsquery, tsvector); Type: FUNCTION; Schema: public; Owner: postgres
658 --
659
660 CREATE FUNCTION rexectsq(tsquery, tsvector) RETURNS boolean
661     AS '$libdir/tsearch2', 'rexectsq'
662     LANGUAGE c IMMUTABLE STRICT;
663
664
665 --
666 -- TOC entry 205 (OID 11524717)
667 -- Name: @@; Type: OPERATOR; Schema: public; Owner: postgres
668 --
669
670 CREATE OPERATOR @@ (
671     PROCEDURE = rexectsq,
672     LEFTARG = tsquery,
673     RIGHTARG = tsvector,
674     COMMUTATOR = @@,
675     RESTRICT = contsel,
676     JOIN = contjoinsel
677 );
678
679
680 --
681 -- TOC entry 204 (OID 11524718)
682 -- Name: @@; Type: OPERATOR; Schema: public; Owner: postgres
683 --
684
685 CREATE OPERATOR @@ (
686     PROCEDURE = exectsq,
687     LEFTARG = tsvector,
688     RIGHTARG = tsquery,
689     COMMUTATOR = @@,
690     RESTRICT = contsel,
691     JOIN = contjoinsel
692 );
693
694
695 --
696 -- TOC entry 172 (OID 11524719)
697 -- Name: tsearch2(); Type: FUNCTION; Schema: public; Owner: postgres
698 --
699
700 CREATE FUNCTION tsearch2() RETURNS "trigger"
701     AS '$libdir/tsearch2', 'tsearch2'
702     LANGUAGE c;
703
704
705 --
706 -- TOC entry 173 (OID 11524720)
707 -- Name: rank(real[], tsvector, tsquery); Type: FUNCTION; Schema: public; Owner: postgres
708 --
709
710 CREATE FUNCTION rank(real[], tsvector, tsquery) RETURNS real
711     AS '$libdir/tsearch2', 'rank'
712     LANGUAGE c IMMUTABLE STRICT;
713
714
715 --
716 -- TOC entry 174 (OID 11524721)
717 -- Name: rank(real[], tsvector, tsquery, integer); Type: FUNCTION; Schema: public; Owner: postgres
718 --
719
720 CREATE FUNCTION rank(real[], tsvector, tsquery, integer) RETURNS real
721     AS '$libdir/tsearch2', 'rank'
722     LANGUAGE c IMMUTABLE STRICT;
723
724
725 --
726 -- TOC entry 175 (OID 11524722)
727 -- Name: rank(tsvector, tsquery); Type: FUNCTION; Schema: public; Owner: postgres
728 --
729
730 CREATE FUNCTION rank(tsvector, tsquery) RETURNS real
731     AS '$libdir/tsearch2', 'rank_def'
732     LANGUAGE c IMMUTABLE STRICT;
733
734
735 --
736 -- TOC entry 176 (OID 11524723)
737 -- Name: rank(tsvector, tsquery, integer); Type: FUNCTION; Schema: public; Owner: postgres
738 --
739
740 CREATE FUNCTION rank(tsvector, tsquery, integer) RETURNS real
741     AS '$libdir/tsearch2', 'rank_def'
742     LANGUAGE c IMMUTABLE STRICT;
743
744
745 --
746 -- TOC entry 177 (OID 11524724)
747 -- Name: rank_cd(integer, tsvector, tsquery); Type: FUNCTION; Schema: public; Owner: postgres
748 --
749
750 CREATE FUNCTION rank_cd(integer, tsvector, tsquery) RETURNS real
751     AS '$libdir/tsearch2', 'rank_cd'
752     LANGUAGE c IMMUTABLE STRICT;
753
754
755 --
756 -- TOC entry 178 (OID 11524725)
757 -- Name: rank_cd(integer, tsvector, tsquery, integer); Type: FUNCTION; Schema: public; Owner: postgres
758 --
759
760 CREATE FUNCTION rank_cd(integer, tsvector, tsquery, integer) RETURNS real
761     AS '$libdir/tsearch2', 'rank_cd'
762     LANGUAGE c IMMUTABLE STRICT;
763
764
765 --
766 -- TOC entry 179 (OID 11524726)
767 -- Name: rank_cd(tsvector, tsquery); Type: FUNCTION; Schema: public; Owner: postgres
768 --
769
770 CREATE FUNCTION rank_cd(tsvector, tsquery) RETURNS real
771     AS '$libdir/tsearch2', 'rank_cd_def'
772     LANGUAGE c IMMUTABLE STRICT;
773
774
775 --
776 -- TOC entry 180 (OID 11524727)
777 -- Name: rank_cd(tsvector, tsquery, integer); Type: FUNCTION; Schema: public; Owner: postgres
778 --
779
780 CREATE FUNCTION rank_cd(tsvector, tsquery, integer) RETURNS real
781     AS '$libdir/tsearch2', 'rank_cd_def'
782     LANGUAGE c IMMUTABLE STRICT;
783
784
785 --
786 -- TOC entry 181 (OID 11524728)
787 -- Name: headline(oid, text, tsquery, text); Type: FUNCTION; Schema: public; Owner: postgres
788 --
789
790 CREATE FUNCTION headline(oid, text, tsquery, text) RETURNS text
791     AS '$libdir/tsearch2', 'headline'
792     LANGUAGE c IMMUTABLE STRICT;
793
794
795 --
796 -- TOC entry 182 (OID 11524729)
797 -- Name: headline(oid, text, tsquery); Type: FUNCTION; Schema: public; Owner: postgres
798 --
799
800 CREATE FUNCTION headline(oid, text, tsquery) RETURNS text
801     AS '$libdir/tsearch2', 'headline'
802     LANGUAGE c IMMUTABLE STRICT;
803
804
805 --
806 -- TOC entry 183 (OID 11524730)
807 -- Name: headline(text, text, tsquery, text); Type: FUNCTION; Schema: public; Owner: postgres
808 --
809
810 CREATE FUNCTION headline(text, text, tsquery, text) RETURNS text
811     AS '$libdir/tsearch2', 'headline_byname'
812     LANGUAGE c IMMUTABLE STRICT;
813
814
815 --
816 -- TOC entry 184 (OID 11524731)
817 -- Name: headline(text, text, tsquery); Type: FUNCTION; Schema: public; Owner: postgres
818 --
819
820 CREATE FUNCTION headline(text, text, tsquery) RETURNS text
821     AS '$libdir/tsearch2', 'headline_byname'
822     LANGUAGE c IMMUTABLE STRICT;
823
824
825 --
826 -- TOC entry 185 (OID 11524732)
827 -- Name: headline(text, tsquery, text); Type: FUNCTION; Schema: public; Owner: postgres
828 --
829
830 CREATE FUNCTION headline(text, tsquery, text) RETURNS text
831     AS '$libdir/tsearch2', 'headline_current'
832     LANGUAGE c IMMUTABLE STRICT;
833
834
835 --
836 -- TOC entry 186 (OID 11524733)
837 -- Name: headline(text, tsquery); Type: FUNCTION; Schema: public; Owner: postgres
838 --
839
840 CREATE FUNCTION headline(text, tsquery) RETURNS text
841     AS '$libdir/tsearch2', 'headline_current'
842     LANGUAGE c IMMUTABLE STRICT;
843
844
845 --
846 -- TOC entry 187 (OID 11524735)
847 -- Name: gtsvector_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres
848 --
849
850 CREATE FUNCTION gtsvector_in(cstring) RETURNS gtsvector
851     AS '$libdir/tsearch2', 'gtsvector_in'
852     LANGUAGE c STRICT;
853
854
855 --
856 -- TOC entry 188 (OID 11524736)
857 -- Name: gtsvector_out(gtsvector); Type: FUNCTION; Schema: public; Owner: postgres
858 --
859
860 CREATE FUNCTION gtsvector_out(gtsvector) RETURNS cstring
861     AS '$libdir/tsearch2', 'gtsvector_out'
862     LANGUAGE c STRICT;
863
864
865 --
866 -- TOC entry 9 (OID 11524734)
867 -- Name: gtsvector; Type: TYPE; Schema: public; Owner: postgres
868 --
869
870 CREATE TYPE gtsvector (
871     INTERNALLENGTH = variable,
872     INPUT = gtsvector_in,
873     OUTPUT = gtsvector_out,
874     ALIGNMENT = int4,
875     STORAGE = plain
876 );
877
878
879 --
880 -- TOC entry 189 (OID 11524738)
881 -- Name: gtsvector_consistent(gtsvector, internal, integer); Type: FUNCTION; Schema: public; Owner: postgres
882 --
883
884 CREATE FUNCTION gtsvector_consistent(gtsvector, internal, integer) RETURNS boolean
885     AS '$libdir/tsearch2', 'gtsvector_consistent'
886     LANGUAGE c;
887
888
889 --
890 -- TOC entry 190 (OID 11524739)
891 -- Name: gtsvector_compress(internal); Type: FUNCTION; Schema: public; Owner: postgres
892 --
893
894 CREATE FUNCTION gtsvector_compress(internal) RETURNS internal
895     AS '$libdir/tsearch2', 'gtsvector_compress'
896     LANGUAGE c;
897
898
899 --
900 -- TOC entry 191 (OID 11524740)
901 -- Name: gtsvector_decompress(internal); Type: FUNCTION; Schema: public; Owner: postgres
902 --
903
904 CREATE FUNCTION gtsvector_decompress(internal) RETURNS internal
905     AS '$libdir/tsearch2', 'gtsvector_decompress'
906     LANGUAGE c;
907
908
909 --
910 -- TOC entry 192 (OID 11524741)
911 -- Name: gtsvector_penalty(internal, internal, internal); Type: FUNCTION; Schema: public; Owner: postgres
912 --
913
914 CREATE FUNCTION gtsvector_penalty(internal, internal, internal) RETURNS internal
915     AS '$libdir/tsearch2', 'gtsvector_penalty'
916     LANGUAGE c STRICT;
917
918
919 --
920 -- TOC entry 193 (OID 11524742)
921 -- Name: gtsvector_picksplit(internal, internal); Type: FUNCTION; Schema: public; Owner: postgres
922 --
923
924 CREATE FUNCTION gtsvector_picksplit(internal, internal) RETURNS internal
925     AS '$libdir/tsearch2', 'gtsvector_picksplit'
926     LANGUAGE c;
927
928
929 --
930 -- TOC entry 194 (OID 11524743)
931 -- Name: gtsvector_union(bytea, internal); Type: FUNCTION; Schema: public; Owner: postgres
932 --
933
934 CREATE FUNCTION gtsvector_union(bytea, internal) RETURNS integer[]
935     AS '$libdir/tsearch2', 'gtsvector_union'
936     LANGUAGE c;
937
938
939 --
940 -- TOC entry 195 (OID 11524744)
941 -- Name: gtsvector_same(gtsvector, gtsvector, internal); Type: FUNCTION; Schema: public; Owner: postgres
942 --
943
944 CREATE FUNCTION gtsvector_same(gtsvector, gtsvector, internal) RETURNS internal
945     AS '$libdir/tsearch2', 'gtsvector_same'
946     LANGUAGE c;
947
948
949 --
950 -- TOC entry 206 (OID 11524745)
951 -- Name: gist_tsvector_ops; Type: OPERATOR CLASS; Schema: public; Owner: postgres
952 --
953
954 CREATE OPERATOR CLASS gist_tsvector_ops
955     DEFAULT FOR TYPE tsvector USING gist AS
956     STORAGE gtsvector ,
957     OPERATOR 1 @@(tsvector,tsquery) RECHECK ,
958     FUNCTION 1 gtsvector_consistent(gtsvector,internal,integer) ,
959     FUNCTION 2 gtsvector_union(bytea,internal) ,
960     FUNCTION 3 gtsvector_compress(internal) ,
961     FUNCTION 4 gtsvector_decompress(internal) ,
962     FUNCTION 5 gtsvector_penalty(internal,internal,internal) ,
963     FUNCTION 6 gtsvector_picksplit(internal,internal) ,
964     FUNCTION 7 gtsvector_same(gtsvector,gtsvector,internal);
965
966
967 --
968 -- TOC entry 10 (OID 11524747)
969 -- Name: statinfo; Type: TYPE; Schema: public; Owner: postgres
970 --
971
972 CREATE TYPE statinfo AS (
973         word text,
974         ndoc integer,
975         nentry integer
976 );
977
978
979 --
980 -- TOC entry 196 (OID 11524748)
981 -- Name: stat(text); Type: FUNCTION; Schema: public; Owner: postgres
982 --
983
984 CREATE FUNCTION stat(text) RETURNS SETOF statinfo
985     AS '$libdir/tsearch2', 'ts_stat'
986     LANGUAGE c STRICT;
987
988
989 --
990 -- TOC entry 197 (OID 11524749)
991 -- Name: reset_tsearch(); Type: FUNCTION; Schema: public; Owner: postgres
992 --
993
994 CREATE FUNCTION reset_tsearch() RETURNS void
995     AS '$libdir/tsearch2', 'reset_tsearch'
996     LANGUAGE c STRICT;
997
998
999 --
1000 -- TOC entry 198 (OID 11524750)
1001 -- Name: get_covers(tsvector, tsquery); Type: FUNCTION; Schema: public; Owner: postgres
1002 --
1003
1004 CREATE FUNCTION get_covers(tsvector, tsquery) RETURNS text
1005     AS '$libdir/tsearch2', 'get_covers'
1006     LANGUAGE c STRICT;
1007
1008
1009 --
1010 -- TOC entry 11 (OID 11524752)
1011 -- Name: tsdebug; Type: TYPE; Schema: public; Owner: postgres
1012 --
1013
1014 CREATE TYPE tsdebug AS (
1015         ts_name text,
1016         tok_type text,
1017         description text,
1018         token text,
1019         dict_name text[],
1020         tsvector tsvector
1021 );
1022
1023
1024 --
1025 -- TOC entry 199 (OID 11524753)
1026 -- Name: _get_parser_from_curcfg(); Type: FUNCTION; Schema: public; Owner: postgres
1027 --
1028
1029 CREATE FUNCTION _get_parser_from_curcfg() RETURNS text
1030     AS ' select prs_name from pg_ts_cfg where oid = show_curcfg() '
1031     LANGUAGE sql IMMUTABLE STRICT;
1032
1033
1034 --
1035 -- TOC entry 200 (OID 11524754)
1036 -- Name: ts_debug(text); Type: FUNCTION; Schema: public; Owner: postgres
1037 --
1038
1039 CREATE FUNCTION ts_debug(text) RETURNS SETOF tsdebug
1040     AS '
1041 select 
1042         m.ts_name,
1043         t.alias as tok_type,
1044         t.descr as description,
1045         p.token,
1046         m.dict_name,
1047         strip(to_tsvector(p.token)) as tsvector
1048 from
1049         parse( _get_parser_from_curcfg(), $1 ) as p,
1050         token_type() as t,
1051         pg_ts_cfgmap as m,
1052         pg_ts_cfg as c
1053 where
1054         t.tokid=p.tokid and
1055         t.alias = m.tok_alias and 
1056         m.ts_name=c.ts_name and 
1057         c.oid=show_curcfg() 
1058 '
1059     LANGUAGE sql STRICT;
1060
1061
1062 --
1063 -- TOC entry 20 (OID 11524757)
1064 -- Name: pages; Type: TABLE; Schema: public; Owner: rich
1065 --
1066
1067 CREATE TABLE pages (
1068     id serial NOT NULL,
1069     url text,
1070     url_deleted text,
1071     title text NOT NULL,
1072     description text NOT NULL,
1073     creation_date timestamp without time zone DEFAULT ('now'::text)::timestamp(6) with time zone NOT NULL,
1074     last_modified_date timestamp without time zone DEFAULT ('now'::text)::timestamp(6) with time zone NOT NULL,
1075     hostid integer NOT NULL,
1076     logged_ip text,
1077     redirect text,
1078     css text,
1079     logged_user integer,
1080     title_description_fti tsvector NOT NULL,
1081     keywords text,
1082     noodp boolean
1083 );
1084
1085
1086 --
1087 -- TOC entry 21 (OID 11524757)
1088 -- Name: pages; Type: ACL; Schema: public; Owner: rich
1089 --
1090
1091 REVOKE ALL ON TABLE pages FROM PUBLIC;
1092 GRANT ALL ON TABLE pages TO "www-data";
1093
1094
1095 --
1096 -- TOC entry 69 (OID 11524757)
1097 -- Name: pages_id_seq; Type: ACL; Schema: public; Owner: rich
1098 --
1099
1100 REVOKE ALL ON TABLE pages_id_seq FROM PUBLIC;
1101 GRANT ALL ON TABLE pages_id_seq TO "www-data";
1102
1103
1104 --
1105 -- TOC entry 22 (OID 11524767)
1106 -- Name: contents; Type: TABLE; Schema: public; Owner: rich
1107 --
1108
1109 CREATE TABLE contents (
1110     id serial NOT NULL,
1111     pageid integer NOT NULL,
1112     ordering integer NOT NULL,
1113     sectionname text,
1114     content text NOT NULL,
1115     divname text,
1116     content_fti tsvector NOT NULL,
1117     jsgo text,
1118     divclass text,
1119     CONSTRAINT "$2" CHECK (((jsgo IS NULL) OR ((divname IS NOT NULL) OR (divclass IS NOT NULL))))
1120 );
1121
1122
1123 --
1124 -- TOC entry 23 (OID 11524767)
1125 -- Name: contents; Type: ACL; Schema: public; Owner: rich
1126 --
1127
1128 REVOKE ALL ON TABLE contents FROM PUBLIC;
1129 GRANT ALL ON TABLE contents TO "www-data";
1130
1131
1132 --
1133 -- TOC entry 70 (OID 11524767)
1134 -- Name: contents_id_seq; Type: ACL; Schema: public; Owner: rich
1135 --
1136
1137 REVOKE ALL ON TABLE contents_id_seq FROM PUBLIC;
1138 GRANT ALL ON TABLE contents_id_seq TO "www-data";
1139
1140
1141 --
1142 -- TOC entry 24 (OID 11524775)
1143 -- Name: hosts; Type: TABLE; Schema: public; Owner: rich
1144 --
1145
1146 CREATE TABLE hosts (
1147     id serial NOT NULL,
1148     canonical_hostname text NOT NULL,
1149     css text,
1150     edit_anon boolean DEFAULT true NOT NULL,
1151     create_account_anon boolean DEFAULT true NOT NULL,
1152     theme_css text,
1153     feedback_email text,
1154     mailing_list boolean DEFAULT false NOT NULL,
1155     is_template boolean DEFAULT false NOT NULL,
1156     search_box boolean DEFAULT true NOT NULL,
1157     view_anon boolean DEFAULT true NOT NULL,
1158     navigation boolean DEFAULT false NOT NULL,
1159     powered_by integer,
1160     brand text,
1161     brand_tagline text,
1162     brand_description text,
1163     pagebug text,
1164     ie_imagetoolbar_no boolean DEFAULT false NOT NULL,
1165     global_noodp boolean DEFAULT false NOT NULL,
1166     ie6_fixes_css text,
1167     ie7_fixes_css text,
1168     enable_rss_func boolean DEFAULT false NOT NULL,
1169     enable_shell_func boolean DEFAULT false NOT NULL,
1170     enable_shell_func_path text DEFAULT '/path/to/nowhere'::text
1171 );
1172
1173
1174 --
1175 -- TOC entry 25 (OID 11524775)
1176 -- Name: hosts; Type: ACL; Schema: public; Owner: rich
1177 --
1178
1179 REVOKE ALL ON TABLE hosts FROM PUBLIC;
1180 GRANT ALL ON TABLE hosts TO "www-data";
1181
1182
1183 --
1184 -- TOC entry 71 (OID 11524775)
1185 -- Name: hosts_id_seq; Type: ACL; Schema: public; Owner: rich
1186 --
1187
1188 REVOKE ALL ON TABLE hosts_id_seq FROM PUBLIC;
1189 GRANT ALL ON TABLE hosts_id_seq TO "www-data";
1190
1191
1192 --
1193 -- TOC entry 26 (OID 11524788)
1194 -- Name: hostnames; Type: TABLE; Schema: public; Owner: rich
1195 --
1196
1197 CREATE TABLE hostnames (
1198     hostid integer NOT NULL,
1199     name text NOT NULL
1200 );
1201
1202
1203 --
1204 -- TOC entry 27 (OID 11524788)
1205 -- Name: hostnames; Type: ACL; Schema: public; Owner: rich
1206 --
1207
1208 REVOKE ALL ON TABLE hostnames FROM PUBLIC;
1209 GRANT ALL ON TABLE hostnames TO "www-data";
1210
1211
1212 --
1213 -- TOC entry 28 (OID 11524795)
1214 -- Name: images; Type: TABLE; Schema: public; Owner: rich
1215 --
1216
1217 CREATE TABLE images (
1218     id serial NOT NULL,
1219     hostid integer NOT NULL,
1220     name text,
1221     name_deleted text,
1222     image bytea NOT NULL,
1223     width integer NOT NULL,
1224     height integer NOT NULL,
1225     alt text NOT NULL,
1226     title text,
1227     longdesc text,
1228     "class" text,
1229     mime_type text NOT NULL,
1230     thumbnail bytea,
1231     tn_width integer,
1232     tn_height integer,
1233     tn_mime_type text,
1234     upload_date timestamp without time zone DEFAULT ('now'::text)::timestamp(6) with time zone NOT NULL
1235 );
1236
1237
1238 --
1239 -- TOC entry 29 (OID 11524795)
1240 -- Name: images; Type: ACL; Schema: public; Owner: rich
1241 --
1242
1243 REVOKE ALL ON TABLE images FROM PUBLIC;
1244 GRANT ALL ON TABLE images TO "www-data";
1245
1246
1247 --
1248 -- TOC entry 72 (OID 11524795)
1249 -- Name: images_id_seq; Type: ACL; Schema: public; Owner: rich
1250 --
1251
1252 REVOKE ALL ON TABLE images_id_seq FROM PUBLIC;
1253 GRANT ALL ON TABLE images_id_seq TO "www-data";
1254
1255
1256 --
1257 -- TOC entry 30 (OID 11524804)
1258 -- Name: files; Type: TABLE; Schema: public; Owner: rich
1259 --
1260
1261 CREATE TABLE files (
1262     id serial NOT NULL,
1263     hostid integer NOT NULL,
1264     name text,
1265     name_deleted text,
1266     content bytea NOT NULL,
1267     title text,
1268     mime_type text NOT NULL,
1269     upload_date timestamp without time zone DEFAULT ('now'::text)::timestamp(6) with time zone NOT NULL
1270 );
1271
1272
1273 --
1274 -- TOC entry 31 (OID 11524804)
1275 -- Name: files; Type: ACL; Schema: public; Owner: rich
1276 --
1277
1278 REVOKE ALL ON TABLE files FROM PUBLIC;
1279 GRANT ALL ON TABLE files TO "www-data";
1280
1281
1282 --
1283 -- TOC entry 73 (OID 11524804)
1284 -- Name: files_id_seq; Type: ACL; Schema: public; Owner: rich
1285 --
1286
1287 REVOKE ALL ON TABLE files_id_seq FROM PUBLIC;
1288 GRANT ALL ON TABLE files_id_seq TO "www-data";
1289
1290
1291 --
1292 -- TOC entry 32 (OID 11524813)
1293 -- Name: users; Type: TABLE; Schema: public; Owner: rich
1294 --
1295
1296 CREATE TABLE users (
1297     id serial NOT NULL,
1298     hostid integer NOT NULL,
1299     name text NOT NULL,
1300     "password" text NOT NULL,
1301     email text,
1302     registration_date date DEFAULT ('now'::text)::date NOT NULL,
1303     can_edit boolean DEFAULT true NOT NULL,
1304     can_manage_users boolean DEFAULT false NOT NULL,
1305     can_manage_contacts boolean DEFAULT false NOT NULL,
1306     can_manage_site boolean DEFAULT false NOT NULL,
1307     can_edit_global_css boolean DEFAULT false NOT NULL,
1308     force_password_change boolean DEFAULT false NOT NULL,
1309     can_import_mail boolean DEFAULT false NOT NULL,
1310     email_notify boolean DEFAULT true NOT NULL,
1311     invite text,
1312     can_edit_macros boolean DEFAULT false NOT NULL
1313 );
1314
1315
1316 --
1317 -- TOC entry 33 (OID 11524813)
1318 -- Name: users; Type: ACL; Schema: public; Owner: rich
1319 --
1320
1321 REVOKE ALL ON TABLE users FROM PUBLIC;
1322 GRANT ALL ON TABLE users TO "www-data";
1323
1324
1325 --
1326 -- TOC entry 74 (OID 11524813)
1327 -- Name: users_id_seq; Type: ACL; Schema: public; Owner: rich
1328 --
1329
1330 REVOKE ALL ON TABLE users_id_seq FROM PUBLIC;
1331 GRANT ALL ON TABLE users_id_seq TO "www-data";
1332
1333
1334 --
1335 -- TOC entry 34 (OID 11524828)
1336 -- Name: usercookies; Type: TABLE; Schema: public; Owner: rich
1337 --
1338
1339 CREATE TABLE usercookies (
1340     userid integer NOT NULL,
1341     cookie text NOT NULL
1342 );
1343
1344
1345 --
1346 -- TOC entry 35 (OID 11524828)
1347 -- Name: usercookies; Type: ACL; Schema: public; Owner: rich
1348 --
1349
1350 REVOKE ALL ON TABLE usercookies FROM PUBLIC;
1351 GRANT ALL ON TABLE usercookies TO "www-data";
1352
1353
1354 --
1355 -- TOC entry 36 (OID 11524833)
1356 -- Name: sitemenu; Type: TABLE; Schema: public; Owner: rich
1357 --
1358
1359 CREATE TABLE sitemenu (
1360     hostid integer NOT NULL,
1361     url text NOT NULL,
1362     label text NOT NULL,
1363     ordering integer NOT NULL
1364 );
1365
1366
1367 --
1368 -- TOC entry 37 (OID 11524833)
1369 -- Name: sitemenu; Type: ACL; Schema: public; Owner: rich
1370 --
1371
1372 REVOKE ALL ON TABLE sitemenu FROM PUBLIC;
1373 GRANT ALL ON TABLE sitemenu TO "www-data";
1374
1375
1376 --
1377 -- TOC entry 38 (OID 11524840)
1378 -- Name: contacts; Type: TABLE; Schema: public; Owner: rich
1379 --
1380
1381 CREATE TABLE contacts (
1382     id serial NOT NULL,
1383     hostid integer NOT NULL,
1384     name text NOT NULL,
1385     subject text NOT NULL
1386 );
1387
1388
1389 --
1390 -- TOC entry 39 (OID 11524840)
1391 -- Name: contacts; Type: ACL; Schema: public; Owner: rich
1392 --
1393
1394 REVOKE ALL ON TABLE contacts FROM PUBLIC;
1395 GRANT ALL ON TABLE contacts TO "www-data";
1396
1397
1398 --
1399 -- TOC entry 75 (OID 11524840)
1400 -- Name: contacts_id_seq; Type: ACL; Schema: public; Owner: rich
1401 --
1402
1403 REVOKE ALL ON TABLE contacts_id_seq FROM PUBLIC;
1404 GRANT ALL ON TABLE contacts_id_seq TO "www-data";
1405
1406
1407 --
1408 -- TOC entry 40 (OID 11524846)
1409 -- Name: contact_emails; Type: TABLE; Schema: public; Owner: rich
1410 --
1411
1412 CREATE TABLE contact_emails (
1413     contactid integer NOT NULL,
1414     email text NOT NULL
1415 );
1416
1417
1418 --
1419 -- TOC entry 41 (OID 11524846)
1420 -- Name: contact_emails; Type: ACL; Schema: public; Owner: rich
1421 --
1422
1423 REVOKE ALL ON TABLE contact_emails FROM PUBLIC;
1424 GRANT ALL ON TABLE contact_emails TO "www-data";
1425
1426
1427 --
1428 -- TOC entry 42 (OID 11524851)
1429 -- Name: themes; Type: TABLE; Schema: public; Owner: rich
1430 --
1431
1432 CREATE TABLE themes (
1433     theme_css text NOT NULL,
1434     name text NOT NULL,
1435     description text NOT NULL
1436 );
1437
1438
1439 --
1440 -- TOC entry 43 (OID 11524851)
1441 -- Name: themes; Type: ACL; Schema: public; Owner: rich
1442 --
1443
1444 REVOKE ALL ON TABLE themes FROM PUBLIC;
1445 GRANT SELECT ON TABLE themes TO "www-data";
1446
1447
1448 --
1449 -- TOC entry 44 (OID 11524856)
1450 -- Name: server_settings; Type: TABLE; Schema: public; Owner: rich
1451 --
1452
1453 CREATE TABLE server_settings (
1454     "version" integer NOT NULL,
1455     stats_page text,
1456     crash_email text
1457 );
1458
1459
1460 --
1461 -- TOC entry 46 (OID 11524856)
1462 -- Name: server_settings; Type: ACL; Schema: public; Owner: rich
1463 --
1464
1465 REVOKE ALL ON TABLE server_settings FROM PUBLIC;
1466 GRANT SELECT ON TABLE server_settings TO "www-data";
1467
1468
1469 --
1470 -- TOC entry 47 (OID 11524861)
1471 -- Name: page_emails; Type: TABLE; Schema: public; Owner: rich
1472 --
1473
1474 CREATE TABLE page_emails (
1475     hostid integer NOT NULL,
1476     url text NOT NULL,
1477     email text NOT NULL,
1478     entry_date date DEFAULT ('now'::text)::date NOT NULL,
1479     last_sent date DEFAULT ('now'::text)::date NOT NULL,
1480     pending text,
1481     opt_out text NOT NULL
1482 );
1483
1484
1485 --
1486 -- TOC entry 48 (OID 11524861)
1487 -- Name: page_emails; Type: ACL; Schema: public; Owner: rich
1488 --
1489
1490 REVOKE ALL ON TABLE page_emails FROM PUBLIC;
1491 GRANT ALL ON TABLE page_emails TO "www-data";
1492
1493
1494 --
1495 -- TOC entry 49 (OID 11524868)
1496 -- Name: mailing_lists; Type: TABLE; Schema: public; Owner: rich
1497 --
1498
1499 CREATE TABLE mailing_lists (
1500     hostid integer NOT NULL,
1501     email text NOT NULL,
1502     entry_date date DEFAULT ('now'::text)::date NOT NULL,
1503     pending text,
1504     opt_out text NOT NULL,
1505     name text NOT NULL
1506 );
1507
1508
1509 --
1510 -- TOC entry 50 (OID 11524868)
1511 -- Name: mailing_lists; Type: ACL; Schema: public; Owner: rich
1512 --
1513
1514 REVOKE ALL ON TABLE mailing_lists FROM PUBLIC;
1515 GRANT ALL ON TABLE mailing_lists TO "www-data";
1516
1517
1518 --
1519 -- TOC entry 51 (OID 11524874)
1520 -- Name: links; Type: TABLE; Schema: public; Owner: rich
1521 --
1522
1523 CREATE TABLE links (
1524     hostid integer NOT NULL,
1525     from_url text NOT NULL,
1526     to_url text NOT NULL,
1527     CONSTRAINT links_not_selfref_cn CHECK ((from_url <> to_url))
1528 );
1529
1530
1531 --
1532 -- TOC entry 52 (OID 11524874)
1533 -- Name: links; Type: ACL; Schema: public; Owner: rich
1534 --
1535
1536 REVOKE ALL ON TABLE links FROM PUBLIC;
1537 GRANT ALL ON TABLE links TO "www-data";
1538
1539
1540 --
1541 -- TOC entry 53 (OID 11524882)
1542 -- Name: templates; Type: TABLE; Schema: public; Owner: rich
1543 --
1544
1545 CREATE TABLE templates (
1546     id serial NOT NULL,
1547     title_regexp text NOT NULL,
1548     url_regexp text NOT NULL,
1549     extension text NOT NULL,
1550     ordering integer NOT NULL
1551 );
1552
1553
1554 --
1555 -- TOC entry 54 (OID 11524882)
1556 -- Name: templates; Type: ACL; Schema: public; Owner: rich
1557 --
1558
1559 REVOKE ALL ON TABLE templates FROM PUBLIC;
1560 GRANT SELECT ON TABLE templates TO "www-data";
1561
1562
1563 --
1564 -- TOC entry 76 (OID 11524882)
1565 -- Name: templates_id_seq; Type: ACL; Schema: public; Owner: rich
1566 --
1567
1568 REVOKE ALL ON TABLE templates_id_seq FROM PUBLIC;
1569
1570
1571 --
1572 -- TOC entry 55 (OID 11524888)
1573 -- Name: recently_visited; Type: TABLE; Schema: public; Owner: rich
1574 --
1575
1576 CREATE TABLE recently_visited (
1577     userid integer NOT NULL,
1578     hostid integer NOT NULL,
1579     url text NOT NULL,
1580     visit_time timestamp without time zone DEFAULT ('now'::text)::timestamp(6) with time zone NOT NULL
1581 );
1582
1583
1584 --
1585 -- TOC entry 56 (OID 11524888)
1586 -- Name: recently_visited; Type: ACL; Schema: public; Owner: rich
1587 --
1588
1589 REVOKE ALL ON TABLE recently_visited FROM PUBLIC;
1590 GRANT ALL ON TABLE recently_visited TO "www-data";
1591
1592
1593 --
1594 -- TOC entry 57 (OID 11524896)
1595 -- Name: messages; Type: TABLE; Schema: public; Owner: rich
1596 --
1597
1598 CREATE TABLE messages (
1599     id serial NOT NULL,
1600     subject text NOT NULL,
1601     inet_message_id text NOT NULL,
1602     message_date timestamp with time zone NOT NULL,
1603     hostid integer NOT NULL
1604 );
1605
1606
1607 --
1608 -- TOC entry 58 (OID 11524896)
1609 -- Name: messages; Type: ACL; Schema: public; Owner: rich
1610 --
1611
1612 REVOKE ALL ON TABLE messages FROM PUBLIC;
1613 GRANT ALL ON TABLE messages TO "www-data";
1614
1615
1616 --
1617 -- TOC entry 77 (OID 11524896)
1618 -- Name: messages_id_seq; Type: ACL; Schema: public; Owner: rich
1619 --
1620
1621 REVOKE ALL ON TABLE messages_id_seq FROM PUBLIC;
1622 GRANT ALL ON TABLE messages_id_seq TO "www-data";
1623
1624
1625 --
1626 -- TOC entry 59 (OID 11524902)
1627 -- Name: msg_references; Type: TABLE; Schema: public; Owner: rich
1628 --
1629
1630 CREATE TABLE msg_references (
1631     message_id integer NOT NULL,
1632     inet_message_id text NOT NULL,
1633     ordering integer NOT NULL
1634 );
1635
1636
1637 --
1638 -- TOC entry 60 (OID 11524902)
1639 -- Name: msg_references; Type: ACL; Schema: public; Owner: rich
1640 --
1641
1642 REVOKE ALL ON TABLE msg_references FROM PUBLIC;
1643 GRANT ALL ON TABLE msg_references TO "www-data";
1644
1645
1646 --
1647 -- TOC entry 61 (OID 11524909)
1648 -- Name: powered_by; Type: TABLE; Schema: public; Owner: rich
1649 --
1650
1651 CREATE TABLE powered_by (
1652     id serial NOT NULL,
1653     name text NOT NULL,
1654     url text NOT NULL
1655 );
1656
1657
1658 --
1659 -- TOC entry 62 (OID 11524909)
1660 -- Name: powered_by; Type: ACL; Schema: public; Owner: rich
1661 --
1662
1663 REVOKE ALL ON TABLE powered_by FROM PUBLIC;
1664 GRANT SELECT ON TABLE powered_by TO "www-data";
1665
1666
1667 --
1668 -- TOC entry 63 (OID 11524915)
1669 -- Name: pending_email_changes; Type: TABLE; Schema: public; Owner: rich
1670 --
1671
1672 CREATE TABLE pending_email_changes (
1673     "key" text NOT NULL,
1674     change_date date DEFAULT ('now'::text)::date NOT NULL,
1675     userid integer NOT NULL,
1676     email text NOT NULL
1677 );
1678
1679
1680 --
1681 -- TOC entry 64 (OID 11524915)
1682 -- Name: pending_email_changes; Type: ACL; Schema: public; Owner: rich
1683 --
1684
1685 REVOKE ALL ON TABLE pending_email_changes FROM PUBLIC;
1686 GRANT ALL ON TABLE pending_email_changes TO "www-data";
1687
1688
1689 --
1690 -- TOC entry 202 (OID 14911567)
1691 -- Name: contents_jsgo_check_tg(); Type: FUNCTION; Schema: public; Owner: rich
1692 --
1693
1694 CREATE FUNCTION contents_jsgo_check_tg() RETURNS "trigger"
1695     AS '
1696
1697 declare
1698         my_hostid integer;
1699         my_count integer;
1700
1701 begin
1702         if new.jsgo is not null then
1703                 -- Get the hostid
1704                 select into my_hostid p.hostid
1705                   from pages p
1706                  where p.id = new.pageid;
1707                 -- Check that (hostid, url) where url = new.jsgo exists.
1708                 select into my_count count(p.*)
1709                   from pages p
1710                  where p.hostid = my_hostid
1711                    and p.url is not null
1712                    and p.url = new.jsgo
1713                    and p.redirect is null;
1714                 if my_count < 1 then
1715                         raise exception ''contents.jsgo points to non-existent page (%, %)'',
1716                           my_hostid, new.jsgo;
1717                 end if;
1718         end if;
1719
1720         -- Everything is OK.  Return the new row unmodified.
1721         return new;
1722 end;
1723
1724 '
1725     LANGUAGE plpgsql;
1726
1727
1728 --
1729 -- TOC entry 65 (OID 14911929)
1730 -- Name: macros; Type: TABLE; Schema: public; Owner: rich
1731 --
1732
1733 CREATE TABLE macros (
1734     hostid integer NOT NULL,
1735     name text NOT NULL,
1736     content text NOT NULL
1737 );
1738
1739
1740 --
1741 -- TOC entry 66 (OID 14911929)
1742 -- Name: macros; Type: ACL; Schema: public; Owner: rich
1743 --
1744
1745 REVOKE ALL ON TABLE macros FROM PUBLIC;
1746 GRANT ALL ON TABLE macros TO "www-data";
1747
1748
1749 --
1750 -- TOC entry 67 (OID 14972886)
1751 -- Name: rss_cache; Type: TABLE; Schema: public; Owner: rich
1752 --
1753
1754 CREATE TABLE rss_cache (
1755     url text NOT NULL,
1756     t timestamp without time zone DEFAULT ('now'::text)::timestamp(6) with time zone NOT NULL,
1757     rss text NOT NULL
1758 );
1759
1760
1761 --
1762 -- TOC entry 68 (OID 14972886)
1763 -- Name: rss_cache; Type: ACL; Schema: public; Owner: rich
1764 --
1765
1766 REVOKE ALL ON TABLE rss_cache FROM PUBLIC;
1767 GRANT ALL ON TABLE rss_cache TO "www-data";
1768
1769
1770 --
1771 -- TOC entry 92 (OID 11576669)
1772 -- Name: hostnames_hostid_name_uq; Type: INDEX; Schema: public; Owner: rich
1773 --
1774
1775 CREATE UNIQUE INDEX hostnames_hostid_name_uq ON hostnames USING btree (hostid, name);
1776
1777
1778 --
1779 -- TOC entry 87 (OID 11576670)
1780 -- Name: pages_url_uq; Type: INDEX; Schema: public; Owner: rich
1781 --
1782
1783 CREATE UNIQUE INDEX pages_url_uq ON pages USING btree (hostid, url);
1784
1785
1786 --
1787 -- TOC entry 94 (OID 11576671)
1788 -- Name: images_name_uq; Type: INDEX; Schema: public; Owner: rich
1789 --
1790
1791 CREATE UNIQUE INDEX images_name_uq ON images USING btree (hostid, name);
1792
1793
1794 --
1795 -- TOC entry 96 (OID 11576672)
1796 -- Name: files_name_uq; Type: INDEX; Schema: public; Owner: rich
1797 --
1798
1799 CREATE UNIQUE INDEX files_name_uq ON files USING btree (hostid, name);
1800
1801
1802 --
1803 -- TOC entry 99 (OID 11576673)
1804 -- Name: users_name_uq; Type: INDEX; Schema: public; Owner: rich
1805 --
1806
1807 CREATE UNIQUE INDEX users_name_uq ON users USING btree (hostid, name);
1808
1809
1810 --
1811 -- TOC entry 98 (OID 11576674)
1812 -- Name: users_id_uq; Type: INDEX; Schema: public; Owner: rich
1813 --
1814
1815 CREATE UNIQUE INDEX users_id_uq ON users USING btree (hostid, id);
1816
1817
1818 --
1819 -- TOC entry 102 (OID 11576675)
1820 -- Name: sitemenu_ordering_uq; Type: INDEX; Schema: public; Owner: rich
1821 --
1822
1823 CREATE UNIQUE INDEX sitemenu_ordering_uq ON sitemenu USING btree (hostid, ordering);
1824
1825
1826 --
1827 -- TOC entry 103 (OID 11576676)
1828 -- Name: sitemenu_url_uq; Type: INDEX; Schema: public; Owner: rich
1829 --
1830
1831 CREATE UNIQUE INDEX sitemenu_url_uq ON sitemenu USING btree (hostid, url);
1832
1833
1834 --
1835 -- TOC entry 106 (OID 11576677)
1836 -- Name: contact_emails_uq; Type: INDEX; Schema: public; Owner: rich
1837 --
1838
1839 CREATE UNIQUE INDEX contact_emails_uq ON contact_emails USING btree (contactid, email);
1840
1841
1842 --
1843 -- TOC entry 107 (OID 11576678)
1844 -- Name: themes_theme_css_uq; Type: INDEX; Schema: public; Owner: rich
1845 --
1846
1847 CREATE UNIQUE INDEX themes_theme_css_uq ON themes USING btree (theme_css);
1848
1849
1850 --
1851 -- TOC entry 108 (OID 11576679)
1852 -- Name: page_emails_email_uq; Type: INDEX; Schema: public; Owner: rich
1853 --
1854
1855 CREATE UNIQUE INDEX page_emails_email_uq ON page_emails USING btree (hostid, url, email);
1856
1857
1858 --
1859 -- TOC entry 109 (OID 11576680)
1860 -- Name: mailing_lists_email_uq; Type: INDEX; Schema: public; Owner: rich
1861 --
1862
1863 CREATE UNIQUE INDEX mailing_lists_email_uq ON mailing_lists USING btree (hostid, email);
1864
1865
1866 --
1867 -- TOC entry 104 (OID 11576681)
1868 -- Name: contacts_name_uq; Type: INDEX; Schema: public; Owner: rich
1869 --
1870
1871 CREATE UNIQUE INDEX contacts_name_uq ON contacts USING btree (hostid, name);
1872
1873
1874 --
1875 -- TOC entry 110 (OID 11576682)
1876 -- Name: links_uq; Type: INDEX; Schema: public; Owner: rich
1877 --
1878
1879 CREATE UNIQUE INDEX links_uq ON links USING btree (hostid, from_url, to_url);
1880
1881
1882 --
1883 -- TOC entry 111 (OID 11576683)
1884 -- Name: templates_ext_ord_uq; Type: INDEX; Schema: public; Owner: rich
1885 --
1886
1887 CREATE UNIQUE INDEX templates_ext_ord_uq ON templates USING btree (extension, ordering);
1888
1889
1890 --
1891 -- TOC entry 113 (OID 11576684)
1892 -- Name: templates_title_uq; Type: INDEX; Schema: public; Owner: rich
1893 --
1894
1895 CREATE UNIQUE INDEX templates_title_uq ON templates USING btree (title_regexp);
1896
1897
1898 --
1899 -- TOC entry 114 (OID 11576685)
1900 -- Name: templates_url_uq; Type: INDEX; Schema: public; Owner: rich
1901 --
1902
1903 CREATE UNIQUE INDEX templates_url_uq ON templates USING btree (url_regexp);
1904
1905
1906 --
1907 -- TOC entry 115 (OID 11576686)
1908 -- Name: recently_visited_uq; Type: INDEX; Schema: public; Owner: rich
1909 --
1910
1911 CREATE UNIQUE INDEX recently_visited_uq ON recently_visited USING btree (userid, hostid, url);
1912
1913
1914 --
1915 -- TOC entry 116 (OID 11576687)
1916 -- Name: messages_inet_message_id_uq; Type: INDEX; Schema: public; Owner: rich
1917 --
1918
1919 CREATE UNIQUE INDEX messages_inet_message_id_uq ON messages USING btree (hostid, inet_message_id);
1920
1921
1922 --
1923 -- TOC entry 86 (OID 11576688)
1924 -- Name: pages_url_ix; Type: INDEX; Schema: public; Owner: rich
1925 --
1926
1927 CREATE INDEX pages_url_ix ON pages USING btree (url);
1928
1929
1930 --
1931 -- TOC entry 85 (OID 11576689)
1932 -- Name: pages_redirect_ix; Type: INDEX; Schema: public; Owner: rich
1933 --
1934
1935 CREATE INDEX pages_redirect_ix ON pages USING btree (redirect);
1936
1937
1938 --
1939 -- TOC entry 82 (OID 11576690)
1940 -- Name: pages_fti_idx; Type: INDEX; Schema: public; Owner: rich
1941 --
1942
1943 CREATE INDEX pages_fti_idx ON pages USING gist (title_description_fti);
1944
1945
1946 --
1947 -- TOC entry 88 (OID 11576691)
1948 -- Name: contents_fti_idx; Type: INDEX; Schema: public; Owner: rich
1949 --
1950
1951 CREATE INDEX contents_fti_idx ON contents USING gist (content_fti);
1952
1953
1954 --
1955 -- TOC entry 89 (OID 11576692)
1956 -- Name: contents_pageid_idx; Type: INDEX; Schema: public; Owner: rich
1957 --
1958
1959 CREATE INDEX contents_pageid_idx ON contents USING btree (pageid);
1960
1961
1962 --
1963 -- TOC entry 93 (OID 11576693)
1964 -- Name: hostnames_name_uq; Type: INDEX; Schema: public; Owner: rich
1965 --
1966
1967 CREATE UNIQUE INDEX hostnames_name_uq ON hostnames USING btree (name);
1968
1969
1970 --
1971 -- TOC entry 101 (OID 11576694)
1972 -- Name: usercookies_cookie_idx; Type: INDEX; Schema: public; Owner: rich
1973 --
1974
1975 CREATE INDEX usercookies_cookie_idx ON usercookies USING btree (cookie);
1976
1977
1978 --
1979 -- TOC entry 83 (OID 11576695)
1980 -- Name: pages_lc_title; Type: INDEX; Schema: public; Owner: rich
1981 --
1982
1983 CREATE INDEX pages_lc_title ON pages USING btree (lower(title));
1984
1985
1986 --
1987 -- TOC entry 78 (OID 11524572)
1988 -- Name: pg_ts_dict_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
1989 --
1990
1991 ALTER TABLE ONLY pg_ts_dict
1992     ADD CONSTRAINT pg_ts_dict_pkey PRIMARY KEY (dict_name);
1993
1994
1995 --
1996 -- TOC entry 79 (OID 11524598)
1997 -- Name: pg_ts_parser_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
1998 --
1999
2000 ALTER TABLE ONLY pg_ts_parser
2001     ADD CONSTRAINT pg_ts_parser_pkey PRIMARY KEY (prs_name);
2002
2003
2004 --
2005 -- TOC entry 80 (OID 11524623)
2006 -- Name: pg_ts_cfg_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
2007 --
2008
2009 ALTER TABLE ONLY pg_ts_cfg
2010     ADD CONSTRAINT pg_ts_cfg_pkey PRIMARY KEY (ts_name);
2011
2012
2013 --
2014 -- TOC entry 81 (OID 11524630)
2015 -- Name: pg_ts_cfgmap_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
2016 --
2017
2018 ALTER TABLE ONLY pg_ts_cfgmap
2019     ADD CONSTRAINT pg_ts_cfgmap_pkey PRIMARY KEY (ts_name, tok_alias);
2020
2021
2022 --
2023 -- TOC entry 84 (OID 11576696)
2024 -- Name: pages_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
2025 --
2026
2027 ALTER TABLE ONLY pages
2028     ADD CONSTRAINT pages_pkey PRIMARY KEY (id);
2029
2030
2031 --
2032 -- TOC entry 90 (OID 11576698)
2033 -- Name: contents_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
2034 --
2035
2036 ALTER TABLE ONLY contents
2037     ADD CONSTRAINT contents_pkey PRIMARY KEY (id);
2038
2039
2040 --
2041 -- TOC entry 91 (OID 11576700)
2042 -- Name: hosts_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
2043 --
2044
2045 ALTER TABLE ONLY hosts
2046     ADD CONSTRAINT hosts_pkey PRIMARY KEY (id);
2047
2048
2049 --
2050 -- TOC entry 95 (OID 11576702)
2051 -- Name: images_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
2052 --
2053
2054 ALTER TABLE ONLY images
2055     ADD CONSTRAINT images_pkey PRIMARY KEY (id);
2056
2057
2058 --
2059 -- TOC entry 97 (OID 11576704)
2060 -- Name: files_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
2061 --
2062
2063 ALTER TABLE ONLY files
2064     ADD CONSTRAINT files_pkey PRIMARY KEY (id);
2065
2066
2067 --
2068 -- TOC entry 100 (OID 11576706)
2069 -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
2070 --
2071
2072 ALTER TABLE ONLY users
2073     ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2074
2075
2076 --
2077 -- TOC entry 105 (OID 11576708)
2078 -- Name: contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
2079 --
2080
2081 ALTER TABLE ONLY contacts
2082     ADD CONSTRAINT contacts_pkey PRIMARY KEY (id);
2083
2084
2085 --
2086 -- TOC entry 112 (OID 11576710)
2087 -- Name: templates_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
2088 --
2089
2090 ALTER TABLE ONLY templates
2091     ADD CONSTRAINT templates_pkey PRIMARY KEY (id);
2092
2093
2094 --
2095 -- TOC entry 117 (OID 11576712)
2096 -- Name: messages_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
2097 --
2098
2099 ALTER TABLE ONLY messages
2100     ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
2101
2102
2103 --
2104 -- TOC entry 118 (OID 11576714)
2105 -- Name: powered_by_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
2106 --
2107
2108 ALTER TABLE ONLY powered_by
2109     ADD CONSTRAINT powered_by_pkey PRIMARY KEY (id);
2110
2111
2112 --
2113 -- TOC entry 119 (OID 11576716)
2114 -- Name: pending_email_changes_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
2115 --
2116
2117 ALTER TABLE ONLY pending_email_changes
2118     ADD CONSTRAINT pending_email_changes_pkey PRIMARY KEY ("key");
2119
2120
2121 --
2122 -- TOC entry 120 (OID 14911934)
2123 -- Name: macros_hostid_key; Type: CONSTRAINT; Schema: public; Owner: rich
2124 --
2125
2126 ALTER TABLE ONLY macros
2127     ADD CONSTRAINT macros_hostid_key UNIQUE (hostid, name);
2128
2129
2130 --
2131 -- TOC entry 121 (OID 14972892)
2132 -- Name: rss_cache_pkey; Type: CONSTRAINT; Schema: public; Owner: rich
2133 --
2134
2135 ALTER TABLE ONLY rss_cache
2136     ADD CONSTRAINT rss_cache_pkey PRIMARY KEY (url);
2137
2138
2139 --
2140 -- TOC entry 211 (OID 11576718)
2141 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
2142 --
2143
2144 ALTER TABLE ONLY contents
2145     ADD CONSTRAINT "$1" FOREIGN KEY (pageid) REFERENCES pages(id);
2146
2147
2148 --
2149 -- TOC entry 215 (OID 11576722)
2150 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
2151 --
2152
2153 ALTER TABLE ONLY hostnames
2154     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
2155
2156
2157 --
2158 -- TOC entry 212 (OID 11576726)
2159 -- Name: hosts_hostname_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
2160 --
2161
2162 ALTER TABLE ONLY hosts
2163     ADD CONSTRAINT hosts_hostname_cn FOREIGN KEY (id, canonical_hostname) REFERENCES hostnames(hostid, name) DEFERRABLE;
2164
2165
2166 --
2167 -- TOC entry 207 (OID 11576730)
2168 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
2169 --
2170
2171 ALTER TABLE ONLY pages
2172     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
2173
2174
2175 --
2176 -- TOC entry 216 (OID 11576734)
2177 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
2178 --
2179
2180 ALTER TABLE ONLY images
2181     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
2182
2183
2184 --
2185 -- TOC entry 217 (OID 11576738)
2186 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
2187 --
2188
2189 ALTER TABLE ONLY files
2190     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
2191
2192
2193 --
2194 -- TOC entry 208 (OID 11576742)
2195 -- Name: pages_redirect_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
2196 --
2197
2198 ALTER TABLE ONLY pages
2199     ADD CONSTRAINT pages_redirect_cn FOREIGN KEY (hostid, redirect) REFERENCES pages(hostid, url) DEFERRABLE;
2200
2201
2202 --
2203 -- TOC entry 218 (OID 11576746)
2204 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
2205 --
2206
2207 ALTER TABLE ONLY users
2208     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
2209
2210
2211 --
2212 -- TOC entry 219 (OID 11576750)
2213 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
2214 --
2215
2216 ALTER TABLE ONLY usercookies
2217     ADD CONSTRAINT "$1" FOREIGN KEY (userid) REFERENCES users(id);
2218
2219
2220 --
2221 -- TOC entry 209 (OID 11576754)
2222 -- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: rich
2223 --
2224
2225 ALTER TABLE ONLY pages
2226     ADD CONSTRAINT "$2" FOREIGN KEY (logged_user) REFERENCES users(id);
2227
2228
2229 --
2230 -- TOC entry 210 (OID 11576758)
2231 -- Name: pages_user_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
2232 --
2233
2234 ALTER TABLE ONLY pages
2235     ADD CONSTRAINT pages_user_cn FOREIGN KEY (hostid, logged_user) REFERENCES users(hostid, id);
2236
2237
2238 --
2239 -- TOC entry 220 (OID 11576762)
2240 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
2241 --
2242
2243 ALTER TABLE ONLY sitemenu
2244     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
2245
2246
2247 --
2248 -- TOC entry 221 (OID 11576766)
2249 -- Name: sitemenu_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
2250 --
2251
2252 ALTER TABLE ONLY sitemenu
2253     ADD CONSTRAINT sitemenu_url_cn FOREIGN KEY (hostid, url) REFERENCES pages(hostid, url) DEFERRABLE;
2254
2255
2256 --
2257 -- TOC entry 222 (OID 11576770)
2258 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
2259 --
2260
2261 ALTER TABLE ONLY contacts
2262     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
2263
2264
2265 --
2266 -- TOC entry 223 (OID 11576774)
2267 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
2268 --
2269
2270 ALTER TABLE ONLY contact_emails
2271     ADD CONSTRAINT "$1" FOREIGN KEY (contactid) REFERENCES contacts(id);
2272
2273
2274 --
2275 -- TOC entry 213 (OID 11576778)
2276 -- Name: hosts_theme_css_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
2277 --
2278
2279 ALTER TABLE ONLY hosts
2280     ADD CONSTRAINT hosts_theme_css_cn FOREIGN KEY (theme_css) REFERENCES themes(theme_css);
2281
2282
2283 --
2284 -- TOC entry 224 (OID 11576782)
2285 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
2286 --
2287
2288 ALTER TABLE ONLY page_emails
2289     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
2290
2291
2292 --
2293 -- TOC entry 225 (OID 11576786)
2294 -- Name: page_emails_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
2295 --
2296
2297 ALTER TABLE ONLY page_emails
2298     ADD CONSTRAINT page_emails_url_cn FOREIGN KEY (hostid, url) REFERENCES pages(hostid, url) DEFERRABLE;
2299
2300
2301 --
2302 -- TOC entry 226 (OID 11576790)
2303 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
2304 --
2305
2306 ALTER TABLE ONLY mailing_lists
2307     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
2308
2309
2310 --
2311 -- TOC entry 227 (OID 11576794)
2312 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
2313 --
2314
2315 ALTER TABLE ONLY links
2316     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
2317
2318
2319 --
2320 -- TOC entry 228 (OID 11576798)
2321 -- Name: links_from_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
2322 --
2323
2324 ALTER TABLE ONLY links
2325     ADD CONSTRAINT links_from_cn FOREIGN KEY (hostid, from_url) REFERENCES pages(hostid, url) DEFERRABLE;
2326
2327
2328 --
2329 -- TOC entry 229 (OID 11576802)
2330 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
2331 --
2332
2333 ALTER TABLE ONLY recently_visited
2334     ADD CONSTRAINT "$1" FOREIGN KEY (userid) REFERENCES users(id);
2335
2336
2337 --
2338 -- TOC entry 230 (OID 11576806)
2339 -- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: rich
2340 --
2341
2342 ALTER TABLE ONLY recently_visited
2343     ADD CONSTRAINT "$2" FOREIGN KEY (hostid) REFERENCES hosts(id);
2344
2345
2346 --
2347 -- TOC entry 231 (OID 11576810)
2348 -- Name: recently_visited_url_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
2349 --
2350
2351 ALTER TABLE ONLY recently_visited
2352     ADD CONSTRAINT recently_visited_url_cn FOREIGN KEY (hostid, url) REFERENCES pages(hostid, url) DEFERRABLE;
2353
2354
2355 --
2356 -- TOC entry 232 (OID 11576814)
2357 -- Name: recently_visited_userid_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
2358 --
2359
2360 ALTER TABLE ONLY recently_visited
2361     ADD CONSTRAINT recently_visited_userid_cn FOREIGN KEY (hostid, userid) REFERENCES users(hostid, id);
2362
2363
2364 --
2365 -- TOC entry 234 (OID 11576818)
2366 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
2367 --
2368
2369 ALTER TABLE ONLY msg_references
2370     ADD CONSTRAINT "$1" FOREIGN KEY (message_id) REFERENCES messages(id);
2371
2372
2373 --
2374 -- TOC entry 233 (OID 11576822)
2375 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
2376 --
2377
2378 ALTER TABLE ONLY messages
2379     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
2380
2381
2382 --
2383 -- TOC entry 214 (OID 11576826)
2384 -- Name: hosts_powered_by_cn; Type: FK CONSTRAINT; Schema: public; Owner: rich
2385 --
2386
2387 ALTER TABLE ONLY hosts
2388     ADD CONSTRAINT hosts_powered_by_cn FOREIGN KEY (powered_by) REFERENCES powered_by(id);
2389
2390
2391 --
2392 -- TOC entry 235 (OID 11576830)
2393 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
2394 --
2395
2396 ALTER TABLE ONLY pending_email_changes
2397     ADD CONSTRAINT "$1" FOREIGN KEY (userid) REFERENCES users(id);
2398
2399
2400 --
2401 -- TOC entry 236 (OID 14911936)
2402 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: rich
2403 --
2404
2405 ALTER TABLE ONLY macros
2406     ADD CONSTRAINT "$1" FOREIGN KEY (hostid) REFERENCES hosts(id);
2407
2408
2409 --
2410 -- TOC entry 237 (OID 11576834)
2411 -- Name: pages_fti_tr; Type: TRIGGER; Schema: public; Owner: rich
2412 --
2413
2414 CREATE TRIGGER pages_fti_tr
2415     BEFORE INSERT OR UPDATE ON pages
2416     FOR EACH ROW
2417     EXECUTE PROCEDURE tsearch2('title_description_fti', 'title', 'description');
2418
2419
2420 --
2421 -- TOC entry 238 (OID 11576835)
2422 -- Name: contents_fti_tr; Type: TRIGGER; Schema: public; Owner: rich
2423 --
2424
2425 CREATE TRIGGER contents_fti_tr
2426     BEFORE INSERT OR UPDATE ON contents
2427     FOR EACH ROW
2428     EXECUTE PROCEDURE tsearch2('content_fti', 'sectionname', 'content');
2429
2430
2431 --
2432 -- TOC entry 239 (OID 14911568)
2433 -- Name: contents_jsgo_check_tg; Type: TRIGGER; Schema: public; Owner: rich
2434 --
2435
2436 CREATE TRIGGER contents_jsgo_check_tg
2437     BEFORE INSERT OR UPDATE ON contents
2438     FOR EACH ROW
2439     EXECUTE PROCEDURE contents_jsgo_check_tg();
2440
2441
2442 --
2443 -- TOC entry 3 (OID 2200)
2444 -- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
2445 --
2446
2447 COMMENT ON SCHEMA public IS 'Standard public namespace';
2448
2449
2450 --
2451 -- TOC entry 169 (OID 11524715)
2452 -- Name: FUNCTION exectsq(tsvector, tsquery); Type: COMMENT; Schema: public; Owner: postgres
2453 --
2454
2455 COMMENT ON FUNCTION exectsq(tsvector, tsquery) IS 'boolean operation with text index';
2456
2457
2458 --
2459 -- TOC entry 171 (OID 11524716)
2460 -- Name: FUNCTION rexectsq(tsquery, tsvector); Type: COMMENT; Schema: public; Owner: postgres
2461 --
2462
2463 COMMENT ON FUNCTION rexectsq(tsquery, tsvector) IS 'boolean operation with text index';
2464
2465
2466 --
2467 -- TOC entry 45 (OID 11524856)
2468 -- Name: TABLE server_settings; Type: COMMENT; Schema: public; Owner: rich
2469 --
2470
2471 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.';
2472
2473
2474 --
2475 -- PostgreSQL database dump
2476 --
2477
2478 SET client_encoding = 'UNICODE';
2479 SET check_function_bodies = false;
2480
2481 SET search_path = public, pg_catalog;
2482
2483 --
2484 -- Data for TOC entry 3 (OID 11524882)
2485 -- Name: templates; Type: TABLE DATA; Schema: public; Owner: rich
2486 --
2487
2488 COPY templates (id, title_regexp, url_regexp, extension, ordering) FROM stdin;
2489 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
2490 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
2491 4       ^(199[0-9]|20[0-9][0-9])$       ^(199[0-9]|20[0-9][0-9])$       calendar        30
2492 \.
2493
2494
2495 --
2496 -- TOC entry 2 (OID 11524880)
2497 -- Name: templates_id_seq; Type: SEQUENCE SET; Schema: public; Owner: rich
2498 --
2499
2500 SELECT pg_catalog.setval('templates_id_seq', 4, true);
2501
2502
2503 --
2504 -- PostgreSQL database dump
2505 --
2506
2507 SET client_encoding = 'UNICODE';
2508 SET check_function_bodies = false;
2509
2510 SET search_path = public, pg_catalog;
2511
2512 --
2513 -- Data for TOC entry 2 (OID 11524851)
2514 -- Name: themes; Type: TABLE DATA; Schema: public; Owner: rich
2515 --
2516
2517 COPY themes (theme_css, name, description) FROM stdin;
2518 /_css/easyweb.css       Merjis Easy Web Marketing       This is the easy web marketing stylesheet developed by Merjis Ltd.  Please see http://www.merjis.com/
2519 /_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.
2520 \.
2521
2522
2523 --
2524 -- PostgreSQL database dump
2525 --
2526
2527 SET client_encoding = 'UNICODE';
2528 SET check_function_bodies = false;
2529
2530 SET search_path = public, pg_catalog;
2531
2532 --
2533 -- Data for TOC entry 3 (OID 11524909)
2534 -- Name: powered_by; Type: TABLE DATA; Schema: public; Owner: rich
2535 --
2536
2537 COPY powered_by (id, name, url) FROM stdin;
2538 1       Merjis Team Notepad     http://www.team-notepad.com
2539 2       Merjis Easy Web Marketing       http://www.merjis.com
2540 \.
2541
2542
2543 --
2544 -- TOC entry 2 (OID 11524907)
2545 -- Name: powered_by_id_seq; Type: SEQUENCE SET; Schema: public; Owner: rich
2546 --
2547
2548 SELECT pg_catalog.setval('powered_by_id_seq', 2, true);
2549
2550