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