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