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