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