]> git.openstreetmap.org Git - rails.git/blob - db/structure.sql
Correct misspellings of CC BY[-SA]
[rails.git] / db / structure.sql
1 --
2 -- PostgreSQL database dump
3 --
4
5 SET statement_timeout = 0;
6 SET client_encoding = 'UTF8';
7 SET standard_conforming_strings = on;
8 SET check_function_bodies = false;
9 SET client_min_messages = warning;
10
11 --
12 -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
13 --
14
15 CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
16
17
18 --
19 -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
20 --
21
22 COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
23
24
25 --
26 -- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: -
27 --
28
29 CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public;
30
31
32 --
33 -- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: -
34 --
35
36 COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST';
37
38
39 SET search_path = public, pg_catalog;
40
41 --
42 -- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: -
43 --
44
45 CREATE TYPE gpx_visibility_enum AS ENUM (
46     'private',
47     'public',
48     'trackable',
49     'identifiable'
50 );
51
52
53 --
54 -- Name: nwr_enum; Type: TYPE; Schema: public; Owner: -
55 --
56
57 CREATE TYPE nwr_enum AS ENUM (
58     'Node',
59     'Way',
60     'Relation'
61 );
62
63
64 --
65 -- Name: user_role_enum; Type: TYPE; Schema: public; Owner: -
66 --
67
68 CREATE TYPE user_role_enum AS ENUM (
69     'administrator',
70     'moderator'
71 );
72
73
74 --
75 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
76 --
77
78 CREATE TYPE user_status_enum AS ENUM (
79     'pending',
80     'active',
81     'confirmed',
82     'suspended',
83     'deleted'
84 );
85
86
87 --
88 -- Name: maptile_for_point(bigint, bigint, integer); Type: FUNCTION; Schema: public; Owner: -
89 --
90
91 CREATE FUNCTION maptile_for_point(bigint, bigint, integer) RETURNS integer
92     LANGUAGE c STRICT
93     AS '/srv/www/master.osm.compton.nu/db/functions/libpgosm.so', 'maptile_for_point';
94
95
96 --
97 -- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
98 --
99
100 CREATE FUNCTION tile_for_point(integer, integer) RETURNS bigint
101     LANGUAGE c STRICT
102     AS '/srv/www/master.osm.compton.nu/db/functions/libpgosm.so', 'tile_for_point';
103
104
105 --
106 -- Name: xid_to_int4(xid); Type: FUNCTION; Schema: public; Owner: -
107 --
108
109 CREATE FUNCTION xid_to_int4(xid) RETURNS integer
110     LANGUAGE c IMMUTABLE STRICT
111     AS '/srv/www/master.osm.compton.nu/db/functions/libpgosm.so', 'xid_to_int4';
112
113
114 SET default_tablespace = '';
115
116 SET default_with_oids = false;
117
118 --
119 -- Name: acls; Type: TABLE; Schema: public; Owner: -; Tablespace: 
120 --
121
122 CREATE TABLE acls (
123     id integer NOT NULL,
124     address inet,
125     k character varying(255) NOT NULL,
126     v character varying(255),
127     domain character varying(255)
128 );
129
130
131 --
132 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
133 --
134
135 CREATE SEQUENCE acls_id_seq
136     START WITH 1
137     INCREMENT BY 1
138     NO MINVALUE
139     NO MAXVALUE
140     CACHE 1;
141
142
143 --
144 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
145 --
146
147 ALTER SEQUENCE acls_id_seq OWNED BY acls.id;
148
149
150 --
151 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -; Tablespace: 
152 --
153
154 CREATE TABLE changeset_tags (
155     changeset_id bigint NOT NULL,
156     k character varying(255) DEFAULT ''::character varying NOT NULL,
157     v character varying(255) DEFAULT ''::character varying NOT NULL
158 );
159
160
161 --
162 -- Name: changesets; Type: TABLE; Schema: public; Owner: -; Tablespace: 
163 --
164
165 CREATE TABLE changesets (
166     id bigint NOT NULL,
167     user_id bigint NOT NULL,
168     created_at timestamp without time zone NOT NULL,
169     min_lat integer,
170     max_lat integer,
171     min_lon integer,
172     max_lon integer,
173     closed_at timestamp without time zone NOT NULL,
174     num_changes integer DEFAULT 0 NOT NULL
175 );
176
177
178 --
179 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
180 --
181
182 CREATE SEQUENCE changesets_id_seq
183     START WITH 1
184     INCREMENT BY 1
185     NO MINVALUE
186     NO MAXVALUE
187     CACHE 1;
188
189
190 --
191 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
192 --
193
194 ALTER SEQUENCE changesets_id_seq OWNED BY changesets.id;
195
196
197 --
198 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -; Tablespace: 
199 --
200
201 CREATE TABLE client_applications (
202     id integer NOT NULL,
203     name character varying(255),
204     url character varying(255),
205     support_url character varying(255),
206     callback_url character varying(255),
207     key character varying(50),
208     secret character varying(50),
209     user_id integer,
210     created_at timestamp without time zone,
211     updated_at timestamp without time zone,
212     allow_read_prefs boolean DEFAULT false NOT NULL,
213     allow_write_prefs boolean DEFAULT false NOT NULL,
214     allow_write_diary boolean DEFAULT false NOT NULL,
215     allow_write_api boolean DEFAULT false NOT NULL,
216     allow_read_gpx boolean DEFAULT false NOT NULL,
217     allow_write_gpx boolean DEFAULT false NOT NULL
218 );
219
220
221 --
222 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
223 --
224
225 CREATE SEQUENCE client_applications_id_seq
226     START WITH 1
227     INCREMENT BY 1
228     NO MINVALUE
229     NO MAXVALUE
230     CACHE 1;
231
232
233 --
234 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
235 --
236
237 ALTER SEQUENCE client_applications_id_seq OWNED BY client_applications.id;
238
239
240 --
241 -- Name: countries; Type: TABLE; Schema: public; Owner: -; Tablespace: 
242 --
243
244 CREATE TABLE countries (
245     id integer NOT NULL,
246     code character varying(2) NOT NULL,
247     min_lat double precision NOT NULL,
248     max_lat double precision NOT NULL,
249     min_lon double precision NOT NULL,
250     max_lon double precision NOT NULL
251 );
252
253
254 --
255 -- Name: countries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
256 --
257
258 CREATE SEQUENCE countries_id_seq
259     START WITH 1
260     INCREMENT BY 1
261     NO MINVALUE
262     NO MAXVALUE
263     CACHE 1;
264
265
266 --
267 -- Name: countries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
268 --
269
270 ALTER SEQUENCE countries_id_seq OWNED BY countries.id;
271
272
273 --
274 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -; Tablespace: 
275 --
276
277 CREATE TABLE current_node_tags (
278     node_id bigint NOT NULL,
279     k character varying(255) DEFAULT ''::character varying NOT NULL,
280     v character varying(255) DEFAULT ''::character varying NOT NULL
281 );
282
283
284 --
285 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -; Tablespace: 
286 --
287
288 CREATE TABLE current_nodes (
289     id bigint NOT NULL,
290     latitude integer NOT NULL,
291     longitude integer NOT NULL,
292     changeset_id bigint NOT NULL,
293     visible boolean NOT NULL,
294     "timestamp" timestamp without time zone NOT NULL,
295     tile bigint NOT NULL,
296     version bigint NOT NULL
297 );
298
299
300 --
301 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
302 --
303
304 CREATE SEQUENCE current_nodes_id_seq
305     START WITH 1
306     INCREMENT BY 1
307     NO MINVALUE
308     NO MAXVALUE
309     CACHE 1;
310
311
312 --
313 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
314 --
315
316 ALTER SEQUENCE current_nodes_id_seq OWNED BY current_nodes.id;
317
318
319 --
320 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -; Tablespace: 
321 --
322
323 CREATE TABLE current_relation_members (
324     relation_id bigint NOT NULL,
325     member_type nwr_enum NOT NULL,
326     member_id bigint NOT NULL,
327     member_role character varying(255) NOT NULL,
328     sequence_id integer DEFAULT 0 NOT NULL
329 );
330
331
332 --
333 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -; Tablespace: 
334 --
335
336 CREATE TABLE current_relation_tags (
337     relation_id bigint NOT NULL,
338     k character varying(255) DEFAULT ''::character varying NOT NULL,
339     v character varying(255) DEFAULT ''::character varying NOT NULL
340 );
341
342
343 --
344 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -; Tablespace: 
345 --
346
347 CREATE TABLE current_relations (
348     id bigint NOT NULL,
349     changeset_id bigint NOT NULL,
350     "timestamp" timestamp without time zone NOT NULL,
351     visible boolean NOT NULL,
352     version bigint NOT NULL
353 );
354
355
356 --
357 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
358 --
359
360 CREATE SEQUENCE current_relations_id_seq
361     START WITH 1
362     INCREMENT BY 1
363     NO MINVALUE
364     NO MAXVALUE
365     CACHE 1;
366
367
368 --
369 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
370 --
371
372 ALTER SEQUENCE current_relations_id_seq OWNED BY current_relations.id;
373
374
375 --
376 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -; Tablespace: 
377 --
378
379 CREATE TABLE current_way_nodes (
380     way_id bigint NOT NULL,
381     node_id bigint NOT NULL,
382     sequence_id bigint NOT NULL
383 );
384
385
386 --
387 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -; Tablespace: 
388 --
389
390 CREATE TABLE current_way_tags (
391     way_id bigint NOT NULL,
392     k character varying(255) DEFAULT ''::character varying NOT NULL,
393     v character varying(255) DEFAULT ''::character varying NOT NULL
394 );
395
396
397 --
398 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -; Tablespace: 
399 --
400
401 CREATE TABLE current_ways (
402     id bigint NOT NULL,
403     changeset_id bigint NOT NULL,
404     "timestamp" timestamp without time zone NOT NULL,
405     visible boolean NOT NULL,
406     version bigint NOT NULL
407 );
408
409
410 --
411 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
412 --
413
414 CREATE SEQUENCE current_ways_id_seq
415     START WITH 1
416     INCREMENT BY 1
417     NO MINVALUE
418     NO MAXVALUE
419     CACHE 1;
420
421
422 --
423 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
424 --
425
426 ALTER SEQUENCE current_ways_id_seq OWNED BY current_ways.id;
427
428
429 --
430 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -; Tablespace: 
431 --
432
433 CREATE TABLE diary_comments (
434     id bigint NOT NULL,
435     diary_entry_id bigint NOT NULL,
436     user_id bigint NOT NULL,
437     body text NOT NULL,
438     created_at timestamp without time zone NOT NULL,
439     updated_at timestamp without time zone NOT NULL,
440     visible boolean DEFAULT true NOT NULL
441 );
442
443
444 --
445 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
446 --
447
448 CREATE SEQUENCE diary_comments_id_seq
449     START WITH 1
450     INCREMENT BY 1
451     NO MINVALUE
452     NO MAXVALUE
453     CACHE 1;
454
455
456 --
457 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
458 --
459
460 ALTER SEQUENCE diary_comments_id_seq OWNED BY diary_comments.id;
461
462
463 --
464 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -; Tablespace: 
465 --
466
467 CREATE TABLE diary_entries (
468     id bigint NOT NULL,
469     user_id bigint NOT NULL,
470     title character varying(255) NOT NULL,
471     body text NOT NULL,
472     created_at timestamp without time zone NOT NULL,
473     updated_at timestamp without time zone NOT NULL,
474     latitude double precision,
475     longitude double precision,
476     language_code character varying(255) DEFAULT 'en'::character varying NOT NULL,
477     visible boolean DEFAULT true NOT NULL
478 );
479
480
481 --
482 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
483 --
484
485 CREATE SEQUENCE diary_entries_id_seq
486     START WITH 1
487     INCREMENT BY 1
488     NO MINVALUE
489     NO MAXVALUE
490     CACHE 1;
491
492
493 --
494 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
495 --
496
497 ALTER SEQUENCE diary_entries_id_seq OWNED BY diary_entries.id;
498
499
500 --
501 -- Name: friends; Type: TABLE; Schema: public; Owner: -; Tablespace: 
502 --
503
504 CREATE TABLE friends (
505     id bigint NOT NULL,
506     user_id bigint NOT NULL,
507     friend_user_id bigint NOT NULL
508 );
509
510
511 --
512 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
513 --
514
515 CREATE SEQUENCE friends_id_seq
516     START WITH 1
517     INCREMENT BY 1
518     NO MINVALUE
519     NO MAXVALUE
520     CACHE 1;
521
522
523 --
524 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
525 --
526
527 ALTER SEQUENCE friends_id_seq OWNED BY friends.id;
528
529
530 --
531 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -; Tablespace: 
532 --
533
534 CREATE TABLE gps_points (
535     altitude double precision,
536     trackid integer NOT NULL,
537     latitude integer NOT NULL,
538     longitude integer NOT NULL,
539     gpx_id bigint NOT NULL,
540     "timestamp" timestamp without time zone,
541     tile bigint
542 );
543
544
545 --
546 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -; Tablespace: 
547 --
548
549 CREATE TABLE gpx_file_tags (
550     gpx_id bigint DEFAULT 0 NOT NULL,
551     tag character varying(255) NOT NULL,
552     id bigint NOT NULL
553 );
554
555
556 --
557 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
558 --
559
560 CREATE SEQUENCE gpx_file_tags_id_seq
561     START WITH 1
562     INCREMENT BY 1
563     NO MINVALUE
564     NO MAXVALUE
565     CACHE 1;
566
567
568 --
569 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
570 --
571
572 ALTER SEQUENCE gpx_file_tags_id_seq OWNED BY gpx_file_tags.id;
573
574
575 --
576 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -; Tablespace: 
577 --
578
579 CREATE TABLE gpx_files (
580     id bigint NOT NULL,
581     user_id bigint NOT NULL,
582     visible boolean DEFAULT true NOT NULL,
583     name character varying(255) DEFAULT ''::character varying NOT NULL,
584     size bigint,
585     latitude double precision,
586     longitude double precision,
587     "timestamp" timestamp without time zone NOT NULL,
588     description character varying(255) DEFAULT ''::character varying NOT NULL,
589     inserted boolean NOT NULL,
590     visibility gpx_visibility_enum DEFAULT 'public'::gpx_visibility_enum NOT NULL
591 );
592
593
594 --
595 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
596 --
597
598 CREATE SEQUENCE gpx_files_id_seq
599     START WITH 1
600     INCREMENT BY 1
601     NO MINVALUE
602     NO MAXVALUE
603     CACHE 1;
604
605
606 --
607 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
608 --
609
610 ALTER SEQUENCE gpx_files_id_seq OWNED BY gpx_files.id;
611
612
613 --
614 -- Name: languages; Type: TABLE; Schema: public; Owner: -; Tablespace: 
615 --
616
617 CREATE TABLE languages (
618     code character varying(255) NOT NULL,
619     english_name character varying(255) NOT NULL,
620     native_name character varying(255)
621 );
622
623
624 --
625 -- Name: messages; Type: TABLE; Schema: public; Owner: -; Tablespace: 
626 --
627
628 CREATE TABLE messages (
629     id bigint NOT NULL,
630     from_user_id bigint NOT NULL,
631     title character varying(255) NOT NULL,
632     body text NOT NULL,
633     sent_on timestamp without time zone NOT NULL,
634     message_read boolean DEFAULT false NOT NULL,
635     to_user_id bigint NOT NULL,
636     to_user_visible boolean DEFAULT true NOT NULL,
637     from_user_visible boolean DEFAULT true NOT NULL
638 );
639
640
641 --
642 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
643 --
644
645 CREATE SEQUENCE messages_id_seq
646     START WITH 1
647     INCREMENT BY 1
648     NO MINVALUE
649     NO MAXVALUE
650     CACHE 1;
651
652
653 --
654 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
655 --
656
657 ALTER SEQUENCE messages_id_seq OWNED BY messages.id;
658
659
660 --
661 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -; Tablespace: 
662 --
663
664 CREATE TABLE node_tags (
665     node_id bigint NOT NULL,
666     version bigint NOT NULL,
667     k character varying(255) DEFAULT ''::character varying NOT NULL,
668     v character varying(255) DEFAULT ''::character varying NOT NULL
669 );
670
671
672 --
673 -- Name: nodes; Type: TABLE; Schema: public; Owner: -; Tablespace: 
674 --
675
676 CREATE TABLE nodes (
677     node_id bigint NOT NULL,
678     latitude integer NOT NULL,
679     longitude integer NOT NULL,
680     changeset_id bigint NOT NULL,
681     visible boolean NOT NULL,
682     "timestamp" timestamp without time zone NOT NULL,
683     tile bigint NOT NULL,
684     version bigint NOT NULL
685 );
686
687
688 --
689 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -; Tablespace: 
690 --
691
692 CREATE TABLE oauth_nonces (
693     id integer NOT NULL,
694     nonce character varying(255),
695     "timestamp" integer,
696     created_at timestamp without time zone,
697     updated_at timestamp without time zone
698 );
699
700
701 --
702 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
703 --
704
705 CREATE SEQUENCE oauth_nonces_id_seq
706     START WITH 1
707     INCREMENT BY 1
708     NO MINVALUE
709     NO MAXVALUE
710     CACHE 1;
711
712
713 --
714 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
715 --
716
717 ALTER SEQUENCE oauth_nonces_id_seq OWNED BY oauth_nonces.id;
718
719
720 --
721 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -; Tablespace: 
722 --
723
724 CREATE TABLE oauth_tokens (
725     id integer NOT NULL,
726     user_id integer,
727     type character varying(20),
728     client_application_id integer,
729     token character varying(50),
730     secret character varying(50),
731     authorized_at timestamp without time zone,
732     invalidated_at timestamp without time zone,
733     created_at timestamp without time zone,
734     updated_at timestamp without time zone,
735     allow_read_prefs boolean DEFAULT false NOT NULL,
736     allow_write_prefs boolean DEFAULT false NOT NULL,
737     allow_write_diary boolean DEFAULT false NOT NULL,
738     allow_write_api boolean DEFAULT false NOT NULL,
739     allow_read_gpx boolean DEFAULT false NOT NULL,
740     allow_write_gpx boolean DEFAULT false NOT NULL,
741     callback_url character varying(255),
742     verifier character varying(20),
743     scope character varying(255),
744     valid_to timestamp without time zone
745 );
746
747
748 --
749 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
750 --
751
752 CREATE SEQUENCE oauth_tokens_id_seq
753     START WITH 1
754     INCREMENT BY 1
755     NO MINVALUE
756     NO MAXVALUE
757     CACHE 1;
758
759
760 --
761 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
762 --
763
764 ALTER SEQUENCE oauth_tokens_id_seq OWNED BY oauth_tokens.id;
765
766
767 --
768 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -; Tablespace: 
769 --
770
771 CREATE TABLE relation_members (
772     relation_id bigint DEFAULT 0 NOT NULL,
773     member_type nwr_enum NOT NULL,
774     member_id bigint NOT NULL,
775     member_role character varying(255) NOT NULL,
776     version bigint DEFAULT 0 NOT NULL,
777     sequence_id integer DEFAULT 0 NOT NULL
778 );
779
780
781 --
782 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -; Tablespace: 
783 --
784
785 CREATE TABLE relation_tags (
786     relation_id bigint DEFAULT 0 NOT NULL,
787     k character varying(255) DEFAULT ''::character varying NOT NULL,
788     v character varying(255) DEFAULT ''::character varying NOT NULL,
789     version bigint NOT NULL
790 );
791
792
793 --
794 -- Name: relations; Type: TABLE; Schema: public; Owner: -; Tablespace: 
795 --
796
797 CREATE TABLE relations (
798     relation_id bigint DEFAULT 0 NOT NULL,
799     changeset_id bigint NOT NULL,
800     "timestamp" timestamp without time zone NOT NULL,
801     version bigint NOT NULL,
802     visible boolean DEFAULT true NOT NULL
803 );
804
805
806 --
807 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace: 
808 --
809
810 CREATE TABLE schema_migrations (
811     version character varying(255) NOT NULL
812 );
813
814
815 --
816 -- Name: sessions; Type: TABLE; Schema: public; Owner: -; Tablespace: 
817 --
818
819 CREATE TABLE sessions (
820     id integer NOT NULL,
821     session_id character varying(255),
822     data text,
823     created_at timestamp without time zone,
824     updated_at timestamp without time zone
825 );
826
827
828 --
829 -- Name: sessions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
830 --
831
832 CREATE SEQUENCE sessions_id_seq
833     START WITH 1
834     INCREMENT BY 1
835     NO MINVALUE
836     NO MAXVALUE
837     CACHE 1;
838
839
840 --
841 -- Name: sessions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
842 --
843
844 ALTER SEQUENCE sessions_id_seq OWNED BY sessions.id;
845
846
847 --
848 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -; Tablespace: 
849 --
850
851 CREATE TABLE user_blocks (
852     id integer NOT NULL,
853     user_id bigint NOT NULL,
854     creator_id bigint NOT NULL,
855     reason text NOT NULL,
856     ends_at timestamp without time zone NOT NULL,
857     needs_view boolean DEFAULT false NOT NULL,
858     revoker_id bigint,
859     created_at timestamp without time zone,
860     updated_at timestamp without time zone
861 );
862
863
864 --
865 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
866 --
867
868 CREATE SEQUENCE user_blocks_id_seq
869     START WITH 1
870     INCREMENT BY 1
871     NO MINVALUE
872     NO MAXVALUE
873     CACHE 1;
874
875
876 --
877 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
878 --
879
880 ALTER SEQUENCE user_blocks_id_seq OWNED BY user_blocks.id;
881
882
883 --
884 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -; Tablespace: 
885 --
886
887 CREATE TABLE user_preferences (
888     user_id bigint NOT NULL,
889     k character varying(255) NOT NULL,
890     v character varying(255) NOT NULL
891 );
892
893
894 --
895 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -; Tablespace: 
896 --
897
898 CREATE TABLE user_roles (
899     id integer NOT NULL,
900     user_id bigint NOT NULL,
901     created_at timestamp without time zone,
902     updated_at timestamp without time zone,
903     role user_role_enum NOT NULL,
904     granter_id bigint NOT NULL
905 );
906
907
908 --
909 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
910 --
911
912 CREATE SEQUENCE user_roles_id_seq
913     START WITH 1
914     INCREMENT BY 1
915     NO MINVALUE
916     NO MAXVALUE
917     CACHE 1;
918
919
920 --
921 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
922 --
923
924 ALTER SEQUENCE user_roles_id_seq OWNED BY user_roles.id;
925
926
927 --
928 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -; Tablespace: 
929 --
930
931 CREATE TABLE user_tokens (
932     id bigint NOT NULL,
933     user_id bigint NOT NULL,
934     token character varying(255) NOT NULL,
935     expiry timestamp without time zone NOT NULL,
936     referer text
937 );
938
939
940 --
941 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
942 --
943
944 CREATE SEQUENCE user_tokens_id_seq
945     START WITH 1
946     INCREMENT BY 1
947     NO MINVALUE
948     NO MAXVALUE
949     CACHE 1;
950
951
952 --
953 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
954 --
955
956 ALTER SEQUENCE user_tokens_id_seq OWNED BY user_tokens.id;
957
958
959 --
960 -- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace: 
961 --
962
963 CREATE TABLE users (
964     email character varying(255) NOT NULL,
965     id bigint NOT NULL,
966     pass_crypt character varying(255) NOT NULL,
967     creation_time timestamp without time zone NOT NULL,
968     display_name character varying(255) DEFAULT ''::character varying NOT NULL,
969     data_public boolean DEFAULT false NOT NULL,
970     description text DEFAULT ''::text NOT NULL,
971     home_lat double precision,
972     home_lon double precision,
973     home_zoom smallint DEFAULT 3,
974     nearby integer DEFAULT 50,
975     pass_salt character varying(255),
976     image_file_name text,
977     email_valid boolean DEFAULT false NOT NULL,
978     new_email character varying(255),
979     creation_ip character varying(255),
980     languages character varying(255),
981     status user_status_enum DEFAULT 'pending'::user_status_enum NOT NULL,
982     terms_agreed timestamp without time zone,
983     consider_pd boolean DEFAULT false NOT NULL,
984     preferred_editor character varying(255),
985     terms_seen boolean DEFAULT false NOT NULL,
986     openid_url character varying(255),
987     image_fingerprint character varying(255)
988 );
989
990
991 --
992 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
993 --
994
995 CREATE SEQUENCE users_id_seq
996     START WITH 1
997     INCREMENT BY 1
998     NO MINVALUE
999     NO MAXVALUE
1000     CACHE 1;
1001
1002
1003 --
1004 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1005 --
1006
1007 ALTER SEQUENCE users_id_seq OWNED BY users.id;
1008
1009
1010 --
1011 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1012 --
1013
1014 CREATE TABLE way_nodes (
1015     way_id bigint NOT NULL,
1016     node_id bigint NOT NULL,
1017     version bigint NOT NULL,
1018     sequence_id bigint NOT NULL
1019 );
1020
1021
1022 --
1023 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1024 --
1025
1026 CREATE TABLE way_tags (
1027     way_id bigint DEFAULT 0 NOT NULL,
1028     k character varying(255) NOT NULL,
1029     v character varying(255) NOT NULL,
1030     version bigint NOT NULL
1031 );
1032
1033
1034 --
1035 -- Name: ways; Type: TABLE; Schema: public; Owner: -; Tablespace: 
1036 --
1037
1038 CREATE TABLE ways (
1039     way_id bigint DEFAULT 0 NOT NULL,
1040     changeset_id bigint NOT NULL,
1041     "timestamp" timestamp without time zone NOT NULL,
1042     version bigint NOT NULL,
1043     visible boolean DEFAULT true NOT NULL
1044 );
1045
1046
1047 --
1048 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1049 --
1050
1051 ALTER TABLE acls ALTER COLUMN id SET DEFAULT nextval('acls_id_seq'::regclass);
1052
1053
1054 --
1055 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1056 --
1057
1058 ALTER TABLE changesets ALTER COLUMN id SET DEFAULT nextval('changesets_id_seq'::regclass);
1059
1060
1061 --
1062 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1063 --
1064
1065 ALTER TABLE client_applications ALTER COLUMN id SET DEFAULT nextval('client_applications_id_seq'::regclass);
1066
1067
1068 --
1069 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1070 --
1071
1072 ALTER TABLE countries ALTER COLUMN id SET DEFAULT nextval('countries_id_seq'::regclass);
1073
1074
1075 --
1076 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1077 --
1078
1079 ALTER TABLE current_nodes ALTER COLUMN id SET DEFAULT nextval('current_nodes_id_seq'::regclass);
1080
1081
1082 --
1083 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1084 --
1085
1086 ALTER TABLE current_relations ALTER COLUMN id SET DEFAULT nextval('current_relations_id_seq'::regclass);
1087
1088
1089 --
1090 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1091 --
1092
1093 ALTER TABLE current_ways ALTER COLUMN id SET DEFAULT nextval('current_ways_id_seq'::regclass);
1094
1095
1096 --
1097 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1098 --
1099
1100 ALTER TABLE diary_comments ALTER COLUMN id SET DEFAULT nextval('diary_comments_id_seq'::regclass);
1101
1102
1103 --
1104 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1105 --
1106
1107 ALTER TABLE diary_entries ALTER COLUMN id SET DEFAULT nextval('diary_entries_id_seq'::regclass);
1108
1109
1110 --
1111 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1112 --
1113
1114 ALTER TABLE friends ALTER COLUMN id SET DEFAULT nextval('friends_id_seq'::regclass);
1115
1116
1117 --
1118 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1119 --
1120
1121 ALTER TABLE gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('gpx_file_tags_id_seq'::regclass);
1122
1123
1124 --
1125 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1126 --
1127
1128 ALTER TABLE gpx_files ALTER COLUMN id SET DEFAULT nextval('gpx_files_id_seq'::regclass);
1129
1130
1131 --
1132 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1133 --
1134
1135 ALTER TABLE messages ALTER COLUMN id SET DEFAULT nextval('messages_id_seq'::regclass);
1136
1137
1138 --
1139 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1140 --
1141
1142 ALTER TABLE oauth_nonces ALTER COLUMN id SET DEFAULT nextval('oauth_nonces_id_seq'::regclass);
1143
1144
1145 --
1146 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1147 --
1148
1149 ALTER TABLE oauth_tokens ALTER COLUMN id SET DEFAULT nextval('oauth_tokens_id_seq'::regclass);
1150
1151
1152 --
1153 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1154 --
1155
1156 ALTER TABLE sessions ALTER COLUMN id SET DEFAULT nextval('sessions_id_seq'::regclass);
1157
1158
1159 --
1160 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1161 --
1162
1163 ALTER TABLE user_blocks ALTER COLUMN id SET DEFAULT nextval('user_blocks_id_seq'::regclass);
1164
1165
1166 --
1167 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1168 --
1169
1170 ALTER TABLE user_roles ALTER COLUMN id SET DEFAULT nextval('user_roles_id_seq'::regclass);
1171
1172
1173 --
1174 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1175 --
1176
1177 ALTER TABLE user_tokens ALTER COLUMN id SET DEFAULT nextval('user_tokens_id_seq'::regclass);
1178
1179
1180 --
1181 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1182 --
1183
1184 ALTER TABLE users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
1185
1186
1187 --
1188 -- Name: acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1189 --
1190
1191 ALTER TABLE ONLY acls
1192     ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1193
1194
1195 --
1196 -- Name: changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1197 --
1198
1199 ALTER TABLE ONLY changesets
1200     ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1201
1202
1203 --
1204 -- Name: client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1205 --
1206
1207 ALTER TABLE ONLY client_applications
1208     ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1209
1210
1211 --
1212 -- Name: countries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1213 --
1214
1215 ALTER TABLE ONLY countries
1216     ADD CONSTRAINT countries_pkey PRIMARY KEY (id);
1217
1218
1219 --
1220 -- Name: current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1221 --
1222
1223 ALTER TABLE ONLY current_node_tags
1224     ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1225
1226
1227 --
1228 -- Name: current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1229 --
1230
1231 ALTER TABLE ONLY current_nodes
1232     ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1233
1234
1235 --
1236 -- Name: current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1237 --
1238
1239 ALTER TABLE ONLY current_relation_members
1240     ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1241
1242
1243 --
1244 -- Name: current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1245 --
1246
1247 ALTER TABLE ONLY current_relation_tags
1248     ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1249
1250
1251 --
1252 -- Name: current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1253 --
1254
1255 ALTER TABLE ONLY current_relations
1256     ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1257
1258
1259 --
1260 -- Name: current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1261 --
1262
1263 ALTER TABLE ONLY current_way_nodes
1264     ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1265
1266
1267 --
1268 -- Name: current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1269 --
1270
1271 ALTER TABLE ONLY current_way_tags
1272     ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1273
1274
1275 --
1276 -- Name: current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1277 --
1278
1279 ALTER TABLE ONLY current_ways
1280     ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1281
1282
1283 --
1284 -- Name: diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1285 --
1286
1287 ALTER TABLE ONLY diary_comments
1288     ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1289
1290
1291 --
1292 -- Name: diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1293 --
1294
1295 ALTER TABLE ONLY diary_entries
1296     ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1297
1298
1299 --
1300 -- Name: friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1301 --
1302
1303 ALTER TABLE ONLY friends
1304     ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1305
1306
1307 --
1308 -- Name: gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1309 --
1310
1311 ALTER TABLE ONLY gpx_file_tags
1312     ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1313
1314
1315 --
1316 -- Name: gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1317 --
1318
1319 ALTER TABLE ONLY gpx_files
1320     ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1321
1322
1323 --
1324 -- Name: languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1325 --
1326
1327 ALTER TABLE ONLY languages
1328     ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1329
1330
1331 --
1332 -- Name: messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1333 --
1334
1335 ALTER TABLE ONLY messages
1336     ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1337
1338
1339 --
1340 -- Name: node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1341 --
1342
1343 ALTER TABLE ONLY node_tags
1344     ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1345
1346
1347 --
1348 -- Name: nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1349 --
1350
1351 ALTER TABLE ONLY nodes
1352     ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1353
1354
1355 --
1356 -- Name: oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1357 --
1358
1359 ALTER TABLE ONLY oauth_nonces
1360     ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1361
1362
1363 --
1364 -- Name: oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1365 --
1366
1367 ALTER TABLE ONLY oauth_tokens
1368     ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1369
1370
1371 --
1372 -- Name: relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1373 --
1374
1375 ALTER TABLE ONLY relation_members
1376     ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1377
1378
1379 --
1380 -- Name: relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1381 --
1382
1383 ALTER TABLE ONLY relation_tags
1384     ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1385
1386
1387 --
1388 -- Name: relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1389 --
1390
1391 ALTER TABLE ONLY relations
1392     ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1393
1394
1395 --
1396 -- Name: sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1397 --
1398
1399 ALTER TABLE ONLY sessions
1400     ADD CONSTRAINT sessions_pkey PRIMARY KEY (id);
1401
1402
1403 --
1404 -- Name: user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1405 --
1406
1407 ALTER TABLE ONLY user_blocks
1408     ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1409
1410
1411 --
1412 -- Name: user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1413 --
1414
1415 ALTER TABLE ONLY user_preferences
1416     ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1417
1418
1419 --
1420 -- Name: user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1421 --
1422
1423 ALTER TABLE ONLY user_roles
1424     ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1425
1426
1427 --
1428 -- Name: user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1429 --
1430
1431 ALTER TABLE ONLY user_tokens
1432     ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
1433
1434
1435 --
1436 -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1437 --
1438
1439 ALTER TABLE ONLY users
1440     ADD CONSTRAINT users_pkey PRIMARY KEY (id);
1441
1442
1443 --
1444 -- Name: way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1445 --
1446
1447 ALTER TABLE ONLY way_nodes
1448     ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
1449
1450
1451 --
1452 -- Name: way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1453 --
1454
1455 ALTER TABLE ONLY way_tags
1456     ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
1457
1458
1459 --
1460 -- Name: ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
1461 --
1462
1463 ALTER TABLE ONLY ways
1464     ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
1465
1466
1467 --
1468 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1469 --
1470
1471 CREATE INDEX acls_k_idx ON acls USING btree (k);
1472
1473
1474 --
1475 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1476 --
1477
1478 CREATE INDEX changeset_tags_id_idx ON changeset_tags USING btree (changeset_id);
1479
1480
1481 --
1482 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1483 --
1484
1485 CREATE INDEX changesets_bbox_idx ON changesets USING gist (min_lat, max_lat, min_lon, max_lon);
1486
1487
1488 --
1489 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1490 --
1491
1492 CREATE INDEX changesets_closed_at_idx ON changesets USING btree (closed_at);
1493
1494
1495 --
1496 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1497 --
1498
1499 CREATE INDEX changesets_created_at_idx ON changesets USING btree (created_at);
1500
1501
1502 --
1503 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1504 --
1505
1506 CREATE INDEX changesets_user_id_created_at_idx ON changesets USING btree (user_id, created_at);
1507
1508
1509 --
1510 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1511 --
1512
1513 CREATE INDEX changesets_user_id_id_idx ON changesets USING btree (user_id, id);
1514
1515
1516 --
1517 -- Name: countries_code_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1518 --
1519
1520 CREATE UNIQUE INDEX countries_code_idx ON countries USING btree (code);
1521
1522
1523 --
1524 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1525 --
1526
1527 CREATE INDEX current_nodes_tile_idx ON current_nodes USING btree (tile);
1528
1529
1530 --
1531 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1532 --
1533
1534 CREATE INDEX current_nodes_timestamp_idx ON current_nodes USING btree ("timestamp");
1535
1536
1537 --
1538 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1539 --
1540
1541 CREATE INDEX current_relation_members_member_idx ON current_relation_members USING btree (member_type, member_id);
1542
1543
1544 --
1545 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1546 --
1547
1548 CREATE INDEX current_relations_timestamp_idx ON current_relations USING btree ("timestamp");
1549
1550
1551 --
1552 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1553 --
1554
1555 CREATE INDEX current_way_nodes_node_idx ON current_way_nodes USING btree (node_id);
1556
1557
1558 --
1559 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1560 --
1561
1562 CREATE INDEX current_ways_timestamp_idx ON current_ways USING btree ("timestamp");
1563
1564
1565 --
1566 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1567 --
1568
1569 CREATE INDEX diary_comment_user_id_created_at_index ON diary_comments USING btree (user_id, created_at);
1570
1571
1572 --
1573 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1574 --
1575
1576 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON diary_comments USING btree (diary_entry_id, id);
1577
1578
1579 --
1580 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1581 --
1582
1583 CREATE INDEX diary_entry_created_at_index ON diary_entries USING btree (created_at);
1584
1585
1586 --
1587 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1588 --
1589
1590 CREATE INDEX diary_entry_language_code_created_at_index ON diary_entries USING btree (language_code, created_at);
1591
1592
1593 --
1594 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1595 --
1596
1597 CREATE INDEX diary_entry_user_id_created_at_index ON diary_entries USING btree (user_id, created_at);
1598
1599
1600 --
1601 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1602 --
1603
1604 CREATE INDEX friends_user_id_idx ON friends USING btree (user_id);
1605
1606
1607 --
1608 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1609 --
1610
1611 CREATE INDEX gpx_file_tags_gpxid_idx ON gpx_file_tags USING btree (gpx_id);
1612
1613
1614 --
1615 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1616 --
1617
1618 CREATE INDEX gpx_file_tags_tag_idx ON gpx_file_tags USING btree (tag);
1619
1620
1621 --
1622 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1623 --
1624
1625 CREATE INDEX gpx_files_timestamp_idx ON gpx_files USING btree ("timestamp");
1626
1627
1628 --
1629 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1630 --
1631
1632 CREATE INDEX gpx_files_user_id_idx ON gpx_files USING btree (user_id);
1633
1634
1635 --
1636 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1637 --
1638
1639 CREATE INDEX gpx_files_visible_visibility_idx ON gpx_files USING btree (visible, visibility);
1640
1641
1642 --
1643 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1644 --
1645
1646 CREATE UNIQUE INDEX index_client_applications_on_key ON client_applications USING btree (key);
1647
1648
1649 --
1650 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1651 --
1652
1653 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON oauth_nonces USING btree (nonce, "timestamp");
1654
1655
1656 --
1657 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1658 --
1659
1660 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON oauth_tokens USING btree (token);
1661
1662
1663 --
1664 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1665 --
1666
1667 CREATE INDEX index_user_blocks_on_user_id ON user_blocks USING btree (user_id);
1668
1669
1670 --
1671 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1672 --
1673
1674 CREATE INDEX messages_from_user_id_idx ON messages USING btree (from_user_id);
1675
1676
1677 --
1678 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1679 --
1680
1681 CREATE INDEX messages_to_user_id_idx ON messages USING btree (to_user_id);
1682
1683
1684 --
1685 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1686 --
1687
1688 CREATE INDEX nodes_changeset_id_idx ON nodes USING btree (changeset_id);
1689
1690
1691 --
1692 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1693 --
1694
1695 CREATE INDEX nodes_tile_idx ON nodes USING btree (tile);
1696
1697
1698 --
1699 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1700 --
1701
1702 CREATE INDEX nodes_timestamp_idx ON nodes USING btree ("timestamp");
1703
1704
1705 --
1706 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1707 --
1708
1709 CREATE INDEX points_gpxid_idx ON gps_points USING btree (gpx_id);
1710
1711
1712 --
1713 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1714 --
1715
1716 CREATE INDEX points_tile_idx ON gps_points USING btree (tile);
1717
1718
1719 --
1720 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1721 --
1722
1723 CREATE INDEX relation_members_member_idx ON relation_members USING btree (member_type, member_id);
1724
1725
1726 --
1727 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1728 --
1729
1730 CREATE INDEX relations_changeset_id_idx ON relations USING btree (changeset_id);
1731
1732
1733 --
1734 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1735 --
1736
1737 CREATE INDEX relations_timestamp_idx ON relations USING btree ("timestamp");
1738
1739
1740 --
1741 -- Name: sessions_session_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1742 --
1743
1744 CREATE UNIQUE INDEX sessions_session_id_idx ON sessions USING btree (session_id);
1745
1746
1747 --
1748 -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1749 --
1750
1751 CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
1752
1753
1754 --
1755 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1756 --
1757
1758 CREATE INDEX user_id_idx ON friends USING btree (friend_user_id);
1759
1760
1761 --
1762 -- Name: user_openid_url_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1763 --
1764
1765 CREATE UNIQUE INDEX user_openid_url_idx ON users USING btree (openid_url);
1766
1767
1768 --
1769 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1770 --
1771
1772 CREATE UNIQUE INDEX user_roles_id_role_unique ON user_roles USING btree (user_id, role);
1773
1774
1775 --
1776 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1777 --
1778
1779 CREATE UNIQUE INDEX user_tokens_token_idx ON user_tokens USING btree (token);
1780
1781
1782 --
1783 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1784 --
1785
1786 CREATE INDEX user_tokens_user_id_idx ON user_tokens USING btree (user_id);
1787
1788
1789 --
1790 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1791 --
1792
1793 CREATE UNIQUE INDEX users_display_name_idx ON users USING btree (display_name);
1794
1795
1796 --
1797 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1798 --
1799
1800 CREATE INDEX users_display_name_lower_idx ON users USING btree (lower((display_name)::text));
1801
1802
1803 --
1804 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1805 --
1806
1807 CREATE UNIQUE INDEX users_email_idx ON users USING btree (email);
1808
1809
1810 --
1811 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1812 --
1813
1814 CREATE INDEX users_email_lower_idx ON users USING btree (lower((email)::text));
1815
1816
1817 --
1818 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1819 --
1820
1821 CREATE INDEX way_nodes_node_idx ON way_nodes USING btree (node_id);
1822
1823
1824 --
1825 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1826 --
1827
1828 CREATE INDEX ways_changeset_id_idx ON ways USING btree (changeset_id);
1829
1830
1831 --
1832 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
1833 --
1834
1835 CREATE INDEX ways_timestamp_idx ON ways USING btree ("timestamp");
1836
1837
1838 --
1839 -- Name: changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1840 --
1841
1842 ALTER TABLE ONLY changeset_tags
1843     ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
1844
1845
1846 --
1847 -- Name: changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1848 --
1849
1850 ALTER TABLE ONLY changesets
1851     ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1852
1853
1854 --
1855 -- Name: client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1856 --
1857
1858 ALTER TABLE ONLY client_applications
1859     ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1860
1861
1862 --
1863 -- Name: current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1864 --
1865
1866 ALTER TABLE ONLY current_node_tags
1867     ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
1868
1869
1870 --
1871 -- Name: current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1872 --
1873
1874 ALTER TABLE ONLY current_nodes
1875     ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
1876
1877
1878 --
1879 -- Name: current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1880 --
1881
1882 ALTER TABLE ONLY current_relation_members
1883     ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
1884
1885
1886 --
1887 -- Name: current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1888 --
1889
1890 ALTER TABLE ONLY current_relation_tags
1891     ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
1892
1893
1894 --
1895 -- Name: current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1896 --
1897
1898 ALTER TABLE ONLY current_relations
1899     ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
1900
1901
1902 --
1903 -- Name: current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1904 --
1905
1906 ALTER TABLE ONLY current_way_nodes
1907     ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
1908
1909
1910 --
1911 -- Name: current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1912 --
1913
1914 ALTER TABLE ONLY current_way_nodes
1915     ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
1916
1917
1918 --
1919 -- Name: current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1920 --
1921
1922 ALTER TABLE ONLY current_way_tags
1923     ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
1924
1925
1926 --
1927 -- Name: current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1928 --
1929
1930 ALTER TABLE ONLY current_ways
1931     ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
1932
1933
1934 --
1935 -- Name: diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1936 --
1937
1938 ALTER TABLE ONLY diary_comments
1939     ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES diary_entries(id);
1940
1941
1942 --
1943 -- Name: diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1944 --
1945
1946 ALTER TABLE ONLY diary_comments
1947     ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1948
1949
1950 --
1951 -- Name: diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1952 --
1953
1954 ALTER TABLE ONLY diary_entries
1955     ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES languages(code);
1956
1957
1958 --
1959 -- Name: diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1960 --
1961
1962 ALTER TABLE ONLY diary_entries
1963     ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1964
1965
1966 --
1967 -- Name: friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1968 --
1969
1970 ALTER TABLE ONLY friends
1971     ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES users(id);
1972
1973
1974 --
1975 -- Name: friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1976 --
1977
1978 ALTER TABLE ONLY friends
1979     ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1980
1981
1982 --
1983 -- Name: gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1984 --
1985
1986 ALTER TABLE ONLY gps_points
1987     ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
1988
1989
1990 --
1991 -- Name: gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1992 --
1993
1994 ALTER TABLE ONLY gpx_file_tags
1995     ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
1996
1997
1998 --
1999 -- Name: gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2000 --
2001
2002 ALTER TABLE ONLY gpx_files
2003     ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2004
2005
2006 --
2007 -- Name: messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2008 --
2009
2010 ALTER TABLE ONLY messages
2011     ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES users(id);
2012
2013
2014 --
2015 -- Name: messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2016 --
2017
2018 ALTER TABLE ONLY messages
2019     ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES users(id);
2020
2021
2022 --
2023 -- Name: node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2024 --
2025
2026 ALTER TABLE ONLY node_tags
2027     ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES nodes(node_id, version);
2028
2029
2030 --
2031 -- Name: nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2032 --
2033
2034 ALTER TABLE ONLY nodes
2035     ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2036
2037
2038 --
2039 -- Name: oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2040 --
2041
2042 ALTER TABLE ONLY oauth_tokens
2043     ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES client_applications(id);
2044
2045
2046 --
2047 -- Name: oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2048 --
2049
2050 ALTER TABLE ONLY oauth_tokens
2051     ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2052
2053
2054 --
2055 -- Name: relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2056 --
2057
2058 ALTER TABLE ONLY relation_members
2059     ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2060
2061
2062 --
2063 -- Name: relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2064 --
2065
2066 ALTER TABLE ONLY relation_tags
2067     ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2068
2069
2070 --
2071 -- Name: relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2072 --
2073
2074 ALTER TABLE ONLY relations
2075     ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2076
2077
2078 --
2079 -- Name: user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2080 --
2081
2082 ALTER TABLE ONLY user_blocks
2083     ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES users(id);
2084
2085
2086 --
2087 -- Name: user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2088 --
2089
2090 ALTER TABLE ONLY user_blocks
2091     ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES users(id);
2092
2093
2094 --
2095 -- Name: user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2096 --
2097
2098 ALTER TABLE ONLY user_blocks
2099     ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2100
2101
2102 --
2103 -- Name: user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2104 --
2105
2106 ALTER TABLE ONLY user_preferences
2107     ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2108
2109
2110 --
2111 -- Name: user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2112 --
2113
2114 ALTER TABLE ONLY user_roles
2115     ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES users(id);
2116
2117
2118 --
2119 -- Name: user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2120 --
2121
2122 ALTER TABLE ONLY user_roles
2123     ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2124
2125
2126 --
2127 -- Name: user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2128 --
2129
2130 ALTER TABLE ONLY user_tokens
2131     ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2132
2133
2134 --
2135 -- Name: way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2136 --
2137
2138 ALTER TABLE ONLY way_nodes
2139     ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2140
2141
2142 --
2143 -- Name: way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2144 --
2145
2146 ALTER TABLE ONLY way_tags
2147     ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2148
2149
2150 --
2151 -- Name: ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2152 --
2153
2154 ALTER TABLE ONLY ways
2155     ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2156
2157
2158 --
2159 -- PostgreSQL database dump complete
2160 --
2161
2162 INSERT INTO schema_migrations (version) VALUES ('1');
2163
2164 INSERT INTO schema_migrations (version) VALUES ('10');
2165
2166 INSERT INTO schema_migrations (version) VALUES ('11');
2167
2168 INSERT INTO schema_migrations (version) VALUES ('12');
2169
2170 INSERT INTO schema_migrations (version) VALUES ('13');
2171
2172 INSERT INTO schema_migrations (version) VALUES ('14');
2173
2174 INSERT INTO schema_migrations (version) VALUES ('15');
2175
2176 INSERT INTO schema_migrations (version) VALUES ('16');
2177
2178 INSERT INTO schema_migrations (version) VALUES ('17');
2179
2180 INSERT INTO schema_migrations (version) VALUES ('18');
2181
2182 INSERT INTO schema_migrations (version) VALUES ('19');
2183
2184 INSERT INTO schema_migrations (version) VALUES ('2');
2185
2186 INSERT INTO schema_migrations (version) VALUES ('20');
2187
2188 INSERT INTO schema_migrations (version) VALUES ('20100513171259');
2189
2190 INSERT INTO schema_migrations (version) VALUES ('20100516124737');
2191
2192 INSERT INTO schema_migrations (version) VALUES ('20100910084426');
2193
2194 INSERT INTO schema_migrations (version) VALUES ('20101114011429');
2195
2196 INSERT INTO schema_migrations (version) VALUES ('20110322001319');
2197
2198 INSERT INTO schema_migrations (version) VALUES ('20110925112722');
2199
2200 INSERT INTO schema_migrations (version) VALUES ('20111116184519');
2201
2202 INSERT INTO schema_migrations (version) VALUES ('20111212183945');
2203
2204 INSERT INTO schema_migrations (version) VALUES ('20120123184321');
2205
2206 INSERT INTO schema_migrations (version) VALUES ('20120208122334');
2207
2208 INSERT INTO schema_migrations (version) VALUES ('20120208194454');
2209
2210 INSERT INTO schema_migrations (version) VALUES ('20120219161649');
2211
2212 INSERT INTO schema_migrations (version) VALUES ('21');
2213
2214 INSERT INTO schema_migrations (version) VALUES ('22');
2215
2216 INSERT INTO schema_migrations (version) VALUES ('23');
2217
2218 INSERT INTO schema_migrations (version) VALUES ('24');
2219
2220 INSERT INTO schema_migrations (version) VALUES ('25');
2221
2222 INSERT INTO schema_migrations (version) VALUES ('26');
2223
2224 INSERT INTO schema_migrations (version) VALUES ('27');
2225
2226 INSERT INTO schema_migrations (version) VALUES ('28');
2227
2228 INSERT INTO schema_migrations (version) VALUES ('29');
2229
2230 INSERT INTO schema_migrations (version) VALUES ('3');
2231
2232 INSERT INTO schema_migrations (version) VALUES ('30');
2233
2234 INSERT INTO schema_migrations (version) VALUES ('31');
2235
2236 INSERT INTO schema_migrations (version) VALUES ('32');
2237
2238 INSERT INTO schema_migrations (version) VALUES ('33');
2239
2240 INSERT INTO schema_migrations (version) VALUES ('34');
2241
2242 INSERT INTO schema_migrations (version) VALUES ('35');
2243
2244 INSERT INTO schema_migrations (version) VALUES ('36');
2245
2246 INSERT INTO schema_migrations (version) VALUES ('37');
2247
2248 INSERT INTO schema_migrations (version) VALUES ('38');
2249
2250 INSERT INTO schema_migrations (version) VALUES ('39');
2251
2252 INSERT INTO schema_migrations (version) VALUES ('4');
2253
2254 INSERT INTO schema_migrations (version) VALUES ('40');
2255
2256 INSERT INTO schema_migrations (version) VALUES ('41');
2257
2258 INSERT INTO schema_migrations (version) VALUES ('42');
2259
2260 INSERT INTO schema_migrations (version) VALUES ('43');
2261
2262 INSERT INTO schema_migrations (version) VALUES ('44');
2263
2264 INSERT INTO schema_migrations (version) VALUES ('45');
2265
2266 INSERT INTO schema_migrations (version) VALUES ('46');
2267
2268 INSERT INTO schema_migrations (version) VALUES ('47');
2269
2270 INSERT INTO schema_migrations (version) VALUES ('48');
2271
2272 INSERT INTO schema_migrations (version) VALUES ('49');
2273
2274 INSERT INTO schema_migrations (version) VALUES ('5');
2275
2276 INSERT INTO schema_migrations (version) VALUES ('50');
2277
2278 INSERT INTO schema_migrations (version) VALUES ('51');
2279
2280 INSERT INTO schema_migrations (version) VALUES ('52');
2281
2282 INSERT INTO schema_migrations (version) VALUES ('6');
2283
2284 INSERT INTO schema_migrations (version) VALUES ('7');
2285
2286 INSERT INTO schema_migrations (version) VALUES ('8');
2287
2288 INSERT INTO schema_migrations (version) VALUES ('9');