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