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