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