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