Ticket #14796: danbooru.sql

File danbooru.sql, 74.0 KB (added by pappjm@…, 13 years ago)

Schema of the database which inspectdb is failing on

Line 
1--
2-- PostgreSQL database dump
3--
4
5SET statement_timeout = 0;
6SET client_encoding = 'UTF8';
7SET standard_conforming_strings = off;
8SET check_function_bodies = false;
9SET client_min_messages = warning;
10SET escape_string_warning = off;
11
12--
13-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: jeremy
14--
15
16CREATE PROCEDURAL LANGUAGE plpgsql;
17
18
19ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO jeremy;
20
21SET search_path = public, pg_catalog;
22
23--
24-- Name: post_status; Type: TYPE; Schema: public; Owner: jeremy
25--
26
27CREATE TYPE post_status AS ENUM (
28 'deleted',
29 'flagged',
30 'pending',
31 'active'
32);
33
34
35ALTER TYPE public.post_status OWNER TO jeremy;
36
37--
38-- Name: pools_posts_delete_trg(); Type: FUNCTION; Schema: public; Owner: jeremy
39--
40
41CREATE FUNCTION pools_posts_delete_trg() RETURNS trigger
42 LANGUAGE plpgsql
43 AS $$
44 BEGIN
45 UPDATE pools SET post_count = post_count - 1 WHERE id = OLD.pool_id;
46 RETURN OLD;
47 END;
48 $$;
49
50
51ALTER FUNCTION public.pools_posts_delete_trg() OWNER TO jeremy;
52
53--
54-- Name: pools_posts_insert_trg(); Type: FUNCTION; Schema: public; Owner: jeremy
55--
56
57CREATE FUNCTION pools_posts_insert_trg() RETURNS trigger
58 LANGUAGE plpgsql
59 AS $$
60 BEGIN
61 UPDATE pools SET post_count = post_count + 1 WHERE id = NEW.pool_id;
62 RETURN NEW;
63 END;
64 $$;
65
66
67ALTER FUNCTION public.pools_posts_insert_trg() OWNER TO jeremy;
68
69--
70-- Name: testprs_end(internal); Type: FUNCTION; Schema: public; Owner: jeremy
71--
72
73CREATE FUNCTION testprs_end(internal) RETURNS void
74 LANGUAGE c STRICT
75 AS '$libdir/test_parser', 'testprs_end';
76
77
78ALTER FUNCTION public.testprs_end(internal) OWNER TO jeremy;
79
80--
81-- Name: testprs_getlexeme(internal, internal, internal); Type: FUNCTION; Schema: public; Owner: jeremy
82--
83
84CREATE FUNCTION testprs_getlexeme(internal, internal, internal) RETURNS internal
85 LANGUAGE c STRICT
86 AS '$libdir/test_parser', 'testprs_getlexeme';
87
88
89ALTER FUNCTION public.testprs_getlexeme(internal, internal, internal) OWNER TO jeremy;
90
91--
92-- Name: testprs_lextype(internal); Type: FUNCTION; Schema: public; Owner: jeremy
93--
94
95CREATE FUNCTION testprs_lextype(internal) RETURNS internal
96 LANGUAGE c STRICT
97 AS '$libdir/test_parser', 'testprs_lextype';
98
99
100ALTER FUNCTION public.testprs_lextype(internal) OWNER TO jeremy;
101
102--
103-- Name: testprs_start(internal, integer); Type: FUNCTION; Schema: public; Owner: jeremy
104--
105
106CREATE FUNCTION testprs_start(internal, integer) RETURNS internal
107 LANGUAGE c STRICT
108 AS '$libdir/test_parser', 'testprs_start';
109
110
111ALTER FUNCTION public.testprs_start(internal, integer) OWNER TO jeremy;
112
113--
114-- Name: trg_posts_tags__delete(); Type: FUNCTION; Schema: public; Owner: jeremy
115--
116
117CREATE FUNCTION trg_posts_tags__delete() RETURNS trigger
118 LANGUAGE plpgsql
119 AS $$
120 BEGIN
121 UPDATE tags SET post_count = post_count - 1 WHERE tags.id = OLD.tag_id;
122 RETURN OLD;
123 END;
124 $$;
125
126
127ALTER FUNCTION public.trg_posts_tags__delete() OWNER TO jeremy;
128
129--
130-- Name: trg_posts_tags__insert(); Type: FUNCTION; Schema: public; Owner: jeremy
131--
132
133CREATE FUNCTION trg_posts_tags__insert() RETURNS trigger
134 LANGUAGE plpgsql
135 AS $$
136 BEGIN
137 UPDATE tags SET post_count = post_count + 1 WHERE tags.id = NEW.tag_id;
138 RETURN NEW;
139 END;
140 $$;
141
142
143ALTER FUNCTION public.trg_posts_tags__insert() OWNER TO jeremy;
144
145--
146-- Name: testparser; Type: TEXT SEARCH PARSER; Schema: public; Owner:
147--
148
149CREATE TEXT SEARCH PARSER testparser (
150 START = testprs_start,
151 GETTOKEN = testprs_getlexeme,
152 END = testprs_end,
153 HEADLINE = prsd_headline,
154 LEXTYPES = testprs_lextype );
155
156
157--
158-- Name: danbooru; Type: TEXT SEARCH CONFIGURATION; Schema: public; Owner: jeremy
159--
160
161CREATE TEXT SEARCH CONFIGURATION danbooru (
162 PARSER = testparser );
163
164ALTER TEXT SEARCH CONFIGURATION danbooru
165 ADD MAPPING FOR word WITH simple;
166
167
168ALTER TEXT SEARCH CONFIGURATION public.danbooru OWNER TO jeremy;
169
170SET default_tablespace = '';
171
172SET default_with_oids = false;
173
174--
175-- Name: advertisement_hits; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
176--
177
178CREATE TABLE advertisement_hits (
179 id integer NOT NULL,
180 advertisement_id integer,
181 created_at timestamp without time zone,
182 updated_at timestamp without time zone,
183 ip_addr inet
184);
185
186
187ALTER TABLE public.advertisement_hits OWNER TO jeremy;
188
189--
190-- Name: advertisement_hits_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
191--
192
193CREATE SEQUENCE advertisement_hits_id_seq
194 START WITH 1
195 INCREMENT BY 1
196 NO MAXVALUE
197 NO MINVALUE
198 CACHE 1;
199
200
201ALTER TABLE public.advertisement_hits_id_seq OWNER TO jeremy;
202
203--
204-- Name: advertisement_hits_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
205--
206
207ALTER SEQUENCE advertisement_hits_id_seq OWNED BY advertisement_hits.id;
208
209
210--
211-- Name: advertisements; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
212--
213
214CREATE TABLE advertisements (
215 id integer NOT NULL,
216 referral_url character varying(255) NOT NULL,
217 ad_type character varying(255) NOT NULL,
218 status character varying(255) NOT NULL,
219 hit_count integer DEFAULT 0 NOT NULL,
220 width integer NOT NULL,
221 height integer NOT NULL,
222 is_work_safe boolean DEFAULT false NOT NULL,
223 file_name character varying(255),
224 created_at timestamp without time zone
225);
226
227
228ALTER TABLE public.advertisements OWNER TO jeremy;
229
230--
231-- Name: advertisements_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
232--
233
234CREATE SEQUENCE advertisements_id_seq
235 START WITH 1
236 INCREMENT BY 1
237 NO MAXVALUE
238 NO MINVALUE
239 CACHE 1;
240
241
242ALTER TABLE public.advertisements_id_seq OWNER TO jeremy;
243
244--
245-- Name: advertisements_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
246--
247
248ALTER SEQUENCE advertisements_id_seq OWNED BY advertisements.id;
249
250
251--
252-- Name: artist_urls; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
253--
254
255CREATE TABLE artist_urls (
256 id integer NOT NULL,
257 artist_id integer NOT NULL,
258 url text NOT NULL,
259 normalized_url text NOT NULL
260);
261
262
263ALTER TABLE public.artist_urls OWNER TO jeremy;
264
265--
266-- Name: artist_urls_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
267--
268
269CREATE SEQUENCE artist_urls_id_seq
270 START WITH 1
271 INCREMENT BY 1
272 NO MAXVALUE
273 NO MINVALUE
274 CACHE 1;
275
276
277ALTER TABLE public.artist_urls_id_seq OWNER TO jeremy;
278
279--
280-- Name: artist_urls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
281--
282
283ALTER SEQUENCE artist_urls_id_seq OWNED BY artist_urls.id;
284
285
286--
287-- Name: artist_versions; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
288--
289
290CREATE TABLE artist_versions (
291 id integer NOT NULL,
292 artist_id integer,
293 version integer DEFAULT 0 NOT NULL,
294 name text,
295 updater_id integer,
296 cached_urls text,
297 created_at timestamp without time zone,
298 updated_at timestamp without time zone,
299 is_active boolean DEFAULT true NOT NULL,
300 other_names_array text[],
301 group_name character varying(255),
302 is_banned boolean DEFAULT false NOT NULL
303);
304
305
306ALTER TABLE public.artist_versions OWNER TO jeremy;
307
308--
309-- Name: artist_versions_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
310--
311
312CREATE SEQUENCE artist_versions_id_seq
313 START WITH 1
314 INCREMENT BY 1
315 NO MAXVALUE
316 NO MINVALUE
317 CACHE 1;
318
319
320ALTER TABLE public.artist_versions_id_seq OWNER TO jeremy;
321
322--
323-- Name: artist_versions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
324--
325
326ALTER SEQUENCE artist_versions_id_seq OWNED BY artist_versions.id;
327
328
329--
330-- Name: artists; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
331--
332
333CREATE TABLE artists (
334 id integer NOT NULL,
335 name text NOT NULL,
336 updated_at timestamp without time zone DEFAULT now() NOT NULL,
337 updater_id integer,
338 version integer,
339 is_active boolean DEFAULT true NOT NULL,
340 other_names_array text[],
341 group_name character varying(255),
342 is_banned boolean DEFAULT false NOT NULL
343);
344
345
346ALTER TABLE public.artists OWNER TO jeremy;
347
348--
349-- Name: artists_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
350--
351
352CREATE SEQUENCE artists_id_seq
353 START WITH 1
354 INCREMENT BY 1
355 NO MAXVALUE
356 NO MINVALUE
357 CACHE 1;
358
359
360ALTER TABLE public.artists_id_seq OWNER TO jeremy;
361
362--
363-- Name: artists_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
364--
365
366ALTER SEQUENCE artists_id_seq OWNED BY artists.id;
367
368
369--
370-- Name: banned_ips; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
371--
372
373CREATE TABLE banned_ips (
374 id integer NOT NULL,
375 creator_id integer NOT NULL,
376 ip_addr inet NOT NULL,
377 reason text,
378 created_at timestamp without time zone,
379 updated_at timestamp without time zone
380);
381
382
383ALTER TABLE public.banned_ips OWNER TO jeremy;
384
385--
386-- Name: banned_ips_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
387--
388
389CREATE SEQUENCE banned_ips_id_seq
390 START WITH 1
391 INCREMENT BY 1
392 NO MAXVALUE
393 NO MINVALUE
394 CACHE 1;
395
396
397ALTER TABLE public.banned_ips_id_seq OWNER TO jeremy;
398
399--
400-- Name: banned_ips_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
401--
402
403ALTER SEQUENCE banned_ips_id_seq OWNED BY banned_ips.id;
404
405
406--
407-- Name: bans; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
408--
409
410CREATE TABLE bans (
411 id integer NOT NULL,
412 user_id integer NOT NULL,
413 reason text NOT NULL,
414 expires_at timestamp without time zone NOT NULL,
415 banned_by integer NOT NULL,
416 old_level integer
417);
418
419
420ALTER TABLE public.bans OWNER TO jeremy;
421
422--
423-- Name: bans_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
424--
425
426CREATE SEQUENCE bans_id_seq
427 START WITH 1
428 INCREMENT BY 1
429 NO MAXVALUE
430 NO MINVALUE
431 CACHE 1;
432
433
434ALTER TABLE public.bans_id_seq OWNER TO jeremy;
435
436--
437-- Name: bans_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
438--
439
440ALTER SEQUENCE bans_id_seq OWNED BY bans.id;
441
442
443--
444-- Name: comment_votes; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
445--
446
447CREATE TABLE comment_votes (
448 id integer NOT NULL,
449 comment_id integer NOT NULL,
450 user_id integer NOT NULL,
451 created_at timestamp without time zone,
452 updated_at timestamp without time zone
453);
454
455
456ALTER TABLE public.comment_votes OWNER TO jeremy;
457
458--
459-- Name: comment_votes_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
460--
461
462CREATE SEQUENCE comment_votes_id_seq
463 START WITH 1
464 INCREMENT BY 1
465 NO MAXVALUE
466 NO MINVALUE
467 CACHE 1;
468
469
470ALTER TABLE public.comment_votes_id_seq OWNER TO jeremy;
471
472--
473-- Name: comment_votes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
474--
475
476ALTER SEQUENCE comment_votes_id_seq OWNED BY comment_votes.id;
477
478
479--
480-- Name: comments; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
481--
482
483CREATE TABLE comments (
484 id integer NOT NULL,
485 created_at timestamp without time zone NOT NULL,
486 post_id integer NOT NULL,
487 user_id integer,
488 body text NOT NULL,
489 ip_addr inet NOT NULL,
490 text_search_index tsvector,
491 score integer DEFAULT 0 NOT NULL
492);
493
494
495ALTER TABLE public.comments OWNER TO jeremy;
496
497--
498-- Name: comments_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
499--
500
501CREATE SEQUENCE comments_id_seq
502 START WITH 1
503 INCREMENT BY 1
504 NO MAXVALUE
505 NO MINVALUE
506 CACHE 1;
507
508
509ALTER TABLE public.comments_id_seq OWNER TO jeremy;
510
511--
512-- Name: comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
513--
514
515ALTER SEQUENCE comments_id_seq OWNED BY comments.id;
516
517
518--
519-- Name: dmails; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
520--
521
522CREATE TABLE dmails (
523 id integer NOT NULL,
524 from_id integer NOT NULL,
525 to_id integer NOT NULL,
526 title text NOT NULL,
527 body text NOT NULL,
528 created_at timestamp without time zone NOT NULL,
529 has_seen boolean DEFAULT false NOT NULL,
530 parent_id integer
531);
532
533
534ALTER TABLE public.dmails OWNER TO jeremy;
535
536--
537-- Name: dmails_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
538--
539
540CREATE SEQUENCE dmails_id_seq
541 START WITH 1
542 INCREMENT BY 1
543 NO MAXVALUE
544 NO MINVALUE
545 CACHE 1;
546
547
548ALTER TABLE public.dmails_id_seq OWNER TO jeremy;
549
550--
551-- Name: dmails_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
552--
553
554ALTER SEQUENCE dmails_id_seq OWNED BY dmails.id;
555
556
557--
558-- Name: tag_subscriptions; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
559--
560
561CREATE TABLE tag_subscriptions (
562 id integer NOT NULL,
563 user_id integer NOT NULL,
564 tag_query text NOT NULL,
565 cached_post_ids text DEFAULT ''::text NOT NULL,
566 name character varying(255) DEFAULT 'General'::character varying NOT NULL,
567 is_visible_on_profile boolean DEFAULT true NOT NULL
568);
569
570
571ALTER TABLE public.tag_subscriptions OWNER TO jeremy;
572
573--
574-- Name: favorite_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
575--
576
577CREATE SEQUENCE favorite_tags_id_seq
578 START WITH 1
579 INCREMENT BY 1
580 NO MAXVALUE
581 NO MINVALUE
582 CACHE 1;
583
584
585ALTER TABLE public.favorite_tags_id_seq OWNER TO jeremy;
586
587--
588-- Name: favorite_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
589--
590
591ALTER SEQUENCE favorite_tags_id_seq OWNED BY tag_subscriptions.id;
592
593
594--
595-- Name: favorites; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
596--
597
598CREATE TABLE favorites (
599 id integer NOT NULL,
600 post_id integer NOT NULL,
601 user_id integer NOT NULL,
602 created_at timestamp without time zone DEFAULT now() NOT NULL
603);
604
605
606ALTER TABLE public.favorites OWNER TO jeremy;
607
608--
609-- Name: favorites_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
610--
611
612CREATE SEQUENCE favorites_id_seq
613 START WITH 1
614 INCREMENT BY 1
615 NO MAXVALUE
616 NO MINVALUE
617 CACHE 1;
618
619
620ALTER TABLE public.favorites_id_seq OWNER TO jeremy;
621
622--
623-- Name: favorites_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
624--
625
626ALTER SEQUENCE favorites_id_seq OWNED BY favorites.id;
627
628
629--
630-- Name: flagged_post_details; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
631--
632
633CREATE TABLE flagged_post_details (
634 id integer NOT NULL,
635 created_at timestamp without time zone NOT NULL,
636 post_id integer NOT NULL,
637 reason text NOT NULL,
638 user_id integer NOT NULL,
639 is_resolved boolean NOT NULL
640);
641
642
643ALTER TABLE public.flagged_post_details OWNER TO jeremy;
644
645--
646-- Name: flagged_post_details_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
647--
648
649CREATE SEQUENCE flagged_post_details_id_seq
650 START WITH 1
651 INCREMENT BY 1
652 NO MAXVALUE
653 NO MINVALUE
654 CACHE 1;
655
656
657ALTER TABLE public.flagged_post_details_id_seq OWNER TO jeremy;
658
659--
660-- Name: flagged_post_details_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
661--
662
663ALTER SEQUENCE flagged_post_details_id_seq OWNED BY flagged_post_details.id;
664
665
666--
667-- Name: forum_posts; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
668--
669
670CREATE TABLE forum_posts (
671 id integer NOT NULL,
672 created_at timestamp without time zone NOT NULL,
673 updated_at timestamp without time zone NOT NULL,
674 title text NOT NULL,
675 body text NOT NULL,
676 creator_id integer,
677 parent_id integer,
678 last_updated_by integer,
679 is_sticky boolean DEFAULT false NOT NULL,
680 response_count integer DEFAULT 0 NOT NULL,
681 is_locked boolean DEFAULT false NOT NULL,
682 text_search_index tsvector
683);
684
685
686ALTER TABLE public.forum_posts OWNER TO jeremy;
687
688--
689-- Name: forum_posts_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
690--
691
692CREATE SEQUENCE forum_posts_id_seq
693 START WITH 1
694 INCREMENT BY 1
695 NO MAXVALUE
696 NO MINVALUE
697 CACHE 1;
698
699
700ALTER TABLE public.forum_posts_id_seq OWNER TO jeremy;
701
702--
703-- Name: forum_posts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
704--
705
706ALTER SEQUENCE forum_posts_id_seq OWNED BY forum_posts.id;
707
708
709--
710-- Name: job_tasks; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
711--
712
713CREATE TABLE job_tasks (
714 id integer NOT NULL,
715 task_type character varying(255) NOT NULL,
716 status character varying(255) NOT NULL,
717 status_message text,
718 created_at timestamp without time zone,
719 updated_at timestamp without time zone,
720 data_as_json text DEFAULT '{}'::text NOT NULL,
721 repeat_count integer DEFAULT 0 NOT NULL
722);
723
724
725ALTER TABLE public.job_tasks OWNER TO jeremy;
726
727--
728-- Name: job_tasks_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
729--
730
731CREATE SEQUENCE job_tasks_id_seq
732 START WITH 1
733 INCREMENT BY 1
734 NO MAXVALUE
735 NO MINVALUE
736 CACHE 1;
737
738
739ALTER TABLE public.job_tasks_id_seq OWNER TO jeremy;
740
741--
742-- Name: job_tasks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
743--
744
745ALTER SEQUENCE job_tasks_id_seq OWNED BY job_tasks.id;
746
747
748--
749-- Name: mod_queue_posts; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
750--
751
752CREATE TABLE mod_queue_posts (
753 id integer NOT NULL,
754 user_id integer NOT NULL,
755 post_id integer NOT NULL
756);
757
758
759ALTER TABLE public.mod_queue_posts OWNER TO jeremy;
760
761--
762-- Name: mod_queue_posts_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
763--
764
765CREATE SEQUENCE mod_queue_posts_id_seq
766 START WITH 1
767 INCREMENT BY 1
768 NO MAXVALUE
769 NO MINVALUE
770 CACHE 1;
771
772
773ALTER TABLE public.mod_queue_posts_id_seq OWNER TO jeremy;
774
775--
776-- Name: mod_queue_posts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
777--
778
779ALTER SEQUENCE mod_queue_posts_id_seq OWNED BY mod_queue_posts.id;
780
781
782--
783-- Name: note_versions; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
784--
785
786CREATE TABLE note_versions (
787 id integer NOT NULL,
788 created_at timestamp without time zone NOT NULL,
789 updated_at timestamp without time zone NOT NULL,
790 x integer NOT NULL,
791 y integer NOT NULL,
792 width integer NOT NULL,
793 height integer NOT NULL,
794 body text NOT NULL,
795 version integer NOT NULL,
796 ip_addr inet NOT NULL,
797 is_active boolean DEFAULT true NOT NULL,
798 note_id integer NOT NULL,
799 post_id integer NOT NULL,
800 user_id integer,
801 text_search_index tsvector
802);
803
804
805ALTER TABLE public.note_versions OWNER TO jeremy;
806
807--
808-- Name: note_versions_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
809--
810
811CREATE SEQUENCE note_versions_id_seq
812 START WITH 1
813 INCREMENT BY 1
814 NO MAXVALUE
815 NO MINVALUE
816 CACHE 1;
817
818
819ALTER TABLE public.note_versions_id_seq OWNER TO jeremy;
820
821--
822-- Name: note_versions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
823--
824
825ALTER SEQUENCE note_versions_id_seq OWNED BY note_versions.id;
826
827
828--
829-- Name: notes; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
830--
831
832CREATE TABLE notes (
833 id integer NOT NULL,
834 created_at timestamp without time zone NOT NULL,
835 updated_at timestamp without time zone NOT NULL,
836 user_id integer,
837 x integer NOT NULL,
838 y integer NOT NULL,
839 width integer NOT NULL,
840 height integer NOT NULL,
841 ip_addr inet NOT NULL,
842 version integer DEFAULT 1 NOT NULL,
843 is_active boolean DEFAULT true NOT NULL,
844 post_id integer NOT NULL,
845 body text NOT NULL,
846 text_search_index tsvector
847);
848
849
850ALTER TABLE public.notes OWNER TO jeremy;
851
852--
853-- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
854--
855
856CREATE SEQUENCE notes_id_seq
857 START WITH 1
858 INCREMENT BY 1
859 NO MAXVALUE
860 NO MINVALUE
861 CACHE 1;
862
863
864ALTER TABLE public.notes_id_seq OWNER TO jeremy;
865
866--
867-- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
868--
869
870ALTER SEQUENCE notes_id_seq OWNED BY notes.id;
871
872
873--
874-- Name: pool_updates; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
875--
876
877CREATE TABLE pool_updates (
878 id integer NOT NULL,
879 pool_id integer NOT NULL,
880 post_ids text DEFAULT ''::text NOT NULL,
881 user_id integer,
882 ip_addr inet,
883 created_at timestamp without time zone,
884 updated_at timestamp without time zone
885);
886
887
888ALTER TABLE public.pool_updates OWNER TO jeremy;
889
890--
891-- Name: pool_updates_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
892--
893
894CREATE SEQUENCE pool_updates_id_seq
895 START WITH 1
896 INCREMENT BY 1
897 NO MAXVALUE
898 NO MINVALUE
899 CACHE 1;
900
901
902ALTER TABLE public.pool_updates_id_seq OWNER TO jeremy;
903
904--
905-- Name: pool_updates_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
906--
907
908ALTER SEQUENCE pool_updates_id_seq OWNED BY pool_updates.id;
909
910
911--
912-- Name: pools; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
913--
914
915CREATE TABLE pools (
916 id integer NOT NULL,
917 name text NOT NULL,
918 created_at timestamp without time zone NOT NULL,
919 updated_at timestamp without time zone NOT NULL,
920 user_id integer NOT NULL,
921 is_public boolean DEFAULT false NOT NULL,
922 post_count integer DEFAULT 0 NOT NULL,
923 description text DEFAULT ''::text NOT NULL,
924 is_active boolean DEFAULT true NOT NULL
925);
926
927
928ALTER TABLE public.pools OWNER TO jeremy;
929
930--
931-- Name: pools_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
932--
933
934CREATE SEQUENCE pools_id_seq
935 START WITH 1
936 INCREMENT BY 1
937 NO MAXVALUE
938 NO MINVALUE
939 CACHE 1;
940
941
942ALTER TABLE public.pools_id_seq OWNER TO jeremy;
943
944--
945-- Name: pools_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
946--
947
948ALTER SEQUENCE pools_id_seq OWNED BY pools.id;
949
950
951--
952-- Name: pools_posts; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
953--
954
955CREATE TABLE pools_posts (
956 id integer NOT NULL,
957 sequence integer DEFAULT 0 NOT NULL,
958 pool_id integer NOT NULL,
959 post_id integer NOT NULL,
960 next_post_id integer,
961 prev_post_id integer
962);
963
964
965ALTER TABLE public.pools_posts OWNER TO jeremy;
966
967--
968-- Name: pools_posts_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
969--
970
971CREATE SEQUENCE pools_posts_id_seq
972 START WITH 1
973 INCREMENT BY 1
974 NO MAXVALUE
975 NO MINVALUE
976 CACHE 1;
977
978
979ALTER TABLE public.pools_posts_id_seq OWNER TO jeremy;
980
981--
982-- Name: pools_posts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
983--
984
985ALTER SEQUENCE pools_posts_id_seq OWNED BY pools_posts.id;
986
987
988--
989-- Name: posts; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
990--
991
992CREATE TABLE posts (
993 id integer NOT NULL,
994 created_at timestamp without time zone NOT NULL,
995 user_id integer,
996 score integer DEFAULT 0 NOT NULL,
997 source text NOT NULL,
998 md5 text NOT NULL,
999 last_commented_at timestamp without time zone,
1000 rating character(1) DEFAULT 'q'::bpchar NOT NULL,
1001 width integer,
1002 height integer,
1003 is_warehoused boolean DEFAULT false NOT NULL,
1004 ip_addr inet NOT NULL,
1005 cached_tags text DEFAULT ''::text NOT NULL,
1006 is_note_locked boolean DEFAULT false NOT NULL,
1007 fav_count integer DEFAULT 0 NOT NULL,
1008 file_ext text DEFAULT ''::text NOT NULL,
1009 last_noted_at timestamp without time zone,
1010 is_rating_locked boolean DEFAULT false NOT NULL,
1011 parent_id integer,
1012 has_children boolean DEFAULT false NOT NULL,
1013 status post_status DEFAULT 'active'::post_status NOT NULL,
1014 sample_width integer,
1015 sample_height integer,
1016 change_seq integer,
1017 approver_id integer,
1018 tags_index tsvector,
1019 general_tag_count integer DEFAULT 0 NOT NULL,
1020 artist_tag_count integer DEFAULT 0 NOT NULL,
1021 character_tag_count integer DEFAULT 0 NOT NULL,
1022 copyright_tag_count integer DEFAULT 0 NOT NULL,
1023 file_size integer
1024);
1025
1026
1027ALTER TABLE public.posts OWNER TO jeremy;
1028
1029--
1030-- Name: post_change_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
1031--
1032
1033CREATE SEQUENCE post_change_seq
1034 START WITH 1
1035 INCREMENT BY 1
1036 NO MAXVALUE
1037 NO MINVALUE
1038 CACHE 1;
1039
1040
1041ALTER TABLE public.post_change_seq OWNER TO jeremy;
1042
1043--
1044-- Name: post_change_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
1045--
1046
1047ALTER SEQUENCE post_change_seq OWNED BY posts.change_seq;
1048
1049
1050--
1051-- Name: post_tag_histories; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
1052--
1053
1054CREATE TABLE post_tag_histories (
1055 id integer NOT NULL,
1056 post_id integer NOT NULL,
1057 tags text NOT NULL,
1058 user_id integer,
1059 ip_addr inet NOT NULL,
1060 created_at timestamp without time zone DEFAULT now() NOT NULL,
1061 rating character(1),
1062 parent_id integer,
1063 source text
1064);
1065
1066
1067ALTER TABLE public.post_tag_histories OWNER TO jeremy;
1068
1069--
1070-- Name: post_tag_histories_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
1071--
1072
1073CREATE SEQUENCE post_tag_histories_id_seq
1074 START WITH 1
1075 INCREMENT BY 1
1076 NO MAXVALUE
1077 NO MINVALUE
1078 CACHE 1;
1079
1080
1081ALTER TABLE public.post_tag_histories_id_seq OWNER TO jeremy;
1082
1083--
1084-- Name: post_tag_histories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
1085--
1086
1087ALTER SEQUENCE post_tag_histories_id_seq OWNED BY post_tag_histories.id;
1088
1089
1090--
1091-- Name: post_votes; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
1092--
1093
1094CREATE TABLE post_votes (
1095 id integer NOT NULL,
1096 post_id integer NOT NULL,
1097 user_id integer NOT NULL,
1098 created_at timestamp without time zone,
1099 updated_at timestamp without time zone,
1100 score integer DEFAULT 0 NOT NULL
1101);
1102
1103
1104ALTER TABLE public.post_votes OWNER TO jeremy;
1105
1106--
1107-- Name: post_votes_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
1108--
1109
1110CREATE SEQUENCE post_votes_id_seq
1111 START WITH 1
1112 INCREMENT BY 1
1113 NO MAXVALUE
1114 NO MINVALUE
1115 CACHE 1;
1116
1117
1118ALTER TABLE public.post_votes_id_seq OWNER TO jeremy;
1119
1120--
1121-- Name: post_votes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
1122--
1123
1124ALTER SEQUENCE post_votes_id_seq OWNED BY post_votes.id;
1125
1126
1127--
1128-- Name: posts_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
1129--
1130
1131CREATE SEQUENCE posts_id_seq
1132 START WITH 1
1133 INCREMENT BY 1
1134 NO MAXVALUE
1135 NO MINVALUE
1136 CACHE 1;
1137
1138
1139ALTER TABLE public.posts_id_seq OWNER TO jeremy;
1140
1141--
1142-- Name: posts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
1143--
1144
1145ALTER SEQUENCE posts_id_seq OWNED BY posts.id;
1146
1147
1148--
1149-- Name: posts_tags; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
1150--
1151
1152CREATE TABLE posts_tags (
1153 post_id integer NOT NULL,
1154 tag_id integer NOT NULL
1155);
1156
1157
1158ALTER TABLE public.posts_tags OWNER TO jeremy;
1159
1160--
1161-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
1162--
1163
1164CREATE TABLE schema_migrations (
1165 version character varying(255) NOT NULL
1166);
1167
1168
1169ALTER TABLE public.schema_migrations OWNER TO jeremy;
1170
1171--
1172-- Name: server_keys; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
1173--
1174
1175CREATE TABLE server_keys (
1176 id integer NOT NULL,
1177 name character varying(255) NOT NULL,
1178 value text
1179);
1180
1181
1182ALTER TABLE public.server_keys OWNER TO jeremy;
1183
1184--
1185-- Name: server_keys_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
1186--
1187
1188CREATE SEQUENCE server_keys_id_seq
1189 START WITH 1
1190 INCREMENT BY 1
1191 NO MAXVALUE
1192 NO MINVALUE
1193 CACHE 1;
1194
1195
1196ALTER TABLE public.server_keys_id_seq OWNER TO jeremy;
1197
1198--
1199-- Name: server_keys_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
1200--
1201
1202ALTER SEQUENCE server_keys_id_seq OWNED BY server_keys.id;
1203
1204
1205--
1206-- Name: table_data; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
1207--
1208
1209CREATE TABLE table_data (
1210 name text NOT NULL,
1211 row_count integer NOT NULL
1212);
1213
1214
1215ALTER TABLE public.table_data OWNER TO jeremy;
1216
1217--
1218-- Name: tag_aliases; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
1219--
1220
1221CREATE TABLE tag_aliases (
1222 id integer NOT NULL,
1223 name text NOT NULL,
1224 alias_id integer NOT NULL,
1225 is_pending boolean DEFAULT false NOT NULL,
1226 reason text DEFAULT ''::text NOT NULL,
1227 creator_id integer
1228);
1229
1230
1231ALTER TABLE public.tag_aliases OWNER TO jeremy;
1232
1233--
1234-- Name: tag_aliases_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
1235--
1236
1237CREATE SEQUENCE tag_aliases_id_seq
1238 START WITH 1
1239 INCREMENT BY 1
1240 NO MAXVALUE
1241 NO MINVALUE
1242 CACHE 1;
1243
1244
1245ALTER TABLE public.tag_aliases_id_seq OWNER TO jeremy;
1246
1247--
1248-- Name: tag_aliases_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
1249--
1250
1251ALTER SEQUENCE tag_aliases_id_seq OWNED BY tag_aliases.id;
1252
1253
1254--
1255-- Name: tag_implications; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
1256--
1257
1258CREATE TABLE tag_implications (
1259 id integer NOT NULL,
1260 consequent_id integer NOT NULL,
1261 predicate_id integer NOT NULL,
1262 is_pending boolean DEFAULT false NOT NULL,
1263 reason text DEFAULT ''::text NOT NULL,
1264 creator_id integer
1265);
1266
1267
1268ALTER TABLE public.tag_implications OWNER TO jeremy;
1269
1270--
1271-- Name: tag_implications_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
1272--
1273
1274CREATE SEQUENCE tag_implications_id_seq
1275 START WITH 1
1276 INCREMENT BY 1
1277 NO MAXVALUE
1278 NO MINVALUE
1279 CACHE 1;
1280
1281
1282ALTER TABLE public.tag_implications_id_seq OWNER TO jeremy;
1283
1284--
1285-- Name: tag_implications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
1286--
1287
1288ALTER SEQUENCE tag_implications_id_seq OWNED BY tag_implications.id;
1289
1290
1291--
1292-- Name: tags; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
1293--
1294
1295CREATE TABLE tags (
1296 id integer NOT NULL,
1297 name text NOT NULL,
1298 post_count integer DEFAULT 0 NOT NULL,
1299 cached_related text DEFAULT '[]'::text NOT NULL,
1300 cached_related_expires_on timestamp without time zone DEFAULT now() NOT NULL,
1301 tag_type smallint DEFAULT 0 NOT NULL,
1302 is_ambiguous boolean DEFAULT false NOT NULL
1303);
1304
1305
1306ALTER TABLE public.tags OWNER TO jeremy;
1307
1308--
1309-- Name: tags_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
1310--
1311
1312CREATE SEQUENCE tags_id_seq
1313 START WITH 1
1314 INCREMENT BY 1
1315 NO MAXVALUE
1316 NO MINVALUE
1317 CACHE 1;
1318
1319
1320ALTER TABLE public.tags_id_seq OWNER TO jeremy;
1321
1322--
1323-- Name: tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
1324--
1325
1326ALTER SEQUENCE tags_id_seq OWNED BY tags.id;
1327
1328
1329--
1330-- Name: test_janitors; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
1331--
1332
1333CREATE TABLE test_janitors (
1334 id integer NOT NULL,
1335 user_id integer NOT NULL,
1336 test_promotion_date timestamp without time zone NOT NULL,
1337 promotion_date timestamp without time zone,
1338 original_level integer NOT NULL,
1339 created_at timestamp without time zone,
1340 updated_at timestamp without time zone
1341);
1342
1343
1344ALTER TABLE public.test_janitors OWNER TO jeremy;
1345
1346--
1347-- Name: test_janitors_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
1348--
1349
1350CREATE SEQUENCE test_janitors_id_seq
1351 START WITH 1
1352 INCREMENT BY 1
1353 NO MAXVALUE
1354 NO MINVALUE
1355 CACHE 1;
1356
1357
1358ALTER TABLE public.test_janitors_id_seq OWNER TO jeremy;
1359
1360--
1361-- Name: test_janitors_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
1362--
1363
1364ALTER SEQUENCE test_janitors_id_seq OWNED BY test_janitors.id;
1365
1366
1367--
1368-- Name: user_blacklisted_tags; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
1369--
1370
1371CREATE TABLE user_blacklisted_tags (
1372 id integer NOT NULL,
1373 user_id integer NOT NULL,
1374 tags text NOT NULL
1375);
1376
1377
1378ALTER TABLE public.user_blacklisted_tags OWNER TO jeremy;
1379
1380--
1381-- Name: user_blacklisted_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
1382--
1383
1384CREATE SEQUENCE user_blacklisted_tags_id_seq
1385 START WITH 1
1386 INCREMENT BY 1
1387 NO MAXVALUE
1388 NO MINVALUE
1389 CACHE 1;
1390
1391
1392ALTER TABLE public.user_blacklisted_tags_id_seq OWNER TO jeremy;
1393
1394--
1395-- Name: user_blacklisted_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
1396--
1397
1398ALTER SEQUENCE user_blacklisted_tags_id_seq OWNED BY user_blacklisted_tags.id;
1399
1400
1401--
1402-- Name: user_records; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
1403--
1404
1405CREATE TABLE user_records (
1406 id integer NOT NULL,
1407 user_id integer NOT NULL,
1408 reported_by integer NOT NULL,
1409 created_at timestamp without time zone DEFAULT now() NOT NULL,
1410 is_positive boolean DEFAULT true NOT NULL,
1411 body text NOT NULL
1412);
1413
1414
1415ALTER TABLE public.user_records OWNER TO jeremy;
1416
1417--
1418-- Name: user_records_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
1419--
1420
1421CREATE SEQUENCE user_records_id_seq
1422 START WITH 1
1423 INCREMENT BY 1
1424 NO MAXVALUE
1425 NO MINVALUE
1426 CACHE 1;
1427
1428
1429ALTER TABLE public.user_records_id_seq OWNER TO jeremy;
1430
1431--
1432-- Name: user_records_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
1433--
1434
1435ALTER SEQUENCE user_records_id_seq OWNED BY user_records.id;
1436
1437
1438--
1439-- Name: users; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
1440--
1441
1442CREATE TABLE users (
1443 id integer NOT NULL,
1444 name text NOT NULL,
1445 password_hash text NOT NULL,
1446 level integer DEFAULT 0 NOT NULL,
1447 email text DEFAULT ''::text NOT NULL,
1448 recent_tags text DEFAULT ''::text NOT NULL,
1449 invite_count integer DEFAULT 0 NOT NULL,
1450 always_resize_images boolean DEFAULT false NOT NULL,
1451 invited_by integer,
1452 created_at timestamp without time zone DEFAULT now() NOT NULL,
1453 last_logged_in_at timestamp without time zone DEFAULT now() NOT NULL,
1454 last_forum_topic_read_at timestamp without time zone DEFAULT '1960-01-01 00:00:00'::timestamp without time zone NOT NULL,
1455 has_mail boolean DEFAULT false NOT NULL,
1456 receive_dmails boolean DEFAULT false NOT NULL,
1457 show_samples boolean,
1458 base_upload_limit integer,
1459 uploaded_tags text DEFAULT ''::text NOT NULL,
1460 enable_autocomplete boolean DEFAULT true NOT NULL,
1461 comment_threshold integer DEFAULT 0 NOT NULL
1462);
1463
1464
1465ALTER TABLE public.users OWNER TO jeremy;
1466
1467--
1468-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
1469--
1470
1471CREATE SEQUENCE users_id_seq
1472 START WITH 1
1473 INCREMENT BY 1
1474 NO MAXVALUE
1475 NO MINVALUE
1476 CACHE 1;
1477
1478
1479ALTER TABLE public.users_id_seq OWNER TO jeremy;
1480
1481--
1482-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
1483--
1484
1485ALTER SEQUENCE users_id_seq OWNED BY users.id;
1486
1487
1488--
1489-- Name: wiki_page_versions; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
1490--
1491
1492CREATE TABLE wiki_page_versions (
1493 id integer NOT NULL,
1494 created_at timestamp without time zone NOT NULL,
1495 updated_at timestamp without time zone NOT NULL,
1496 version integer DEFAULT 1 NOT NULL,
1497 title text NOT NULL,
1498 body text NOT NULL,
1499 user_id integer,
1500 ip_addr inet NOT NULL,
1501 wiki_page_id integer NOT NULL,
1502 is_locked boolean DEFAULT false NOT NULL,
1503 text_search_index tsvector
1504);
1505
1506
1507ALTER TABLE public.wiki_page_versions OWNER TO jeremy;
1508
1509--
1510-- Name: wiki_page_versions_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
1511--
1512
1513CREATE SEQUENCE wiki_page_versions_id_seq
1514 START WITH 1
1515 INCREMENT BY 1
1516 NO MAXVALUE
1517 NO MINVALUE
1518 CACHE 1;
1519
1520
1521ALTER TABLE public.wiki_page_versions_id_seq OWNER TO jeremy;
1522
1523--
1524-- Name: wiki_page_versions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
1525--
1526
1527ALTER SEQUENCE wiki_page_versions_id_seq OWNED BY wiki_page_versions.id;
1528
1529
1530--
1531-- Name: wiki_pages; Type: TABLE; Schema: public; Owner: jeremy; Tablespace:
1532--
1533
1534CREATE TABLE wiki_pages (
1535 id integer NOT NULL,
1536 created_at timestamp without time zone NOT NULL,
1537 updated_at timestamp without time zone NOT NULL,
1538 version integer DEFAULT 1 NOT NULL,
1539 title text NOT NULL,
1540 body text NOT NULL,
1541 user_id integer,
1542 ip_addr inet NOT NULL,
1543 is_locked boolean DEFAULT false NOT NULL,
1544 text_search_index tsvector
1545);
1546
1547
1548ALTER TABLE public.wiki_pages OWNER TO jeremy;
1549
1550--
1551-- Name: wiki_pages_id_seq; Type: SEQUENCE; Schema: public; Owner: jeremy
1552--
1553
1554CREATE SEQUENCE wiki_pages_id_seq
1555 START WITH 1
1556 INCREMENT BY 1
1557 NO MAXVALUE
1558 NO MINVALUE
1559 CACHE 1;
1560
1561
1562ALTER TABLE public.wiki_pages_id_seq OWNER TO jeremy;
1563
1564--
1565-- Name: wiki_pages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: jeremy
1566--
1567
1568ALTER SEQUENCE wiki_pages_id_seq OWNED BY wiki_pages.id;
1569
1570
1571--
1572-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1573--
1574
1575ALTER TABLE advertisement_hits ALTER COLUMN id SET DEFAULT nextval('advertisement_hits_id_seq'::regclass);
1576
1577
1578--
1579-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1580--
1581
1582ALTER TABLE advertisements ALTER COLUMN id SET DEFAULT nextval('advertisements_id_seq'::regclass);
1583
1584
1585--
1586-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1587--
1588
1589ALTER TABLE artist_urls ALTER COLUMN id SET DEFAULT nextval('artist_urls_id_seq'::regclass);
1590
1591
1592--
1593-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1594--
1595
1596ALTER TABLE artist_versions ALTER COLUMN id SET DEFAULT nextval('artist_versions_id_seq'::regclass);
1597
1598
1599--
1600-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1601--
1602
1603ALTER TABLE artists ALTER COLUMN id SET DEFAULT nextval('artists_id_seq'::regclass);
1604
1605
1606--
1607-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1608--
1609
1610ALTER TABLE banned_ips ALTER COLUMN id SET DEFAULT nextval('banned_ips_id_seq'::regclass);
1611
1612
1613--
1614-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1615--
1616
1617ALTER TABLE bans ALTER COLUMN id SET DEFAULT nextval('bans_id_seq'::regclass);
1618
1619
1620--
1621-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1622--
1623
1624ALTER TABLE comment_votes ALTER COLUMN id SET DEFAULT nextval('comment_votes_id_seq'::regclass);
1625
1626
1627--
1628-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1629--
1630
1631ALTER TABLE comments ALTER COLUMN id SET DEFAULT nextval('comments_id_seq'::regclass);
1632
1633
1634--
1635-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1636--
1637
1638ALTER TABLE dmails ALTER COLUMN id SET DEFAULT nextval('dmails_id_seq'::regclass);
1639
1640
1641--
1642-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1643--
1644
1645ALTER TABLE favorites ALTER COLUMN id SET DEFAULT nextval('favorites_id_seq'::regclass);
1646
1647
1648--
1649-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1650--
1651
1652ALTER TABLE flagged_post_details ALTER COLUMN id SET DEFAULT nextval('flagged_post_details_id_seq'::regclass);
1653
1654
1655--
1656-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1657--
1658
1659ALTER TABLE forum_posts ALTER COLUMN id SET DEFAULT nextval('forum_posts_id_seq'::regclass);
1660
1661
1662--
1663-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1664--
1665
1666ALTER TABLE job_tasks ALTER COLUMN id SET DEFAULT nextval('job_tasks_id_seq'::regclass);
1667
1668
1669--
1670-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1671--
1672
1673ALTER TABLE mod_queue_posts ALTER COLUMN id SET DEFAULT nextval('mod_queue_posts_id_seq'::regclass);
1674
1675
1676--
1677-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1678--
1679
1680ALTER TABLE note_versions ALTER COLUMN id SET DEFAULT nextval('note_versions_id_seq'::regclass);
1681
1682
1683--
1684-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1685--
1686
1687ALTER TABLE notes ALTER COLUMN id SET DEFAULT nextval('notes_id_seq'::regclass);
1688
1689
1690--
1691-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1692--
1693
1694ALTER TABLE pool_updates ALTER COLUMN id SET DEFAULT nextval('pool_updates_id_seq'::regclass);
1695
1696
1697--
1698-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1699--
1700
1701ALTER TABLE pools ALTER COLUMN id SET DEFAULT nextval('pools_id_seq'::regclass);
1702
1703
1704--
1705-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1706--
1707
1708ALTER TABLE pools_posts ALTER COLUMN id SET DEFAULT nextval('pools_posts_id_seq'::regclass);
1709
1710
1711--
1712-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1713--
1714
1715ALTER TABLE post_tag_histories ALTER COLUMN id SET DEFAULT nextval('post_tag_histories_id_seq'::regclass);
1716
1717
1718--
1719-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1720--
1721
1722ALTER TABLE post_votes ALTER COLUMN id SET DEFAULT nextval('post_votes_id_seq'::regclass);
1723
1724
1725--
1726-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1727--
1728
1729ALTER TABLE posts ALTER COLUMN id SET DEFAULT nextval('posts_id_seq'::regclass);
1730
1731
1732--
1733-- Name: change_seq; Type: DEFAULT; Schema: public; Owner: jeremy
1734--
1735
1736ALTER TABLE posts ALTER COLUMN change_seq SET DEFAULT nextval('post_change_seq'::regclass);
1737
1738
1739--
1740-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1741--
1742
1743ALTER TABLE server_keys ALTER COLUMN id SET DEFAULT nextval('server_keys_id_seq'::regclass);
1744
1745
1746--
1747-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1748--
1749
1750ALTER TABLE tag_aliases ALTER COLUMN id SET DEFAULT nextval('tag_aliases_id_seq'::regclass);
1751
1752
1753--
1754-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1755--
1756
1757ALTER TABLE tag_implications ALTER COLUMN id SET DEFAULT nextval('tag_implications_id_seq'::regclass);
1758
1759
1760--
1761-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1762--
1763
1764ALTER TABLE tag_subscriptions ALTER COLUMN id SET DEFAULT nextval('favorite_tags_id_seq'::regclass);
1765
1766
1767--
1768-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1769--
1770
1771ALTER TABLE tags ALTER COLUMN id SET DEFAULT nextval('tags_id_seq'::regclass);
1772
1773
1774--
1775-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1776--
1777
1778ALTER TABLE test_janitors ALTER COLUMN id SET DEFAULT nextval('test_janitors_id_seq'::regclass);
1779
1780
1781--
1782-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1783--
1784
1785ALTER TABLE user_blacklisted_tags ALTER COLUMN id SET DEFAULT nextval('user_blacklisted_tags_id_seq'::regclass);
1786
1787
1788--
1789-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1790--
1791
1792ALTER TABLE user_records ALTER COLUMN id SET DEFAULT nextval('user_records_id_seq'::regclass);
1793
1794
1795--
1796-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1797--
1798
1799ALTER TABLE users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
1800
1801
1802--
1803-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1804--
1805
1806ALTER TABLE wiki_page_versions ALTER COLUMN id SET DEFAULT nextval('wiki_page_versions_id_seq'::regclass);
1807
1808
1809--
1810-- Name: id; Type: DEFAULT; Schema: public; Owner: jeremy
1811--
1812
1813ALTER TABLE wiki_pages ALTER COLUMN id SET DEFAULT nextval('wiki_pages_id_seq'::regclass);
1814
1815
1816--
1817-- Name: advertisement_hits_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1818--
1819
1820ALTER TABLE ONLY advertisement_hits
1821 ADD CONSTRAINT advertisement_hits_pkey PRIMARY KEY (id);
1822
1823
1824--
1825-- Name: advertisements_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1826--
1827
1828ALTER TABLE ONLY advertisements
1829 ADD CONSTRAINT advertisements_pkey PRIMARY KEY (id);
1830
1831
1832--
1833-- Name: artist_urls_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1834--
1835
1836ALTER TABLE ONLY artist_urls
1837 ADD CONSTRAINT artist_urls_pkey PRIMARY KEY (id);
1838
1839
1840--
1841-- Name: artist_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1842--
1843
1844ALTER TABLE ONLY artist_versions
1845 ADD CONSTRAINT artist_versions_pkey PRIMARY KEY (id);
1846
1847
1848--
1849-- Name: artists_name_uniq; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1850--
1851
1852ALTER TABLE ONLY artists
1853 ADD CONSTRAINT artists_name_uniq UNIQUE (name);
1854
1855
1856--
1857-- Name: artists_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1858--
1859
1860ALTER TABLE ONLY artists
1861 ADD CONSTRAINT artists_pkey PRIMARY KEY (id);
1862
1863
1864--
1865-- Name: banned_ips_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1866--
1867
1868ALTER TABLE ONLY banned_ips
1869 ADD CONSTRAINT banned_ips_pkey PRIMARY KEY (id);
1870
1871
1872--
1873-- Name: bans_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1874--
1875
1876ALTER TABLE ONLY bans
1877 ADD CONSTRAINT bans_pkey PRIMARY KEY (id);
1878
1879
1880--
1881-- Name: comment_votes_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1882--
1883
1884ALTER TABLE ONLY comment_votes
1885 ADD CONSTRAINT comment_votes_pkey PRIMARY KEY (id);
1886
1887
1888--
1889-- Name: comments_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1890--
1891
1892ALTER TABLE ONLY comments
1893 ADD CONSTRAINT comments_pkey PRIMARY KEY (id);
1894
1895
1896--
1897-- Name: dmails_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1898--
1899
1900ALTER TABLE ONLY dmails
1901 ADD CONSTRAINT dmails_pkey PRIMARY KEY (id);
1902
1903
1904--
1905-- Name: favorite_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1906--
1907
1908ALTER TABLE ONLY tag_subscriptions
1909 ADD CONSTRAINT favorite_tags_pkey PRIMARY KEY (id);
1910
1911
1912--
1913-- Name: favorites_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1914--
1915
1916ALTER TABLE ONLY favorites
1917 ADD CONSTRAINT favorites_pkey PRIMARY KEY (id);
1918
1919
1920--
1921-- Name: flagged_post_details_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1922--
1923
1924ALTER TABLE ONLY flagged_post_details
1925 ADD CONSTRAINT flagged_post_details_pkey PRIMARY KEY (id);
1926
1927
1928--
1929-- Name: forum_posts_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1930--
1931
1932ALTER TABLE ONLY forum_posts
1933 ADD CONSTRAINT forum_posts_pkey PRIMARY KEY (id);
1934
1935
1936--
1937-- Name: job_tasks_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1938--
1939
1940ALTER TABLE ONLY job_tasks
1941 ADD CONSTRAINT job_tasks_pkey PRIMARY KEY (id);
1942
1943
1944--
1945-- Name: mod_queue_posts_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1946--
1947
1948ALTER TABLE ONLY mod_queue_posts
1949 ADD CONSTRAINT mod_queue_posts_pkey PRIMARY KEY (id);
1950
1951
1952--
1953-- Name: note_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1954--
1955
1956ALTER TABLE ONLY note_versions
1957 ADD CONSTRAINT note_versions_pkey PRIMARY KEY (id);
1958
1959
1960--
1961-- Name: notes_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1962--
1963
1964ALTER TABLE ONLY notes
1965 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1966
1967
1968--
1969-- Name: pool_updates_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1970--
1971
1972ALTER TABLE ONLY pool_updates
1973 ADD CONSTRAINT pool_updates_pkey PRIMARY KEY (id);
1974
1975
1976--
1977-- Name: pools_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1978--
1979
1980ALTER TABLE ONLY pools
1981 ADD CONSTRAINT pools_pkey PRIMARY KEY (id);
1982
1983
1984--
1985-- Name: pools_posts_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1986--
1987
1988ALTER TABLE ONLY pools_posts
1989 ADD CONSTRAINT pools_posts_pkey PRIMARY KEY (id);
1990
1991
1992--
1993-- Name: post_tag_histories_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
1994--
1995
1996ALTER TABLE ONLY post_tag_histories
1997 ADD CONSTRAINT post_tag_histories_pkey PRIMARY KEY (id);
1998
1999
2000--
2001-- Name: post_votes_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
2002--
2003
2004ALTER TABLE ONLY post_votes
2005 ADD CONSTRAINT post_votes_pkey PRIMARY KEY (id);
2006
2007
2008--
2009-- Name: posts_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
2010--
2011
2012ALTER TABLE ONLY posts
2013 ADD CONSTRAINT posts_pkey PRIMARY KEY (id);
2014
2015
2016--
2017-- Name: server_keys_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
2018--
2019
2020ALTER TABLE ONLY server_keys
2021 ADD CONSTRAINT server_keys_pkey PRIMARY KEY (id);
2022
2023
2024--
2025-- Name: table_data_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
2026--
2027
2028ALTER TABLE ONLY table_data
2029 ADD CONSTRAINT table_data_pkey PRIMARY KEY (name);
2030
2031
2032--
2033-- Name: tag_aliases_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
2034--
2035
2036ALTER TABLE ONLY tag_aliases
2037 ADD CONSTRAINT tag_aliases_pkey PRIMARY KEY (id);
2038
2039
2040--
2041-- Name: tag_implications_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
2042--
2043
2044ALTER TABLE ONLY tag_implications
2045 ADD CONSTRAINT tag_implications_pkey PRIMARY KEY (id);
2046
2047
2048--
2049-- Name: tags_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
2050--
2051
2052ALTER TABLE ONLY tags
2053 ADD CONSTRAINT tags_pkey PRIMARY KEY (id);
2054
2055
2056--
2057-- Name: test_janitors_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
2058--
2059
2060ALTER TABLE ONLY test_janitors
2061 ADD CONSTRAINT test_janitors_pkey PRIMARY KEY (id);
2062
2063
2064--
2065-- Name: user_blacklisted_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
2066--
2067
2068ALTER TABLE ONLY user_blacklisted_tags
2069 ADD CONSTRAINT user_blacklisted_tags_pkey PRIMARY KEY (id);
2070
2071
2072--
2073-- Name: user_records_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
2074--
2075
2076ALTER TABLE ONLY user_records
2077 ADD CONSTRAINT user_records_pkey PRIMARY KEY (id);
2078
2079
2080--
2081-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
2082--
2083
2084ALTER TABLE ONLY users
2085 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2086
2087
2088--
2089-- Name: wiki_page_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
2090--
2091
2092ALTER TABLE ONLY wiki_page_versions
2093 ADD CONSTRAINT wiki_page_versions_pkey PRIMARY KEY (id);
2094
2095
2096--
2097-- Name: wiki_pages_pkey; Type: CONSTRAINT; Schema: public; Owner: jeremy; Tablespace:
2098--
2099
2100ALTER TABLE ONLY wiki_pages
2101 ADD CONSTRAINT wiki_pages_pkey PRIMARY KEY (id);
2102
2103
2104--
2105-- Name: comments_text_search_idx; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2106--
2107
2108CREATE INDEX comments_text_search_idx ON notes USING gin (text_search_index);
2109
2110
2111--
2112-- Name: forum_posts__parent_id_idx; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2113--
2114
2115CREATE INDEX forum_posts__parent_id_idx ON forum_posts USING btree (parent_id) WHERE (parent_id IS NULL);
2116
2117
2118--
2119-- Name: forum_posts_search_idx; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2120--
2121
2122CREATE INDEX forum_posts_search_idx ON forum_posts USING gin (text_search_index);
2123
2124
2125--
2126-- Name: idx_comments__post; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2127--
2128
2129CREATE INDEX idx_comments__post ON comments USING btree (post_id);
2130
2131
2132--
2133-- Name: idx_favorites__post; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2134--
2135
2136CREATE INDEX idx_favorites__post ON favorites USING btree (post_id);
2137
2138
2139--
2140-- Name: idx_favorites__user; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2141--
2142
2143CREATE INDEX idx_favorites__user ON favorites USING btree (user_id);
2144
2145
2146--
2147-- Name: idx_note_versions__post; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2148--
2149
2150CREATE INDEX idx_note_versions__post ON note_versions USING btree (post_id);
2151
2152
2153--
2154-- Name: idx_notes__note; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2155--
2156
2157CREATE INDEX idx_notes__note ON note_versions USING btree (note_id);
2158
2159
2160--
2161-- Name: idx_notes__post; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2162--
2163
2164CREATE INDEX idx_notes__post ON notes USING btree (post_id);
2165
2166
2167--
2168-- Name: idx_post_tag_histories__post; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2169--
2170
2171CREATE INDEX idx_post_tag_histories__post ON post_tag_histories USING btree (post_id);
2172
2173
2174--
2175-- Name: idx_posts__created_at; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2176--
2177
2178CREATE INDEX idx_posts__created_at ON posts USING btree (created_at);
2179
2180
2181--
2182-- Name: idx_posts__last_commented_at; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2183--
2184
2185CREATE INDEX idx_posts__last_commented_at ON posts USING btree (last_commented_at) WHERE (last_commented_at IS NOT NULL);
2186
2187
2188--
2189-- Name: idx_posts__last_noted_at; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2190--
2191
2192CREATE INDEX idx_posts__last_noted_at ON posts USING btree (last_noted_at) WHERE (last_noted_at IS NOT NULL);
2193
2194
2195--
2196-- Name: idx_posts__md5; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2197--
2198
2199CREATE UNIQUE INDEX idx_posts__md5 ON posts USING btree (md5);
2200
2201
2202--
2203-- Name: idx_posts__user; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2204--
2205
2206CREATE INDEX idx_posts__user ON posts USING btree (user_id) WHERE (user_id IS NOT NULL);
2207
2208
2209--
2210-- Name: idx_posts_parent_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2211--
2212
2213CREATE INDEX idx_posts_parent_id ON posts USING btree (parent_id) WHERE (parent_id IS NOT NULL);
2214
2215
2216--
2217-- Name: idx_posts_tags__post; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2218--
2219
2220CREATE INDEX idx_posts_tags__post ON posts_tags USING btree (post_id);
2221
2222
2223--
2224-- Name: idx_posts_tags__tag; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2225--
2226
2227CREATE INDEX idx_posts_tags__tag ON posts_tags USING btree (tag_id);
2228
2229
2230--
2231-- Name: idx_tag_aliases__name; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2232--
2233
2234CREATE UNIQUE INDEX idx_tag_aliases__name ON tag_aliases USING btree (name);
2235
2236
2237--
2238-- Name: idx_tag_implications__child; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2239--
2240
2241CREATE INDEX idx_tag_implications__child ON tag_implications USING btree (predicate_id);
2242
2243
2244--
2245-- Name: idx_tag_implications__parent; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2246--
2247
2248CREATE INDEX idx_tag_implications__parent ON tag_implications USING btree (consequent_id);
2249
2250
2251--
2252-- Name: idx_tags__name; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2253--
2254
2255CREATE UNIQUE INDEX idx_tags__name ON tags USING btree (name);
2256
2257
2258--
2259-- Name: idx_tags__post_count; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2260--
2261
2262CREATE INDEX idx_tags__post_count ON tags USING btree (post_count);
2263
2264
2265--
2266-- Name: idx_users__name; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2267--
2268
2269CREATE INDEX idx_users__name ON users USING btree (lower(name));
2270
2271
2272--
2273-- Name: idx_wiki_page_versions__wiki_page; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2274--
2275
2276CREATE INDEX idx_wiki_page_versions__wiki_page ON wiki_page_versions USING btree (wiki_page_id);
2277
2278
2279--
2280-- Name: idx_wiki_pages__title; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2281--
2282
2283CREATE UNIQUE INDEX idx_wiki_pages__title ON wiki_pages USING btree (title);
2284
2285
2286--
2287-- Name: idx_wiki_pages__updated_at; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2288--
2289
2290CREATE INDEX idx_wiki_pages__updated_at ON wiki_pages USING btree (updated_at);
2291
2292
2293--
2294-- Name: index_advertisement_hits_on_advertisement_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2295--
2296
2297CREATE INDEX index_advertisement_hits_on_advertisement_id ON advertisement_hits USING btree (advertisement_id);
2298
2299
2300--
2301-- Name: index_advertisement_hits_on_created_at; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2302--
2303
2304CREATE INDEX index_advertisement_hits_on_created_at ON advertisement_hits USING btree (created_at);
2305
2306
2307--
2308-- Name: index_artist_urls_on_artist_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2309--
2310
2311CREATE INDEX index_artist_urls_on_artist_id ON artist_urls USING btree (artist_id);
2312
2313
2314--
2315-- Name: index_artist_urls_on_normalized_url; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2316--
2317
2318CREATE INDEX index_artist_urls_on_normalized_url ON artist_urls USING btree (normalized_url);
2319
2320
2321--
2322-- Name: index_artist_urls_on_url; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2323--
2324
2325CREATE INDEX index_artist_urls_on_url ON artist_urls USING btree (url);
2326
2327
2328--
2329-- Name: index_artist_versions_on_artist_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2330--
2331
2332CREATE INDEX index_artist_versions_on_artist_id ON artist_versions USING btree (artist_id);
2333
2334
2335--
2336-- Name: index_artist_versions_on_updater_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2337--
2338
2339CREATE INDEX index_artist_versions_on_updater_id ON artist_versions USING btree (updater_id);
2340
2341
2342--
2343-- Name: index_artists_on_other_names_array; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2344--
2345
2346CREATE INDEX index_artists_on_other_names_array ON artists USING btree (other_names_array);
2347
2348
2349--
2350-- Name: index_banned_ips_on_ip_addr; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2351--
2352
2353CREATE INDEX index_banned_ips_on_ip_addr ON banned_ips USING btree (ip_addr);
2354
2355
2356--
2357-- Name: index_bans_on_user_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2358--
2359
2360CREATE INDEX index_bans_on_user_id ON bans USING btree (user_id);
2361
2362
2363--
2364-- Name: index_comment_votes_on_comment_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2365--
2366
2367CREATE INDEX index_comment_votes_on_comment_id ON comment_votes USING btree (comment_id);
2368
2369
2370--
2371-- Name: index_comment_votes_on_created_at; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2372--
2373
2374CREATE INDEX index_comment_votes_on_created_at ON comment_votes USING btree (created_at);
2375
2376
2377--
2378-- Name: index_comment_votes_on_user_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2379--
2380
2381CREATE INDEX index_comment_votes_on_user_id ON comment_votes USING btree (user_id);
2382
2383
2384--
2385-- Name: index_comments_on_user_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2386--
2387
2388CREATE INDEX index_comments_on_user_id ON comments USING btree (user_id);
2389
2390
2391--
2392-- Name: index_dmails_on_from_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2393--
2394
2395CREATE INDEX index_dmails_on_from_id ON dmails USING btree (from_id);
2396
2397
2398--
2399-- Name: index_dmails_on_parent_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2400--
2401
2402CREATE INDEX index_dmails_on_parent_id ON dmails USING btree (parent_id);
2403
2404
2405--
2406-- Name: index_dmails_on_to_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2407--
2408
2409CREATE INDEX index_dmails_on_to_id ON dmails USING btree (to_id);
2410
2411
2412--
2413-- Name: index_flagged_post_details_on_post_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2414--
2415
2416CREATE INDEX index_flagged_post_details_on_post_id ON flagged_post_details USING btree (post_id);
2417
2418
2419--
2420-- Name: index_forum_posts_on_creator_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2421--
2422
2423CREATE INDEX index_forum_posts_on_creator_id ON forum_posts USING btree (creator_id);
2424
2425
2426--
2427-- Name: index_forum_posts_on_updated_at; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2428--
2429
2430CREATE INDEX index_forum_posts_on_updated_at ON forum_posts USING btree (updated_at);
2431
2432
2433--
2434-- Name: index_note_versions_on_user_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2435--
2436
2437CREATE INDEX index_note_versions_on_user_id ON note_versions USING btree (user_id);
2438
2439
2440--
2441-- Name: index_pool_updates_on_pool_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2442--
2443
2444CREATE INDEX index_pool_updates_on_pool_id ON pool_updates USING btree (pool_id);
2445
2446
2447--
2448-- Name: index_pool_updates_on_user_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2449--
2450
2451CREATE INDEX index_pool_updates_on_user_id ON pool_updates USING btree (user_id);
2452
2453
2454--
2455-- Name: index_post_tag_histories_on_user_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2456--
2457
2458CREATE INDEX index_post_tag_histories_on_user_id ON post_tag_histories USING btree (user_id);
2459
2460
2461--
2462-- Name: index_post_votes_on_created_at; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2463--
2464
2465CREATE INDEX index_post_votes_on_created_at ON post_votes USING btree (created_at);
2466
2467
2468--
2469-- Name: index_post_votes_on_post_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2470--
2471
2472CREATE INDEX index_post_votes_on_post_id ON post_votes USING btree (post_id);
2473
2474
2475--
2476-- Name: index_post_votes_on_user_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2477--
2478
2479CREATE INDEX index_post_votes_on_user_id ON post_votes USING btree (user_id);
2480
2481
2482--
2483-- Name: index_posts_on_approver_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2484--
2485
2486CREATE INDEX index_posts_on_approver_id ON posts USING btree (approver_id);
2487
2488
2489--
2490-- Name: index_posts_on_change_seq; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2491--
2492
2493CREATE INDEX index_posts_on_change_seq ON posts USING btree (change_seq);
2494
2495
2496--
2497-- Name: index_posts_on_file_size; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2498--
2499
2500CREATE INDEX index_posts_on_file_size ON posts USING btree (file_size);
2501
2502
2503--
2504-- Name: index_posts_on_height; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2505--
2506
2507CREATE INDEX index_posts_on_height ON posts USING btree (height);
2508
2509
2510--
2511-- Name: index_posts_on_source; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2512--
2513
2514CREATE INDEX index_posts_on_source ON posts USING btree (source);
2515
2516
2517--
2518-- Name: index_posts_on_tags_index; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2519--
2520
2521CREATE INDEX index_posts_on_tags_index ON posts USING gin (tags_index);
2522
2523
2524--
2525-- Name: index_posts_on_width; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2526--
2527
2528CREATE INDEX index_posts_on_width ON posts USING btree (width);
2529
2530
2531--
2532-- Name: index_server_keys_on_name; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2533--
2534
2535CREATE UNIQUE INDEX index_server_keys_on_name ON server_keys USING btree (name);
2536
2537
2538--
2539-- Name: index_tag_subscriptions_on_name; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2540--
2541
2542CREATE INDEX index_tag_subscriptions_on_name ON tag_subscriptions USING btree (name);
2543
2544
2545--
2546-- Name: index_tag_subscriptions_on_user_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2547--
2548
2549CREATE INDEX index_tag_subscriptions_on_user_id ON tag_subscriptions USING btree (user_id);
2550
2551
2552--
2553-- Name: index_test_janitors_on_user_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2554--
2555
2556CREATE INDEX index_test_janitors_on_user_id ON test_janitors USING btree (user_id);
2557
2558
2559--
2560-- Name: index_user_blacklisted_tags_on_user_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2561--
2562
2563CREATE INDEX index_user_blacklisted_tags_on_user_id ON user_blacklisted_tags USING btree (user_id);
2564
2565
2566--
2567-- Name: index_wiki_page_versions_on_user_id; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2568--
2569
2570CREATE INDEX index_wiki_page_versions_on_user_id ON wiki_page_versions USING btree (user_id);
2571
2572
2573--
2574-- Name: notes_text_search_idx; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2575--
2576
2577CREATE INDEX notes_text_search_idx ON notes USING gin (text_search_index);
2578
2579
2580--
2581-- Name: pools_posts_pool_id_idx; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2582--
2583
2584CREATE INDEX pools_posts_pool_id_idx ON pools_posts USING btree (pool_id);
2585
2586
2587--
2588-- Name: pools_posts_post_id_idx; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2589--
2590
2591CREATE INDEX pools_posts_post_id_idx ON pools_posts USING btree (post_id);
2592
2593
2594--
2595-- Name: pools_user_id_idx; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2596--
2597
2598CREATE INDEX pools_user_id_idx ON pools USING btree (user_id);
2599
2600
2601--
2602-- Name: post_status_idx; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2603--
2604
2605CREATE INDEX post_status_idx ON posts USING btree (status) WHERE (status < 'active'::post_status);
2606
2607
2608--
2609-- Name: posts_mpixels; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2610--
2611
2612CREATE INDEX posts_mpixels ON posts USING btree (((((width * height))::numeric / 1000000.0)));
2613
2614
2615--
2616-- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2617--
2618
2619CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
2620
2621
2622--
2623-- Name: wiki_pages_search_idx; Type: INDEX; Schema: public; Owner: jeremy; Tablespace:
2624--
2625
2626CREATE INDEX wiki_pages_search_idx ON wiki_pages USING gin (text_search_index);
2627
2628
2629--
2630-- Name: pools_posts_delete_trg; Type: TRIGGER; Schema: public; Owner: jeremy
2631--
2632
2633CREATE TRIGGER pools_posts_delete_trg
2634 BEFORE DELETE ON pools_posts
2635 FOR EACH ROW
2636 EXECUTE PROCEDURE pools_posts_delete_trg();
2637
2638
2639--
2640-- Name: pools_posts_insert_trg; Type: TRIGGER; Schema: public; Owner: jeremy
2641--
2642
2643CREATE TRIGGER pools_posts_insert_trg
2644 BEFORE INSERT ON pools_posts
2645 FOR EACH ROW
2646 EXECUTE PROCEDURE pools_posts_insert_trg();
2647
2648
2649--
2650-- Name: trg_comment_search_update; Type: TRIGGER; Schema: public; Owner: jeremy
2651--
2652
2653CREATE TRIGGER trg_comment_search_update
2654 BEFORE INSERT OR UPDATE ON comments
2655 FOR EACH ROW
2656 EXECUTE PROCEDURE tsvector_update_trigger('text_search_index', 'pg_catalog.english', 'body');
2657
2658
2659--
2660-- Name: trg_forum_post_search_update; Type: TRIGGER; Schema: public; Owner: jeremy
2661--
2662
2663CREATE TRIGGER trg_forum_post_search_update
2664 BEFORE INSERT OR UPDATE ON forum_posts
2665 FOR EACH ROW
2666 EXECUTE PROCEDURE tsvector_update_trigger('text_search_index', 'pg_catalog.english', 'title', 'body');
2667
2668
2669--
2670-- Name: trg_note_search_update; Type: TRIGGER; Schema: public; Owner: jeremy
2671--
2672
2673CREATE TRIGGER trg_note_search_update
2674 BEFORE INSERT OR UPDATE ON notes
2675 FOR EACH ROW
2676 EXECUTE PROCEDURE tsvector_update_trigger('text_search_index', 'pg_catalog.english', 'body');
2677
2678
2679--
2680-- Name: trg_posts_tags__delete; Type: TRIGGER; Schema: public; Owner: jeremy
2681--
2682
2683CREATE TRIGGER trg_posts_tags__delete
2684 BEFORE DELETE ON posts_tags
2685 FOR EACH ROW
2686 EXECUTE PROCEDURE trg_posts_tags__delete();
2687
2688
2689--
2690-- Name: trg_posts_tags__insert; Type: TRIGGER; Schema: public; Owner: jeremy
2691--
2692
2693CREATE TRIGGER trg_posts_tags__insert
2694 BEFORE INSERT ON posts_tags
2695 FOR EACH ROW
2696 EXECUTE PROCEDURE trg_posts_tags__insert();
2697
2698
2699--
2700-- Name: trg_posts_tags_index_update; Type: TRIGGER; Schema: public; Owner: jeremy
2701--
2702
2703CREATE TRIGGER trg_posts_tags_index_update
2704 BEFORE INSERT OR UPDATE ON posts
2705 FOR EACH ROW
2706 EXECUTE PROCEDURE tsvector_update_trigger('tags_index', 'public.danbooru', 'cached_tags');
2707
2708
2709--
2710-- Name: trg_wiki_page_search_update; Type: TRIGGER; Schema: public; Owner: jeremy
2711--
2712
2713CREATE TRIGGER trg_wiki_page_search_update
2714 BEFORE INSERT OR UPDATE ON wiki_pages
2715 FOR EACH ROW
2716 EXECUTE PROCEDURE tsvector_update_trigger('text_search_index', 'pg_catalog.english', 'title', 'body');
2717
2718
2719--
2720-- Name: artist_urls_artist_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2721--
2722
2723ALTER TABLE ONLY artist_urls
2724 ADD CONSTRAINT artist_urls_artist_id_fkey FOREIGN KEY (artist_id) REFERENCES artists(id) ON DELETE CASCADE;
2725
2726
2727--
2728-- Name: artists_updater_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2729--
2730
2731ALTER TABLE ONLY artists
2732 ADD CONSTRAINT artists_updater_id_fkey FOREIGN KEY (updater_id) REFERENCES users(id) ON DELETE SET NULL;
2733
2734
2735--
2736-- Name: bans_banned_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2737--
2738
2739ALTER TABLE ONLY bans
2740 ADD CONSTRAINT bans_banned_by_fkey FOREIGN KEY (banned_by) REFERENCES users(id) ON DELETE CASCADE;
2741
2742
2743--
2744-- Name: bans_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2745--
2746
2747ALTER TABLE ONLY bans
2748 ADD CONSTRAINT bans_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
2749
2750
2751--
2752-- Name: comment_votes_comment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2753--
2754
2755ALTER TABLE ONLY comment_votes
2756 ADD CONSTRAINT comment_votes_comment_id_fkey FOREIGN KEY (comment_id) REFERENCES comments(id) ON DELETE CASCADE;
2757
2758
2759--
2760-- Name: comment_votes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2761--
2762
2763ALTER TABLE ONLY comment_votes
2764 ADD CONSTRAINT comment_votes_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
2765
2766
2767--
2768-- Name: dmails_from_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2769--
2770
2771ALTER TABLE ONLY dmails
2772 ADD CONSTRAINT dmails_from_id_fkey FOREIGN KEY (from_id) REFERENCES users(id) ON DELETE CASCADE;
2773
2774
2775--
2776-- Name: dmails_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2777--
2778
2779ALTER TABLE ONLY dmails
2780 ADD CONSTRAINT dmails_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES dmails(id);
2781
2782
2783--
2784-- Name: dmails_to_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2785--
2786
2787ALTER TABLE ONLY dmails
2788 ADD CONSTRAINT dmails_to_id_fkey FOREIGN KEY (to_id) REFERENCES users(id) ON DELETE CASCADE;
2789
2790
2791--
2792-- Name: fk_comments__post; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2793--
2794
2795ALTER TABLE ONLY comments
2796 ADD CONSTRAINT fk_comments__post FOREIGN KEY (post_id) REFERENCES posts(id) ON DELETE CASCADE;
2797
2798
2799--
2800-- Name: fk_comments__user; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2801--
2802
2803ALTER TABLE ONLY comments
2804 ADD CONSTRAINT fk_comments__user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;
2805
2806
2807--
2808-- Name: fk_favorites__post; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2809--
2810
2811ALTER TABLE ONLY favorites
2812 ADD CONSTRAINT fk_favorites__post FOREIGN KEY (post_id) REFERENCES posts(id) ON DELETE CASCADE;
2813
2814
2815--
2816-- Name: fk_favorites__user; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2817--
2818
2819ALTER TABLE ONLY favorites
2820 ADD CONSTRAINT fk_favorites__user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
2821
2822
2823--
2824-- Name: fk_note_versions__note; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2825--
2826
2827ALTER TABLE ONLY note_versions
2828 ADD CONSTRAINT fk_note_versions__note FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;
2829
2830
2831--
2832-- Name: fk_note_versions__post; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2833--
2834
2835ALTER TABLE ONLY note_versions
2836 ADD CONSTRAINT fk_note_versions__post FOREIGN KEY (post_id) REFERENCES posts(id) ON DELETE CASCADE;
2837
2838
2839--
2840-- Name: fk_note_versions__user; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2841--
2842
2843ALTER TABLE ONLY note_versions
2844 ADD CONSTRAINT fk_note_versions__user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;
2845
2846
2847--
2848-- Name: fk_notes__post; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2849--
2850
2851ALTER TABLE ONLY notes
2852 ADD CONSTRAINT fk_notes__post FOREIGN KEY (post_id) REFERENCES posts(id) ON DELETE CASCADE;
2853
2854
2855--
2856-- Name: fk_notes__user; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2857--
2858
2859ALTER TABLE ONLY notes
2860 ADD CONSTRAINT fk_notes__user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;
2861
2862
2863--
2864-- Name: fk_post_tag_histories__post; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2865--
2866
2867ALTER TABLE ONLY post_tag_histories
2868 ADD CONSTRAINT fk_post_tag_histories__post FOREIGN KEY (post_id) REFERENCES posts(id) ON DELETE CASCADE;
2869
2870
2871--
2872-- Name: fk_posts__user; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2873--
2874
2875ALTER TABLE ONLY posts
2876 ADD CONSTRAINT fk_posts__user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;
2877
2878
2879--
2880-- Name: fk_posts_tags__post; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2881--
2882
2883ALTER TABLE ONLY posts_tags
2884 ADD CONSTRAINT fk_posts_tags__post FOREIGN KEY (post_id) REFERENCES posts(id) ON DELETE CASCADE;
2885
2886
2887--
2888-- Name: fk_posts_tags__tag; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2889--
2890
2891ALTER TABLE ONLY posts_tags
2892 ADD CONSTRAINT fk_posts_tags__tag FOREIGN KEY (tag_id) REFERENCES tags(id) ON DELETE CASCADE;
2893
2894
2895--
2896-- Name: fk_tag_aliases__alias; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2897--
2898
2899ALTER TABLE ONLY tag_aliases
2900 ADD CONSTRAINT fk_tag_aliases__alias FOREIGN KEY (alias_id) REFERENCES tags(id) ON DELETE CASCADE;
2901
2902
2903--
2904-- Name: fk_tag_implications__child; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2905--
2906
2907ALTER TABLE ONLY tag_implications
2908 ADD CONSTRAINT fk_tag_implications__child FOREIGN KEY (predicate_id) REFERENCES tags(id) ON DELETE CASCADE;
2909
2910
2911--
2912-- Name: fk_tag_implications__parent; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2913--
2914
2915ALTER TABLE ONLY tag_implications
2916 ADD CONSTRAINT fk_tag_implications__parent FOREIGN KEY (consequent_id) REFERENCES tags(id) ON DELETE CASCADE;
2917
2918
2919--
2920-- Name: fk_wiki_page_versions__user; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2921--
2922
2923ALTER TABLE ONLY wiki_page_versions
2924 ADD CONSTRAINT fk_wiki_page_versions__user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;
2925
2926
2927--
2928-- Name: fk_wiki_page_versions__wiki_page; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2929--
2930
2931ALTER TABLE ONLY wiki_page_versions
2932 ADD CONSTRAINT fk_wiki_page_versions__wiki_page FOREIGN KEY (wiki_page_id) REFERENCES wiki_pages(id) ON DELETE CASCADE;
2933
2934
2935--
2936-- Name: fk_wiki_pages__user; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2937--
2938
2939ALTER TABLE ONLY wiki_pages
2940 ADD CONSTRAINT fk_wiki_pages__user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;
2941
2942
2943--
2944-- Name: flagged_post_details_post_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2945--
2946
2947ALTER TABLE ONLY flagged_post_details
2948 ADD CONSTRAINT flagged_post_details_post_id_fkey FOREIGN KEY (post_id) REFERENCES posts(id) ON DELETE CASCADE;
2949
2950
2951--
2952-- Name: flagged_post_details_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2953--
2954
2955ALTER TABLE ONLY flagged_post_details
2956 ADD CONSTRAINT flagged_post_details_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
2957
2958
2959--
2960-- Name: forum_posts_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2961--
2962
2963ALTER TABLE ONLY forum_posts
2964 ADD CONSTRAINT forum_posts_creator_id_fkey FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE SET NULL;
2965
2966
2967--
2968-- Name: forum_posts_last_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2969--
2970
2971ALTER TABLE ONLY forum_posts
2972 ADD CONSTRAINT forum_posts_last_updated_by_fkey FOREIGN KEY (last_updated_by) REFERENCES users(id) ON DELETE SET NULL;
2973
2974
2975--
2976-- Name: forum_posts_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2977--
2978
2979ALTER TABLE ONLY forum_posts
2980 ADD CONSTRAINT forum_posts_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES forum_posts(id) ON DELETE CASCADE;
2981
2982
2983--
2984-- Name: mod_queue_posts_post_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2985--
2986
2987ALTER TABLE ONLY mod_queue_posts
2988 ADD CONSTRAINT mod_queue_posts_post_id_fkey FOREIGN KEY (post_id) REFERENCES posts(id) ON DELETE CASCADE;
2989
2990
2991--
2992-- Name: mod_queue_posts_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
2993--
2994
2995ALTER TABLE ONLY mod_queue_posts
2996 ADD CONSTRAINT mod_queue_posts_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
2997
2998
2999--
3000-- Name: pool_updates_pool_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
3001--
3002
3003ALTER TABLE ONLY pool_updates
3004 ADD CONSTRAINT pool_updates_pool_id_fkey FOREIGN KEY (pool_id) REFERENCES pools(id) ON DELETE CASCADE;
3005
3006
3007--
3008-- Name: pools_posts_next_post_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
3009--
3010
3011ALTER TABLE ONLY pools_posts
3012 ADD CONSTRAINT pools_posts_next_post_id_fkey FOREIGN KEY (next_post_id) REFERENCES posts(id) ON DELETE SET NULL;
3013
3014
3015--
3016-- Name: pools_posts_pool_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
3017--
3018
3019ALTER TABLE ONLY pools_posts
3020 ADD CONSTRAINT pools_posts_pool_id_fkey FOREIGN KEY (pool_id) REFERENCES pools(id) ON DELETE CASCADE;
3021
3022
3023--
3024-- Name: pools_posts_post_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
3025--
3026
3027ALTER TABLE ONLY pools_posts
3028 ADD CONSTRAINT pools_posts_post_id_fkey FOREIGN KEY (post_id) REFERENCES posts(id) ON DELETE CASCADE;
3029
3030
3031--
3032-- Name: pools_posts_prev_post_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
3033--
3034
3035ALTER TABLE ONLY pools_posts
3036 ADD CONSTRAINT pools_posts_prev_post_id_fkey FOREIGN KEY (prev_post_id) REFERENCES posts(id) ON DELETE SET NULL;
3037
3038
3039--
3040-- Name: pools_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
3041--
3042
3043ALTER TABLE ONLY pools
3044 ADD CONSTRAINT pools_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
3045
3046
3047--
3048-- Name: post_tag_histories_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
3049--
3050
3051ALTER TABLE ONLY post_tag_histories
3052 ADD CONSTRAINT post_tag_histories_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;
3053
3054
3055--
3056-- Name: post_votes_post_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
3057--
3058
3059ALTER TABLE ONLY post_votes
3060 ADD CONSTRAINT post_votes_post_id_fkey FOREIGN KEY (post_id) REFERENCES posts(id) ON DELETE CASCADE;
3061
3062
3063--
3064-- Name: post_votes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
3065--
3066
3067ALTER TABLE ONLY post_votes
3068 ADD CONSTRAINT post_votes_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
3069
3070
3071--
3072-- Name: posts_approver_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
3073--
3074
3075ALTER TABLE ONLY posts
3076 ADD CONSTRAINT posts_approver_id_fkey FOREIGN KEY (approver_id) REFERENCES users(id) ON DELETE SET NULL;
3077
3078
3079--
3080-- Name: posts_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
3081--
3082
3083ALTER TABLE ONLY posts
3084 ADD CONSTRAINT posts_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES posts(id) ON DELETE SET NULL;
3085
3086
3087--
3088-- Name: tag_aliases_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
3089--
3090
3091ALTER TABLE ONLY tag_aliases
3092 ADD CONSTRAINT tag_aliases_creator_id_fkey FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE CASCADE;
3093
3094
3095--
3096-- Name: tag_implications_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
3097--
3098
3099ALTER TABLE ONLY tag_implications
3100 ADD CONSTRAINT tag_implications_creator_id_fkey FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE CASCADE;
3101
3102
3103--
3104-- Name: tag_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
3105--
3106
3107ALTER TABLE ONLY tag_subscriptions
3108 ADD CONSTRAINT tag_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
3109
3110
3111--
3112-- Name: test_janitors_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
3113--
3114
3115ALTER TABLE ONLY test_janitors
3116 ADD CONSTRAINT test_janitors_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
3117
3118
3119--
3120-- Name: user_blacklisted_tags_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
3121--
3122
3123ALTER TABLE ONLY user_blacklisted_tags
3124 ADD CONSTRAINT user_blacklisted_tags_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
3125
3126
3127--
3128-- Name: user_records_reported_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
3129--
3130
3131ALTER TABLE ONLY user_records
3132 ADD CONSTRAINT user_records_reported_by_fkey FOREIGN KEY (reported_by) REFERENCES users(id) ON DELETE CASCADE;
3133
3134
3135--
3136-- Name: user_records_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: jeremy
3137--
3138
3139ALTER TABLE ONLY user_records
3140 ADD CONSTRAINT user_records_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
3141
3142
3143--
3144-- Name: public; Type: ACL; Schema: -; Owner: postgres
3145--
3146
3147REVOKE ALL ON SCHEMA public FROM PUBLIC;
3148REVOKE ALL ON SCHEMA public FROM postgres;
3149GRANT ALL ON SCHEMA public TO postgres;
3150GRANT ALL ON SCHEMA public TO PUBLIC;
3151
3152
3153--
3154-- PostgreSQL database dump complete
3155--
3156
Back to Top