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