]> git.openstreetmap.org Git - rails.git/blob - db/structure.sql
Merge remote-tracking branch 'upstream/pull/2207'
[rails.git] / db / structure.sql
1 SET statement_timeout = 0;
2 SET lock_timeout = 0;
3 SET idle_in_transaction_session_timeout = 0;
4 SET client_encoding = 'UTF8';
5 SET standard_conforming_strings = on;
6 SELECT pg_catalog.set_config('search_path', '', false);
7 SET check_function_bodies = false;
8 SET client_min_messages = warning;
9 SET row_security = off;
10
11 --
12 -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
13 --
14
15 CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
16
17
18 --
19 -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
20 --
21
22 COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
23
24
25 --
26 -- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: -
27 --
28
29 CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public;
30
31
32 --
33 -- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: -
34 --
35
36 COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST';
37
38
39 --
40 -- Name: format_enum; Type: TYPE; Schema: public; Owner: -
41 --
42
43 CREATE TYPE public.format_enum AS ENUM (
44     'html',
45     'markdown',
46     'text'
47 );
48
49
50 --
51 -- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: -
52 --
53
54 CREATE TYPE public.gpx_visibility_enum AS ENUM (
55     'private',
56     'public',
57     'trackable',
58     'identifiable'
59 );
60
61
62 --
63 -- Name: issue_status_enum; Type: TYPE; Schema: public; Owner: -
64 --
65
66 CREATE TYPE public.issue_status_enum AS ENUM (
67     'open',
68     'ignored',
69     'resolved'
70 );
71
72
73 --
74 -- Name: note_event_enum; Type: TYPE; Schema: public; Owner: -
75 --
76
77 CREATE TYPE public.note_event_enum AS ENUM (
78     'opened',
79     'closed',
80     'reopened',
81     'commented',
82     'hidden'
83 );
84
85
86 --
87 -- Name: note_status_enum; Type: TYPE; Schema: public; Owner: -
88 --
89
90 CREATE TYPE public.note_status_enum AS ENUM (
91     'open',
92     'closed',
93     'hidden'
94 );
95
96
97 --
98 -- Name: nwr_enum; Type: TYPE; Schema: public; Owner: -
99 --
100
101 CREATE TYPE public.nwr_enum AS ENUM (
102     'Node',
103     'Way',
104     'Relation'
105 );
106
107
108 --
109 -- Name: user_role_enum; Type: TYPE; Schema: public; Owner: -
110 --
111
112 CREATE TYPE public.user_role_enum AS ENUM (
113     'administrator',
114     'moderator'
115 );
116
117
118 --
119 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
120 --
121
122 CREATE TYPE public.user_status_enum AS ENUM (
123     'pending',
124     'active',
125     'confirmed',
126     'suspended',
127     'deleted'
128 );
129
130
131 --
132 -- Name: maptile_for_point(bigint, bigint, integer); Type: FUNCTION; Schema: public; Owner: -
133 --
134
135 CREATE FUNCTION public.maptile_for_point(bigint, bigint, integer) RETURNS integer
136     LANGUAGE c STRICT
137     AS '$libdir/libpgosm.so', 'maptile_for_point';
138
139
140 --
141 -- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
142 --
143
144 CREATE FUNCTION public.tile_for_point(integer, integer) RETURNS bigint
145     LANGUAGE c STRICT
146     AS '$libdir/libpgosm.so', 'tile_for_point';
147
148
149 --
150 -- Name: xid_to_int4(xid); Type: FUNCTION; Schema: public; Owner: -
151 --
152
153 CREATE FUNCTION public.xid_to_int4(xid) RETURNS integer
154     LANGUAGE c IMMUTABLE STRICT
155     AS '$libdir/libpgosm.so', 'xid_to_int4';
156
157
158 SET default_tablespace = '';
159
160 SET default_with_oids = false;
161
162 --
163 -- Name: acls; Type: TABLE; Schema: public; Owner: -
164 --
165
166 CREATE TABLE public.acls (
167     id bigint NOT NULL,
168     address inet,
169     k character varying NOT NULL,
170     v character varying,
171     domain character varying,
172     mx character varying
173 );
174
175
176 --
177 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
178 --
179
180 CREATE SEQUENCE public.acls_id_seq
181     START WITH 1
182     INCREMENT BY 1
183     NO MINVALUE
184     NO MAXVALUE
185     CACHE 1;
186
187
188 --
189 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
190 --
191
192 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
193
194
195 --
196 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
197 --
198
199 CREATE TABLE public.ar_internal_metadata (
200     key character varying NOT NULL,
201     value character varying,
202     created_at timestamp without time zone NOT NULL,
203     updated_at timestamp without time zone NOT NULL
204 );
205
206
207 --
208 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
209 --
210
211 CREATE TABLE public.changeset_comments (
212     id integer NOT NULL,
213     changeset_id bigint NOT NULL,
214     author_id bigint NOT NULL,
215     body text NOT NULL,
216     created_at timestamp without time zone NOT NULL,
217     visible boolean NOT NULL
218 );
219
220
221 --
222 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
223 --
224
225 CREATE SEQUENCE public.changeset_comments_id_seq
226     START WITH 1
227     INCREMENT BY 1
228     NO MINVALUE
229     NO MAXVALUE
230     CACHE 1;
231
232
233 --
234 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
235 --
236
237 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
238
239
240 --
241 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
242 --
243
244 CREATE TABLE public.changeset_tags (
245     changeset_id bigint NOT NULL,
246     k character varying DEFAULT ''::character varying NOT NULL,
247     v character varying DEFAULT ''::character varying NOT NULL
248 );
249
250
251 --
252 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
253 --
254
255 CREATE TABLE public.changesets (
256     id bigint NOT NULL,
257     user_id bigint NOT NULL,
258     created_at timestamp without time zone NOT NULL,
259     min_lat integer,
260     max_lat integer,
261     min_lon integer,
262     max_lon integer,
263     closed_at timestamp without time zone NOT NULL,
264     num_changes integer DEFAULT 0 NOT NULL
265 );
266
267
268 --
269 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
270 --
271
272 CREATE SEQUENCE public.changesets_id_seq
273     START WITH 1
274     INCREMENT BY 1
275     NO MINVALUE
276     NO MAXVALUE
277     CACHE 1;
278
279
280 --
281 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
282 --
283
284 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
285
286
287 --
288 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
289 --
290
291 CREATE TABLE public.changesets_subscribers (
292     subscriber_id bigint NOT NULL,
293     changeset_id bigint NOT NULL
294 );
295
296
297 --
298 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
299 --
300
301 CREATE TABLE public.client_applications (
302     id integer NOT NULL,
303     name character varying,
304     url character varying,
305     support_url character varying,
306     callback_url character varying,
307     key character varying(50),
308     secret character varying(50),
309     user_id integer,
310     created_at timestamp without time zone,
311     updated_at timestamp without time zone,
312     allow_read_prefs boolean DEFAULT false NOT NULL,
313     allow_write_prefs boolean DEFAULT false NOT NULL,
314     allow_write_diary boolean DEFAULT false NOT NULL,
315     allow_write_api boolean DEFAULT false NOT NULL,
316     allow_read_gpx boolean DEFAULT false NOT NULL,
317     allow_write_gpx boolean DEFAULT false NOT NULL,
318     allow_write_notes boolean DEFAULT false NOT NULL
319 );
320
321
322 --
323 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
324 --
325
326 CREATE SEQUENCE public.client_applications_id_seq
327     START WITH 1
328     INCREMENT BY 1
329     NO MINVALUE
330     NO MAXVALUE
331     CACHE 1;
332
333
334 --
335 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
336 --
337
338 ALTER SEQUENCE public.client_applications_id_seq OWNED BY public.client_applications.id;
339
340
341 --
342 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
343 --
344
345 CREATE TABLE public.current_node_tags (
346     node_id bigint NOT NULL,
347     k character varying DEFAULT ''::character varying NOT NULL,
348     v character varying DEFAULT ''::character varying NOT NULL
349 );
350
351
352 --
353 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
354 --
355
356 CREATE TABLE public.current_nodes (
357     id bigint NOT NULL,
358     latitude integer NOT NULL,
359     longitude integer NOT NULL,
360     changeset_id bigint NOT NULL,
361     visible boolean NOT NULL,
362     "timestamp" timestamp without time zone NOT NULL,
363     tile bigint NOT NULL,
364     version bigint NOT NULL
365 );
366
367
368 --
369 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
370 --
371
372 CREATE SEQUENCE public.current_nodes_id_seq
373     START WITH 1
374     INCREMENT BY 1
375     NO MINVALUE
376     NO MAXVALUE
377     CACHE 1;
378
379
380 --
381 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
382 --
383
384 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
385
386
387 --
388 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
389 --
390
391 CREATE TABLE public.current_relation_members (
392     relation_id bigint NOT NULL,
393     member_type public.nwr_enum NOT NULL,
394     member_id bigint NOT NULL,
395     member_role character varying NOT NULL,
396     sequence_id integer DEFAULT 0 NOT NULL
397 );
398
399
400 --
401 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
402 --
403
404 CREATE TABLE public.current_relation_tags (
405     relation_id bigint NOT NULL,
406     k character varying DEFAULT ''::character varying NOT NULL,
407     v character varying DEFAULT ''::character varying NOT NULL
408 );
409
410
411 --
412 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
413 --
414
415 CREATE TABLE public.current_relations (
416     id bigint NOT NULL,
417     changeset_id bigint NOT NULL,
418     "timestamp" timestamp without time zone NOT NULL,
419     visible boolean NOT NULL,
420     version bigint NOT NULL
421 );
422
423
424 --
425 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
426 --
427
428 CREATE SEQUENCE public.current_relations_id_seq
429     START WITH 1
430     INCREMENT BY 1
431     NO MINVALUE
432     NO MAXVALUE
433     CACHE 1;
434
435
436 --
437 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
438 --
439
440 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
441
442
443 --
444 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
445 --
446
447 CREATE TABLE public.current_way_nodes (
448     way_id bigint NOT NULL,
449     node_id bigint NOT NULL,
450     sequence_id bigint NOT NULL
451 );
452
453
454 --
455 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
456 --
457
458 CREATE TABLE public.current_way_tags (
459     way_id bigint NOT NULL,
460     k character varying DEFAULT ''::character varying NOT NULL,
461     v character varying DEFAULT ''::character varying NOT NULL
462 );
463
464
465 --
466 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
467 --
468
469 CREATE TABLE public.current_ways (
470     id bigint NOT NULL,
471     changeset_id bigint NOT NULL,
472     "timestamp" timestamp without time zone NOT NULL,
473     visible boolean NOT NULL,
474     version bigint NOT NULL
475 );
476
477
478 --
479 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
480 --
481
482 CREATE SEQUENCE public.current_ways_id_seq
483     START WITH 1
484     INCREMENT BY 1
485     NO MINVALUE
486     NO MAXVALUE
487     CACHE 1;
488
489
490 --
491 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
492 --
493
494 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
495
496
497 --
498 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
499 --
500
501 CREATE TABLE public.delayed_jobs (
502     id bigint NOT NULL,
503     priority integer DEFAULT 0 NOT NULL,
504     attempts integer DEFAULT 0 NOT NULL,
505     handler text NOT NULL,
506     last_error text,
507     run_at timestamp without time zone,
508     locked_at timestamp without time zone,
509     failed_at timestamp without time zone,
510     locked_by character varying,
511     queue character varying,
512     created_at timestamp without time zone,
513     updated_at timestamp without time zone
514 );
515
516
517 --
518 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
519 --
520
521 CREATE SEQUENCE public.delayed_jobs_id_seq
522     START WITH 1
523     INCREMENT BY 1
524     NO MINVALUE
525     NO MAXVALUE
526     CACHE 1;
527
528
529 --
530 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
531 --
532
533 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
534
535
536 --
537 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
538 --
539
540 CREATE TABLE public.diary_comments (
541     id bigint NOT NULL,
542     diary_entry_id bigint NOT NULL,
543     user_id bigint NOT NULL,
544     body text NOT NULL,
545     created_at timestamp without time zone NOT NULL,
546     updated_at timestamp without time zone NOT NULL,
547     visible boolean DEFAULT true NOT NULL,
548     body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
549 );
550
551
552 --
553 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
554 --
555
556 CREATE SEQUENCE public.diary_comments_id_seq
557     START WITH 1
558     INCREMENT BY 1
559     NO MINVALUE
560     NO MAXVALUE
561     CACHE 1;
562
563
564 --
565 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
566 --
567
568 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
569
570
571 --
572 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
573 --
574
575 CREATE TABLE public.diary_entries (
576     id bigint NOT NULL,
577     user_id bigint NOT NULL,
578     title character varying NOT NULL,
579     body text NOT NULL,
580     created_at timestamp without time zone NOT NULL,
581     updated_at timestamp without time zone NOT NULL,
582     latitude double precision,
583     longitude double precision,
584     language_code character varying DEFAULT 'en'::character varying NOT NULL,
585     visible boolean DEFAULT true NOT NULL,
586     body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
587 );
588
589
590 --
591 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
592 --
593
594 CREATE SEQUENCE public.diary_entries_id_seq
595     START WITH 1
596     INCREMENT BY 1
597     NO MINVALUE
598     NO MAXVALUE
599     CACHE 1;
600
601
602 --
603 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
604 --
605
606 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
607
608
609 --
610 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
611 --
612
613 CREATE TABLE public.diary_entry_subscriptions (
614     user_id bigint NOT NULL,
615     diary_entry_id bigint NOT NULL
616 );
617
618
619 --
620 -- Name: friends; Type: TABLE; Schema: public; Owner: -
621 --
622
623 CREATE TABLE public.friends (
624     id bigint NOT NULL,
625     user_id bigint NOT NULL,
626     friend_user_id bigint NOT NULL
627 );
628
629
630 --
631 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
632 --
633
634 CREATE SEQUENCE public.friends_id_seq
635     START WITH 1
636     INCREMENT BY 1
637     NO MINVALUE
638     NO MAXVALUE
639     CACHE 1;
640
641
642 --
643 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
644 --
645
646 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
647
648
649 --
650 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
651 --
652
653 CREATE TABLE public.gps_points (
654     altitude double precision,
655     trackid integer NOT NULL,
656     latitude integer NOT NULL,
657     longitude integer NOT NULL,
658     gpx_id bigint NOT NULL,
659     "timestamp" timestamp without time zone,
660     tile bigint
661 );
662
663
664 --
665 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
666 --
667
668 CREATE TABLE public.gpx_file_tags (
669     gpx_id bigint DEFAULT 0 NOT NULL,
670     tag character varying NOT NULL,
671     id bigint NOT NULL
672 );
673
674
675 --
676 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
677 --
678
679 CREATE SEQUENCE public.gpx_file_tags_id_seq
680     START WITH 1
681     INCREMENT BY 1
682     NO MINVALUE
683     NO MAXVALUE
684     CACHE 1;
685
686
687 --
688 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
689 --
690
691 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
692
693
694 --
695 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
696 --
697
698 CREATE TABLE public.gpx_files (
699     id bigint NOT NULL,
700     user_id bigint NOT NULL,
701     visible boolean DEFAULT true NOT NULL,
702     name character varying DEFAULT ''::character varying NOT NULL,
703     size bigint,
704     latitude double precision,
705     longitude double precision,
706     "timestamp" timestamp without time zone NOT NULL,
707     description character varying DEFAULT ''::character varying NOT NULL,
708     inserted boolean NOT NULL,
709     visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
710 );
711
712
713 --
714 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
715 --
716
717 CREATE SEQUENCE public.gpx_files_id_seq
718     START WITH 1
719     INCREMENT BY 1
720     NO MINVALUE
721     NO MAXVALUE
722     CACHE 1;
723
724
725 --
726 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
727 --
728
729 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
730
731
732 --
733 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
734 --
735
736 CREATE TABLE public.issue_comments (
737     id integer NOT NULL,
738     issue_id integer NOT NULL,
739     user_id integer NOT NULL,
740     body text NOT NULL,
741     created_at timestamp without time zone NOT NULL,
742     updated_at timestamp without time zone NOT NULL
743 );
744
745
746 --
747 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
748 --
749
750 CREATE SEQUENCE public.issue_comments_id_seq
751     START WITH 1
752     INCREMENT BY 1
753     NO MINVALUE
754     NO MAXVALUE
755     CACHE 1;
756
757
758 --
759 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
760 --
761
762 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
763
764
765 --
766 -- Name: issues; Type: TABLE; Schema: public; Owner: -
767 --
768
769 CREATE TABLE public.issues (
770     id integer NOT NULL,
771     reportable_type character varying NOT NULL,
772     reportable_id integer NOT NULL,
773     reported_user_id integer,
774     status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
775     assigned_role public.user_role_enum NOT NULL,
776     resolved_at timestamp without time zone,
777     resolved_by integer,
778     updated_by integer,
779     reports_count integer DEFAULT 0,
780     created_at timestamp without time zone NOT NULL,
781     updated_at timestamp without time zone NOT NULL
782 );
783
784
785 --
786 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
787 --
788
789 CREATE SEQUENCE public.issues_id_seq
790     START WITH 1
791     INCREMENT BY 1
792     NO MINVALUE
793     NO MAXVALUE
794     CACHE 1;
795
796
797 --
798 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
799 --
800
801 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
802
803
804 --
805 -- Name: languages; Type: TABLE; Schema: public; Owner: -
806 --
807
808 CREATE TABLE public.languages (
809     code character varying NOT NULL,
810     english_name character varying NOT NULL,
811     native_name character varying
812 );
813
814
815 --
816 -- Name: messages; Type: TABLE; Schema: public; Owner: -
817 --
818
819 CREATE TABLE public.messages (
820     id bigint NOT NULL,
821     from_user_id bigint NOT NULL,
822     title character varying NOT NULL,
823     body text NOT NULL,
824     sent_on timestamp without time zone NOT NULL,
825     message_read boolean DEFAULT false NOT NULL,
826     to_user_id bigint NOT NULL,
827     to_user_visible boolean DEFAULT true NOT NULL,
828     from_user_visible boolean DEFAULT true NOT NULL,
829     body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
830 );
831
832
833 --
834 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
835 --
836
837 CREATE SEQUENCE public.messages_id_seq
838     START WITH 1
839     INCREMENT BY 1
840     NO MINVALUE
841     NO MAXVALUE
842     CACHE 1;
843
844
845 --
846 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
847 --
848
849 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
850
851
852 --
853 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
854 --
855
856 CREATE TABLE public.node_tags (
857     node_id bigint NOT NULL,
858     version bigint NOT NULL,
859     k character varying DEFAULT ''::character varying NOT NULL,
860     v character varying DEFAULT ''::character varying NOT NULL
861 );
862
863
864 --
865 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
866 --
867
868 CREATE TABLE public.nodes (
869     node_id bigint NOT NULL,
870     latitude integer NOT NULL,
871     longitude integer NOT NULL,
872     changeset_id bigint NOT NULL,
873     visible boolean NOT NULL,
874     "timestamp" timestamp without time zone NOT NULL,
875     tile bigint NOT NULL,
876     version bigint NOT NULL,
877     redaction_id integer
878 );
879
880
881 --
882 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
883 --
884
885 CREATE TABLE public.note_comments (
886     id bigint NOT NULL,
887     note_id bigint NOT NULL,
888     visible boolean NOT NULL,
889     created_at timestamp without time zone NOT NULL,
890     author_ip inet,
891     author_id bigint,
892     body text,
893     event public.note_event_enum
894 );
895
896
897 --
898 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
899 --
900
901 CREATE SEQUENCE public.note_comments_id_seq
902     START WITH 1
903     INCREMENT BY 1
904     NO MINVALUE
905     NO MAXVALUE
906     CACHE 1;
907
908
909 --
910 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
911 --
912
913 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
914
915
916 --
917 -- Name: notes; Type: TABLE; Schema: public; Owner: -
918 --
919
920 CREATE TABLE public.notes (
921     id bigint NOT NULL,
922     latitude integer NOT NULL,
923     longitude integer NOT NULL,
924     tile bigint NOT NULL,
925     updated_at timestamp without time zone NOT NULL,
926     created_at timestamp without time zone NOT NULL,
927     status public.note_status_enum NOT NULL,
928     closed_at timestamp without time zone
929 );
930
931
932 --
933 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
934 --
935
936 CREATE SEQUENCE public.notes_id_seq
937     START WITH 1
938     INCREMENT BY 1
939     NO MINVALUE
940     NO MAXVALUE
941     CACHE 1;
942
943
944 --
945 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
946 --
947
948 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
949
950
951 --
952 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
953 --
954
955 CREATE TABLE public.oauth_nonces (
956     id integer NOT NULL,
957     nonce character varying,
958     "timestamp" integer,
959     created_at timestamp without time zone,
960     updated_at timestamp without time zone
961 );
962
963
964 --
965 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
966 --
967
968 CREATE SEQUENCE public.oauth_nonces_id_seq
969     START WITH 1
970     INCREMENT BY 1
971     NO MINVALUE
972     NO MAXVALUE
973     CACHE 1;
974
975
976 --
977 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
978 --
979
980 ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id;
981
982
983 --
984 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
985 --
986
987 CREATE TABLE public.oauth_tokens (
988     id integer NOT NULL,
989     user_id integer,
990     type character varying(20),
991     client_application_id integer,
992     token character varying(50),
993     secret character varying(50),
994     authorized_at timestamp without time zone,
995     invalidated_at timestamp without time zone,
996     created_at timestamp without time zone,
997     updated_at timestamp without time zone,
998     allow_read_prefs boolean DEFAULT false NOT NULL,
999     allow_write_prefs boolean DEFAULT false NOT NULL,
1000     allow_write_diary boolean DEFAULT false NOT NULL,
1001     allow_write_api boolean DEFAULT false NOT NULL,
1002     allow_read_gpx boolean DEFAULT false NOT NULL,
1003     allow_write_gpx boolean DEFAULT false NOT NULL,
1004     callback_url character varying,
1005     verifier character varying(20),
1006     scope character varying,
1007     valid_to timestamp without time zone,
1008     allow_write_notes boolean DEFAULT false NOT NULL
1009 );
1010
1011
1012 --
1013 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1014 --
1015
1016 CREATE SEQUENCE public.oauth_tokens_id_seq
1017     START WITH 1
1018     INCREMENT BY 1
1019     NO MINVALUE
1020     NO MAXVALUE
1021     CACHE 1;
1022
1023
1024 --
1025 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1026 --
1027
1028 ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
1029
1030
1031 --
1032 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1033 --
1034
1035 CREATE TABLE public.redactions (
1036     id integer NOT NULL,
1037     title character varying,
1038     description text,
1039     created_at timestamp without time zone,
1040     updated_at timestamp without time zone,
1041     user_id bigint NOT NULL,
1042     description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1043 );
1044
1045
1046 --
1047 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1048 --
1049
1050 CREATE SEQUENCE public.redactions_id_seq
1051     START WITH 1
1052     INCREMENT BY 1
1053     NO MINVALUE
1054     NO MAXVALUE
1055     CACHE 1;
1056
1057
1058 --
1059 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1060 --
1061
1062 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1063
1064
1065 --
1066 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1067 --
1068
1069 CREATE TABLE public.relation_members (
1070     relation_id bigint DEFAULT 0 NOT NULL,
1071     member_type public.nwr_enum NOT NULL,
1072     member_id bigint NOT NULL,
1073     member_role character varying NOT NULL,
1074     version bigint DEFAULT 0 NOT NULL,
1075     sequence_id integer DEFAULT 0 NOT NULL
1076 );
1077
1078
1079 --
1080 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1081 --
1082
1083 CREATE TABLE public.relation_tags (
1084     relation_id bigint DEFAULT 0 NOT NULL,
1085     k character varying DEFAULT ''::character varying NOT NULL,
1086     v character varying DEFAULT ''::character varying NOT NULL,
1087     version bigint NOT NULL
1088 );
1089
1090
1091 --
1092 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1093 --
1094
1095 CREATE TABLE public.relations (
1096     relation_id bigint DEFAULT 0 NOT NULL,
1097     changeset_id bigint NOT NULL,
1098     "timestamp" timestamp without time zone NOT NULL,
1099     version bigint NOT NULL,
1100     visible boolean DEFAULT true NOT NULL,
1101     redaction_id integer
1102 );
1103
1104
1105 --
1106 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1107 --
1108
1109 CREATE TABLE public.reports (
1110     id integer NOT NULL,
1111     issue_id integer NOT NULL,
1112     user_id integer NOT NULL,
1113     details text NOT NULL,
1114     category character varying NOT NULL,
1115     created_at timestamp without time zone NOT NULL,
1116     updated_at timestamp without time zone NOT NULL
1117 );
1118
1119
1120 --
1121 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1122 --
1123
1124 CREATE SEQUENCE public.reports_id_seq
1125     START WITH 1
1126     INCREMENT BY 1
1127     NO MINVALUE
1128     NO MAXVALUE
1129     CACHE 1;
1130
1131
1132 --
1133 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1134 --
1135
1136 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1137
1138
1139 --
1140 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1141 --
1142
1143 CREATE TABLE public.schema_migrations (
1144     version character varying NOT NULL
1145 );
1146
1147
1148 --
1149 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1150 --
1151
1152 CREATE TABLE public.user_blocks (
1153     id integer NOT NULL,
1154     user_id bigint NOT NULL,
1155     creator_id bigint NOT NULL,
1156     reason text NOT NULL,
1157     ends_at timestamp without time zone NOT NULL,
1158     needs_view boolean DEFAULT false NOT NULL,
1159     revoker_id bigint,
1160     created_at timestamp without time zone,
1161     updated_at timestamp without time zone,
1162     reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1163 );
1164
1165
1166 --
1167 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1168 --
1169
1170 CREATE SEQUENCE public.user_blocks_id_seq
1171     START WITH 1
1172     INCREMENT BY 1
1173     NO MINVALUE
1174     NO MAXVALUE
1175     CACHE 1;
1176
1177
1178 --
1179 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1180 --
1181
1182 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1183
1184
1185 --
1186 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1187 --
1188
1189 CREATE TABLE public.user_preferences (
1190     user_id bigint NOT NULL,
1191     k character varying NOT NULL,
1192     v character varying NOT NULL
1193 );
1194
1195
1196 --
1197 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1198 --
1199
1200 CREATE TABLE public.user_roles (
1201     id integer NOT NULL,
1202     user_id bigint NOT NULL,
1203     role public.user_role_enum NOT NULL,
1204     created_at timestamp without time zone,
1205     updated_at timestamp without time zone,
1206     granter_id bigint NOT NULL
1207 );
1208
1209
1210 --
1211 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1212 --
1213
1214 CREATE SEQUENCE public.user_roles_id_seq
1215     START WITH 1
1216     INCREMENT BY 1
1217     NO MINVALUE
1218     NO MAXVALUE
1219     CACHE 1;
1220
1221
1222 --
1223 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1224 --
1225
1226 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1227
1228
1229 --
1230 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1231 --
1232
1233 CREATE TABLE public.user_tokens (
1234     id bigint NOT NULL,
1235     user_id bigint NOT NULL,
1236     token character varying NOT NULL,
1237     expiry timestamp without time zone NOT NULL,
1238     referer text
1239 );
1240
1241
1242 --
1243 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1244 --
1245
1246 CREATE SEQUENCE public.user_tokens_id_seq
1247     START WITH 1
1248     INCREMENT BY 1
1249     NO MINVALUE
1250     NO MAXVALUE
1251     CACHE 1;
1252
1253
1254 --
1255 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1256 --
1257
1258 ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id;
1259
1260
1261 --
1262 -- Name: users; Type: TABLE; Schema: public; Owner: -
1263 --
1264
1265 CREATE TABLE public.users (
1266     email character varying NOT NULL,
1267     id bigint NOT NULL,
1268     pass_crypt character varying NOT NULL,
1269     creation_time timestamp without time zone NOT NULL,
1270     display_name character varying DEFAULT ''::character varying NOT NULL,
1271     data_public boolean DEFAULT false NOT NULL,
1272     description text DEFAULT ''::text NOT NULL,
1273     home_lat double precision,
1274     home_lon double precision,
1275     home_zoom smallint DEFAULT 3,
1276     nearby integer DEFAULT 50,
1277     pass_salt character varying,
1278     image_file_name text,
1279     email_valid boolean DEFAULT false NOT NULL,
1280     new_email character varying,
1281     creation_ip character varying,
1282     languages character varying,
1283     status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1284     terms_agreed timestamp without time zone,
1285     consider_pd boolean DEFAULT false NOT NULL,
1286     auth_uid character varying,
1287     preferred_editor character varying,
1288     terms_seen boolean DEFAULT false NOT NULL,
1289     description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1290     image_fingerprint character varying,
1291     changesets_count integer DEFAULT 0 NOT NULL,
1292     traces_count integer DEFAULT 0 NOT NULL,
1293     diary_entries_count integer DEFAULT 0 NOT NULL,
1294     image_use_gravatar boolean DEFAULT false NOT NULL,
1295     image_content_type character varying,
1296     auth_provider character varying,
1297     home_tile bigint,
1298     tou_agreed timestamp without time zone
1299 );
1300
1301
1302 --
1303 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1304 --
1305
1306 CREATE SEQUENCE public.users_id_seq
1307     START WITH 1
1308     INCREMENT BY 1
1309     NO MINVALUE
1310     NO MAXVALUE
1311     CACHE 1;
1312
1313
1314 --
1315 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1316 --
1317
1318 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1319
1320
1321 --
1322 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1323 --
1324
1325 CREATE TABLE public.way_nodes (
1326     way_id bigint NOT NULL,
1327     node_id bigint NOT NULL,
1328     version bigint NOT NULL,
1329     sequence_id bigint NOT NULL
1330 );
1331
1332
1333 --
1334 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1335 --
1336
1337 CREATE TABLE public.way_tags (
1338     way_id bigint DEFAULT 0 NOT NULL,
1339     k character varying NOT NULL,
1340     v character varying NOT NULL,
1341     version bigint NOT NULL
1342 );
1343
1344
1345 --
1346 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1347 --
1348
1349 CREATE TABLE public.ways (
1350     way_id bigint DEFAULT 0 NOT NULL,
1351     changeset_id bigint NOT NULL,
1352     "timestamp" timestamp without time zone NOT NULL,
1353     version bigint NOT NULL,
1354     visible boolean DEFAULT true NOT NULL,
1355     redaction_id integer
1356 );
1357
1358
1359 --
1360 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1361 --
1362
1363 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1364
1365
1366 --
1367 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1368 --
1369
1370 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1371
1372
1373 --
1374 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1375 --
1376
1377 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1378
1379
1380 --
1381 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1382 --
1383
1384 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1385
1386
1387 --
1388 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1389 --
1390
1391 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1392
1393
1394 --
1395 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1396 --
1397
1398 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1399
1400
1401 --
1402 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1403 --
1404
1405 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1406
1407
1408 --
1409 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1410 --
1411
1412 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1413
1414
1415 --
1416 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1417 --
1418
1419 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1420
1421
1422 --
1423 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1424 --
1425
1426 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1427
1428
1429 --
1430 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1431 --
1432
1433 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1434
1435
1436 --
1437 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1438 --
1439
1440 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1441
1442
1443 --
1444 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1445 --
1446
1447 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1448
1449
1450 --
1451 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1452 --
1453
1454 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1455
1456
1457 --
1458 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1459 --
1460
1461 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1462
1463
1464 --
1465 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1466 --
1467
1468 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1469
1470
1471 --
1472 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1473 --
1474
1475 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1476
1477
1478 --
1479 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1480 --
1481
1482 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1483
1484
1485 --
1486 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1487 --
1488
1489 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1490
1491
1492 --
1493 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1494 --
1495
1496 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1497
1498
1499 --
1500 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1501 --
1502
1503 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1504
1505
1506 --
1507 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1508 --
1509
1510 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1511
1512
1513 --
1514 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1515 --
1516
1517 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1518
1519
1520 --
1521 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1522 --
1523
1524 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1525
1526
1527 --
1528 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1529 --
1530
1531 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1532
1533
1534 --
1535 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1536 --
1537
1538 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1539
1540
1541 --
1542 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1543 --
1544
1545 ALTER TABLE ONLY public.acls
1546     ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1547
1548
1549 --
1550 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1551 --
1552
1553 ALTER TABLE ONLY public.ar_internal_metadata
1554     ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1555
1556
1557 --
1558 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1559 --
1560
1561 ALTER TABLE ONLY public.changeset_comments
1562     ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1563
1564
1565 --
1566 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1567 --
1568
1569 ALTER TABLE ONLY public.changesets
1570     ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1571
1572
1573 --
1574 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1575 --
1576
1577 ALTER TABLE ONLY public.client_applications
1578     ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1579
1580
1581 --
1582 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1583 --
1584
1585 ALTER TABLE ONLY public.current_node_tags
1586     ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1587
1588
1589 --
1590 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1591 --
1592
1593 ALTER TABLE ONLY public.current_nodes
1594     ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1595
1596
1597 --
1598 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1599 --
1600
1601 ALTER TABLE ONLY public.current_relation_members
1602     ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1603
1604
1605 --
1606 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1607 --
1608
1609 ALTER TABLE ONLY public.current_relation_tags
1610     ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1611
1612
1613 --
1614 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1615 --
1616
1617 ALTER TABLE ONLY public.current_relations
1618     ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1619
1620
1621 --
1622 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1623 --
1624
1625 ALTER TABLE ONLY public.current_way_nodes
1626     ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1627
1628
1629 --
1630 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1631 --
1632
1633 ALTER TABLE ONLY public.current_way_tags
1634     ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1635
1636
1637 --
1638 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1639 --
1640
1641 ALTER TABLE ONLY public.current_ways
1642     ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1643
1644
1645 --
1646 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1647 --
1648
1649 ALTER TABLE ONLY public.delayed_jobs
1650     ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1651
1652
1653 --
1654 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1655 --
1656
1657 ALTER TABLE ONLY public.diary_comments
1658     ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1659
1660
1661 --
1662 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1663 --
1664
1665 ALTER TABLE ONLY public.diary_entries
1666     ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1667
1668
1669 --
1670 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1671 --
1672
1673 ALTER TABLE ONLY public.diary_entry_subscriptions
1674     ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1675
1676
1677 --
1678 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1679 --
1680
1681 ALTER TABLE ONLY public.friends
1682     ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1683
1684
1685 --
1686 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1687 --
1688
1689 ALTER TABLE ONLY public.gpx_file_tags
1690     ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1691
1692
1693 --
1694 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1695 --
1696
1697 ALTER TABLE ONLY public.gpx_files
1698     ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1699
1700
1701 --
1702 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1703 --
1704
1705 ALTER TABLE ONLY public.issue_comments
1706     ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1707
1708
1709 --
1710 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1711 --
1712
1713 ALTER TABLE ONLY public.issues
1714     ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
1715
1716
1717 --
1718 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1719 --
1720
1721 ALTER TABLE ONLY public.languages
1722     ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1723
1724
1725 --
1726 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1727 --
1728
1729 ALTER TABLE ONLY public.messages
1730     ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1731
1732
1733 --
1734 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1735 --
1736
1737 ALTER TABLE ONLY public.node_tags
1738     ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1739
1740
1741 --
1742 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1743 --
1744
1745 ALTER TABLE ONLY public.nodes
1746     ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1747
1748
1749 --
1750 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1751 --
1752
1753 ALTER TABLE ONLY public.note_comments
1754     ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1755
1756
1757 --
1758 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1759 --
1760
1761 ALTER TABLE ONLY public.notes
1762     ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1763
1764
1765 --
1766 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1767 --
1768
1769 ALTER TABLE ONLY public.oauth_nonces
1770     ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1771
1772
1773 --
1774 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1775 --
1776
1777 ALTER TABLE ONLY public.oauth_tokens
1778     ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1779
1780
1781 --
1782 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1783 --
1784
1785 ALTER TABLE ONLY public.redactions
1786     ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1787
1788
1789 --
1790 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1791 --
1792
1793 ALTER TABLE ONLY public.relation_members
1794     ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1795
1796
1797 --
1798 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1799 --
1800
1801 ALTER TABLE ONLY public.relation_tags
1802     ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1803
1804
1805 --
1806 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1807 --
1808
1809 ALTER TABLE ONLY public.relations
1810     ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1811
1812
1813 --
1814 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1815 --
1816
1817 ALTER TABLE ONLY public.reports
1818     ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
1819
1820
1821 --
1822 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1823 --
1824
1825 ALTER TABLE ONLY public.schema_migrations
1826     ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
1827
1828
1829 --
1830 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1831 --
1832
1833 ALTER TABLE ONLY public.user_blocks
1834     ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1835
1836
1837 --
1838 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1839 --
1840
1841 ALTER TABLE ONLY public.user_preferences
1842     ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1843
1844
1845 --
1846 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1847 --
1848
1849 ALTER TABLE ONLY public.user_roles
1850     ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1851
1852
1853 --
1854 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1855 --
1856
1857 ALTER TABLE ONLY public.user_tokens
1858     ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
1859
1860
1861 --
1862 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1863 --
1864
1865 ALTER TABLE ONLY public.users
1866     ADD CONSTRAINT users_pkey PRIMARY KEY (id);
1867
1868
1869 --
1870 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1871 --
1872
1873 ALTER TABLE ONLY public.way_nodes
1874     ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
1875
1876
1877 --
1878 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1879 --
1880
1881 ALTER TABLE ONLY public.way_tags
1882     ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
1883
1884
1885 --
1886 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1887 --
1888
1889 ALTER TABLE ONLY public.ways
1890     ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
1891
1892
1893 --
1894 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
1895 --
1896
1897 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
1898
1899
1900 --
1901 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
1902 --
1903
1904 CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id);
1905
1906
1907 --
1908 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
1909 --
1910
1911 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
1912
1913
1914 --
1915 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
1916 --
1917
1918 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
1919
1920
1921 --
1922 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
1923 --
1924
1925 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
1926
1927
1928 --
1929 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
1930 --
1931
1932 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
1933
1934
1935 --
1936 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
1937 --
1938
1939 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
1940
1941
1942 --
1943 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
1944 --
1945
1946 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
1947
1948
1949 --
1950 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1951 --
1952
1953 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
1954
1955
1956 --
1957 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
1958 --
1959
1960 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
1961
1962
1963 --
1964 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1965 --
1966
1967 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
1968
1969
1970 --
1971 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
1972 --
1973
1974 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
1975
1976
1977 --
1978 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1979 --
1980
1981 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
1982
1983
1984 --
1985 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
1986 --
1987
1988 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
1989
1990
1991 --
1992 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
1993 --
1994
1995 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
1996
1997
1998 --
1999 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2000 --
2001
2002 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2003
2004
2005 --
2006 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2007 --
2008
2009 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2010
2011
2012 --
2013 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2014 --
2015
2016 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2017
2018
2019 --
2020 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2021 --
2022
2023 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2024
2025
2026 --
2027 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -
2028 --
2029
2030 CREATE INDEX friends_user_id_idx ON public.friends USING btree (user_id);
2031
2032
2033 --
2034 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2035 --
2036
2037 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2038
2039
2040 --
2041 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2042 --
2043
2044 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2045
2046
2047 --
2048 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2049 --
2050
2051 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2052
2053
2054 --
2055 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2056 --
2057
2058 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2059
2060
2061 --
2062 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2063 --
2064
2065 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2066
2067
2068 --
2069 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2070 --
2071
2072 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2073
2074
2075 --
2076 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2077 --
2078
2079 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2080
2081
2082 --
2083 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2084 --
2085
2086 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2087
2088
2089 --
2090 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2091 --
2092
2093 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2094
2095
2096 --
2097 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2098 --
2099
2100 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2101
2102
2103 --
2104 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2105 --
2106
2107 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2108
2109
2110 --
2111 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2112 --
2113
2114 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2115
2116
2117 --
2118 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2119 --
2120
2121 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2122
2123
2124 --
2125 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2126 --
2127
2128 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2129
2130
2131 --
2132 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2133 --
2134
2135 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2136
2137
2138 --
2139 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2140 --
2141
2142 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2143
2144
2145 --
2146 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2147 --
2148
2149 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2150
2151
2152 --
2153 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2154 --
2155
2156 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2157
2158
2159 --
2160 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2161 --
2162
2163 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2164
2165
2166 --
2167 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2168 --
2169
2170 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2171
2172
2173 --
2174 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2175 --
2176
2177 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2178
2179
2180 --
2181 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2182 --
2183
2184 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2185
2186
2187 --
2188 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2189 --
2190
2191 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2192
2193
2194 --
2195 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2196 --
2197
2198 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2199
2200
2201 --
2202 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2203 --
2204
2205 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2206
2207
2208 --
2209 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2210 --
2211
2212 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2213
2214
2215 --
2216 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2217 --
2218
2219 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2220
2221
2222 --
2223 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2224 --
2225
2226 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2227
2228
2229 --
2230 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2231 --
2232
2233 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2234
2235
2236 --
2237 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2238 --
2239
2240 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2241
2242
2243 --
2244 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2245 --
2246
2247 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2248
2249
2250 --
2251 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2252 --
2253
2254 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2255
2256
2257 --
2258 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2259 --
2260
2261 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2262
2263
2264 --
2265 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2266 --
2267
2268 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2269
2270
2271 --
2272 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2273 --
2274
2275 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2276
2277
2278 --
2279 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2280 --
2281
2282 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2283
2284
2285 --
2286 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2287 --
2288
2289 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2290
2291
2292 --
2293 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2294 --
2295
2296 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2297
2298
2299 --
2300 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2301 --
2302
2303 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2304
2305
2306 --
2307 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2308 --
2309
2310 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2311
2312
2313 --
2314 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2315 --
2316
2317 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2318
2319
2320 --
2321 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2322 --
2323
2324 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2325
2326
2327 --
2328 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2329 --
2330
2331 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2332
2333
2334 --
2335 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2336 --
2337
2338 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2339
2340
2341 --
2342 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2343 --
2344
2345 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2346
2347
2348 --
2349 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2350 --
2351
2352 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2353
2354
2355 --
2356 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2357 --
2358
2359 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2360
2361
2362 --
2363 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2364 --
2365
2366 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2367
2368
2369 --
2370 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2371 --
2372
2373 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2374
2375
2376 --
2377 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2378 --
2379
2380 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2381
2382
2383 --
2384 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2385 --
2386
2387 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2388
2389
2390 --
2391 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2392 --
2393
2394 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2395
2396
2397 --
2398 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2399 --
2400
2401 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2402
2403
2404 --
2405 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2406 --
2407
2408 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2409
2410
2411 --
2412 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2413 --
2414
2415 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2416
2417
2418 --
2419 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2420 --
2421
2422 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2423
2424
2425 --
2426 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2427 --
2428
2429 ALTER TABLE ONLY public.changeset_comments
2430     ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2431
2432
2433 --
2434 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2435 --
2436
2437 ALTER TABLE ONLY public.changeset_comments
2438     ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2439
2440
2441 --
2442 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2443 --
2444
2445 ALTER TABLE ONLY public.changeset_tags
2446     ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2447
2448
2449 --
2450 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2451 --
2452
2453 ALTER TABLE ONLY public.changesets_subscribers
2454     ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2455
2456
2457 --
2458 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2459 --
2460
2461 ALTER TABLE ONLY public.changesets_subscribers
2462     ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2463
2464
2465 --
2466 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2467 --
2468
2469 ALTER TABLE ONLY public.changesets
2470     ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2471
2472
2473 --
2474 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2475 --
2476
2477 ALTER TABLE ONLY public.client_applications
2478     ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2479
2480
2481 --
2482 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2483 --
2484
2485 ALTER TABLE ONLY public.current_node_tags
2486     ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2487
2488
2489 --
2490 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2491 --
2492
2493 ALTER TABLE ONLY public.current_nodes
2494     ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2495
2496
2497 --
2498 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2499 --
2500
2501 ALTER TABLE ONLY public.current_relation_members
2502     ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2503
2504
2505 --
2506 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2507 --
2508
2509 ALTER TABLE ONLY public.current_relation_tags
2510     ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2511
2512
2513 --
2514 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2515 --
2516
2517 ALTER TABLE ONLY public.current_relations
2518     ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2519
2520
2521 --
2522 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2523 --
2524
2525 ALTER TABLE ONLY public.current_way_nodes
2526     ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2527
2528
2529 --
2530 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2531 --
2532
2533 ALTER TABLE ONLY public.current_way_nodes
2534     ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2535
2536
2537 --
2538 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2539 --
2540
2541 ALTER TABLE ONLY public.current_way_tags
2542     ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2543
2544
2545 --
2546 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2547 --
2548
2549 ALTER TABLE ONLY public.current_ways
2550     ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2551
2552
2553 --
2554 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2555 --
2556
2557 ALTER TABLE ONLY public.diary_comments
2558     ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2559
2560
2561 --
2562 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2563 --
2564
2565 ALTER TABLE ONLY public.diary_comments
2566     ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2567
2568
2569 --
2570 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2571 --
2572
2573 ALTER TABLE ONLY public.diary_entries
2574     ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
2575
2576
2577 --
2578 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2579 --
2580
2581 ALTER TABLE ONLY public.diary_entries
2582     ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2583
2584
2585 --
2586 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2587 --
2588
2589 ALTER TABLE ONLY public.diary_entry_subscriptions
2590     ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2591
2592
2593 --
2594 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2595 --
2596
2597 ALTER TABLE ONLY public.diary_entry_subscriptions
2598     ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2599
2600
2601 --
2602 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2603 --
2604
2605 ALTER TABLE ONLY public.friends
2606     ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
2607
2608
2609 --
2610 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2611 --
2612
2613 ALTER TABLE ONLY public.friends
2614     ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2615
2616
2617 --
2618 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2619 --
2620
2621 ALTER TABLE ONLY public.gps_points
2622     ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2623
2624
2625 --
2626 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2627 --
2628
2629 ALTER TABLE ONLY public.gpx_file_tags
2630     ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2631
2632
2633 --
2634 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2635 --
2636
2637 ALTER TABLE ONLY public.gpx_files
2638     ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2639
2640
2641 --
2642 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2643 --
2644
2645 ALTER TABLE ONLY public.issue_comments
2646     ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2647
2648
2649 --
2650 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2651 --
2652
2653 ALTER TABLE ONLY public.issue_comments
2654     ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2655
2656
2657 --
2658 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2659 --
2660
2661 ALTER TABLE ONLY public.issues
2662     ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
2663
2664
2665 --
2666 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2667 --
2668
2669 ALTER TABLE ONLY public.issues
2670     ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
2671
2672
2673 --
2674 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2675 --
2676
2677 ALTER TABLE ONLY public.issues
2678     ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
2679
2680
2681 --
2682 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2683 --
2684
2685 ALTER TABLE ONLY public.messages
2686     ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
2687
2688
2689 --
2690 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2691 --
2692
2693 ALTER TABLE ONLY public.messages
2694     ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
2695
2696
2697 --
2698 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2699 --
2700
2701 ALTER TABLE ONLY public.node_tags
2702     ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
2703
2704
2705 --
2706 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2707 --
2708
2709 ALTER TABLE ONLY public.nodes
2710     ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2711
2712
2713 --
2714 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2715 --
2716
2717 ALTER TABLE ONLY public.nodes
2718     ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2719
2720
2721 --
2722 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2723 --
2724
2725 ALTER TABLE ONLY public.note_comments
2726     ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2727
2728
2729 --
2730 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2731 --
2732
2733 ALTER TABLE ONLY public.note_comments
2734     ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
2735
2736
2737 --
2738 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2739 --
2740
2741 ALTER TABLE ONLY public.oauth_tokens
2742     ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
2743
2744
2745 --
2746 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2747 --
2748
2749 ALTER TABLE ONLY public.oauth_tokens
2750     ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2751
2752
2753 --
2754 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2755 --
2756
2757 ALTER TABLE ONLY public.redactions
2758     ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2759
2760
2761 --
2762 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2763 --
2764
2765 ALTER TABLE ONLY public.relation_members
2766     ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2767
2768
2769 --
2770 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2771 --
2772
2773 ALTER TABLE ONLY public.relation_tags
2774     ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2775
2776
2777 --
2778 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2779 --
2780
2781 ALTER TABLE ONLY public.relations
2782     ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2783
2784
2785 --
2786 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2787 --
2788
2789 ALTER TABLE ONLY public.relations
2790     ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2791
2792
2793 --
2794 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2795 --
2796
2797 ALTER TABLE ONLY public.reports
2798     ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2799
2800
2801 --
2802 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2803 --
2804
2805 ALTER TABLE ONLY public.reports
2806     ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2807
2808
2809 --
2810 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2811 --
2812
2813 ALTER TABLE ONLY public.user_blocks
2814     ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
2815
2816
2817 --
2818 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2819 --
2820
2821 ALTER TABLE ONLY public.user_blocks
2822     ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
2823
2824
2825 --
2826 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2827 --
2828
2829 ALTER TABLE ONLY public.user_blocks
2830     ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2831
2832
2833 --
2834 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2835 --
2836
2837 ALTER TABLE ONLY public.user_preferences
2838     ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2839
2840
2841 --
2842 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2843 --
2844
2845 ALTER TABLE ONLY public.user_roles
2846     ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
2847
2848
2849 --
2850 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2851 --
2852
2853 ALTER TABLE ONLY public.user_roles
2854     ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2855
2856
2857 --
2858 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2859 --
2860
2861 ALTER TABLE ONLY public.user_tokens
2862     ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2863
2864
2865 --
2866 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2867 --
2868
2869 ALTER TABLE ONLY public.way_nodes
2870     ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
2871
2872
2873 --
2874 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2875 --
2876
2877 ALTER TABLE ONLY public.way_tags
2878     ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
2879
2880
2881 --
2882 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2883 --
2884
2885 ALTER TABLE ONLY public.ways
2886     ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2887
2888
2889 --
2890 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2891 --
2892
2893 ALTER TABLE ONLY public.ways
2894     ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2895
2896
2897 --
2898 -- PostgreSQL database dump complete
2899 --
2900
2901 SET search_path TO "$user", public;
2902
2903 INSERT INTO "schema_migrations" (version) VALUES
2904 ('1'),
2905 ('10'),
2906 ('11'),
2907 ('12'),
2908 ('13'),
2909 ('14'),
2910 ('15'),
2911 ('16'),
2912 ('17'),
2913 ('18'),
2914 ('19'),
2915 ('2'),
2916 ('20'),
2917 ('20100513171259'),
2918 ('20100516124737'),
2919 ('20100910084426'),
2920 ('20101114011429'),
2921 ('20110322001319'),
2922 ('20110508145337'),
2923 ('20110521142405'),
2924 ('20110925112722'),
2925 ('20111116184519'),
2926 ('20111212183945'),
2927 ('20120123184321'),
2928 ('20120208122334'),
2929 ('20120208194454'),
2930 ('20120214210114'),
2931 ('20120219161649'),
2932 ('20120318201948'),
2933 ('20120328090602'),
2934 ('20120404205604'),
2935 ('20120808231205'),
2936 ('20121005195010'),
2937 ('20121012044047'),
2938 ('20121119165817'),
2939 ('20121202155309'),
2940 ('20121203124841'),
2941 ('20130328184137'),
2942 ('20131212124700'),
2943 ('20140115192822'),
2944 ('20140117185510'),
2945 ('20140210003018'),
2946 ('20140507110937'),
2947 ('20140519141742'),
2948 ('20150110152606'),
2949 ('20150111192335'),
2950 ('20150222101847'),
2951 ('20150818224516'),
2952 ('20160822153055'),
2953 ('20161002153425'),
2954 ('20161011010929'),
2955 ('20170222134109'),
2956 ('20180204153242'),
2957 ('20181020114000'),
2958 ('20181031113522'),
2959 ('20190518115041'),
2960 ('20190623093642'),
2961 ('21'),
2962 ('22'),
2963 ('23'),
2964 ('24'),
2965 ('25'),
2966 ('26'),
2967 ('27'),
2968 ('28'),
2969 ('29'),
2970 ('3'),
2971 ('30'),
2972 ('31'),
2973 ('32'),
2974 ('33'),
2975 ('34'),
2976 ('35'),
2977 ('36'),
2978 ('37'),
2979 ('38'),
2980 ('39'),
2981 ('4'),
2982 ('40'),
2983 ('41'),
2984 ('42'),
2985 ('43'),
2986 ('44'),
2987 ('45'),
2988 ('46'),
2989 ('47'),
2990 ('48'),
2991 ('49'),
2992 ('5'),
2993 ('50'),
2994 ('51'),
2995 ('52'),
2996 ('53'),
2997 ('54'),
2998 ('55'),
2999 ('56'),
3000 ('57'),
3001 ('6'),
3002 ('7'),
3003 ('8'),
3004 ('9');
3005
3006