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