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