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