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