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