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