2 -- PostgreSQL database dump
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;
12 -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
15 CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
19 -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
22 COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
26 -- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: -
29 CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public;
33 -- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: -
36 COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST';
39 SET search_path = public, pg_catalog;
42 -- Name: format_enum; Type: TYPE; Schema: public; Owner: -
45 CREATE TYPE format_enum AS ENUM (
53 -- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: -
56 CREATE TYPE gpx_visibility_enum AS ENUM (
65 -- Name: note_event_enum; Type: TYPE; Schema: public; Owner: -
68 CREATE TYPE note_event_enum AS ENUM (
78 -- Name: note_status_enum; Type: TYPE; Schema: public; Owner: -
81 CREATE TYPE note_status_enum AS ENUM (
89 -- Name: nwr_enum; Type: TYPE; Schema: public; Owner: -
92 CREATE TYPE nwr_enum AS ENUM (
100 -- Name: user_role_enum; Type: TYPE; Schema: public; Owner: -
103 CREATE TYPE user_role_enum AS ENUM (
110 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
113 CREATE TYPE user_status_enum AS ENUM (
123 -- Name: maptile_for_point(bigint, bigint, integer); Type: FUNCTION; Schema: public; Owner: -
126 CREATE FUNCTION maptile_for_point(bigint, bigint, integer) RETURNS integer
128 AS '/srv/www/notes.osm.compton.nu/db/functions/libpgosm.so', 'maptile_for_point';
132 -- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
135 CREATE FUNCTION tile_for_point(integer, integer) RETURNS bigint
137 AS '/srv/www/notes.osm.compton.nu/db/functions/libpgosm.so', 'tile_for_point';
141 -- Name: xid_to_int4(xid); Type: FUNCTION; Schema: public; Owner: -
144 CREATE FUNCTION xid_to_int4(xid) RETURNS integer
145 LANGUAGE c IMMUTABLE STRICT
146 AS '/srv/www/notes.osm.compton.nu/db/functions/libpgosm.so', 'xid_to_int4';
149 SET default_tablespace = '';
151 SET default_with_oids = false;
154 -- Name: acls; Type: TABLE; Schema: public; Owner: -; Tablespace:
160 k character varying(255) NOT NULL,
161 v character varying(255),
162 domain character varying(255)
167 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
170 CREATE SEQUENCE acls_id_seq
179 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
182 ALTER SEQUENCE acls_id_seq OWNED BY acls.id;
186 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
189 CREATE TABLE changeset_tags (
190 changeset_id bigint NOT NULL,
191 k character varying(255) DEFAULT ''::character varying NOT NULL,
192 v character varying(255) DEFAULT ''::character varying NOT NULL
197 -- Name: changesets; Type: TABLE; Schema: public; Owner: -; Tablespace:
200 CREATE TABLE changesets (
202 user_id bigint NOT NULL,
203 created_at timestamp without time zone NOT NULL,
208 closed_at timestamp without time zone NOT NULL,
209 num_changes integer DEFAULT 0 NOT NULL
214 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
217 CREATE SEQUENCE changesets_id_seq
226 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
229 ALTER SEQUENCE changesets_id_seq OWNED BY changesets.id;
233 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -; Tablespace:
236 CREATE TABLE client_applications (
238 name character varying(255),
239 url character varying(255),
240 support_url character varying(255),
241 callback_url character varying(255),
242 key character varying(50),
243 secret character varying(50),
245 created_at timestamp without time zone NOT NULL,
246 updated_at timestamp without time zone NOT NULL,
247 allow_read_prefs boolean DEFAULT false NOT NULL,
248 allow_write_prefs boolean DEFAULT false NOT NULL,
249 allow_write_diary boolean DEFAULT false NOT NULL,
250 allow_write_api boolean DEFAULT false NOT NULL,
251 allow_read_gpx boolean DEFAULT false NOT NULL,
252 allow_write_gpx boolean DEFAULT false NOT NULL
257 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
260 CREATE SEQUENCE client_applications_id_seq
269 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
272 ALTER SEQUENCE client_applications_id_seq OWNED BY client_applications.id;
276 -- Name: countries; Type: TABLE; Schema: public; Owner: -; Tablespace:
279 CREATE TABLE countries (
281 code character varying(2) NOT NULL,
282 min_lat double precision NOT NULL,
283 max_lat double precision NOT NULL,
284 min_lon double precision NOT NULL,
285 max_lon double precision NOT NULL
290 -- Name: countries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
293 CREATE SEQUENCE countries_id_seq
302 -- Name: countries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
305 ALTER SEQUENCE countries_id_seq OWNED BY countries.id;
309 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
312 CREATE TABLE current_node_tags (
313 node_id bigint NOT NULL,
314 k character varying(255) DEFAULT ''::character varying NOT NULL,
315 v character varying(255) DEFAULT ''::character varying NOT NULL
320 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
323 CREATE TABLE current_nodes (
325 latitude integer NOT NULL,
326 longitude integer NOT NULL,
327 changeset_id bigint NOT NULL,
328 visible boolean NOT NULL,
329 "timestamp" timestamp without time zone NOT NULL,
330 tile bigint NOT NULL,
331 version bigint NOT NULL
336 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
339 CREATE SEQUENCE current_nodes_id_seq
348 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
351 ALTER SEQUENCE current_nodes_id_seq OWNED BY current_nodes.id;
355 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -; Tablespace:
358 CREATE TABLE current_relation_members (
359 relation_id bigint NOT NULL,
360 member_type nwr_enum NOT NULL,
361 member_id bigint NOT NULL,
362 member_role character varying(255) NOT NULL,
363 sequence_id integer DEFAULT 0 NOT NULL
368 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
371 CREATE TABLE current_relation_tags (
372 relation_id bigint NOT NULL,
373 k character varying(255) DEFAULT ''::character varying NOT NULL,
374 v character varying(255) DEFAULT ''::character varying NOT NULL
379 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -; Tablespace:
382 CREATE TABLE current_relations (
384 changeset_id bigint NOT NULL,
385 "timestamp" timestamp without time zone NOT NULL,
386 visible boolean NOT NULL,
387 version bigint NOT NULL
392 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
395 CREATE SEQUENCE current_relations_id_seq
404 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
407 ALTER SEQUENCE current_relations_id_seq OWNED BY current_relations.id;
411 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
414 CREATE TABLE current_way_nodes (
415 way_id bigint NOT NULL,
416 node_id bigint NOT NULL,
417 sequence_id bigint NOT NULL
422 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
425 CREATE TABLE current_way_tags (
426 way_id bigint NOT NULL,
427 k character varying(255) DEFAULT ''::character varying NOT NULL,
428 v character varying(255) DEFAULT ''::character varying NOT NULL
433 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -; Tablespace:
436 CREATE TABLE current_ways (
438 changeset_id bigint NOT NULL,
439 "timestamp" timestamp without time zone NOT NULL,
440 visible boolean NOT NULL,
441 version bigint NOT NULL
446 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
449 CREATE SEQUENCE current_ways_id_seq
458 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
461 ALTER SEQUENCE current_ways_id_seq OWNED BY current_ways.id;
465 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -; Tablespace:
468 CREATE TABLE diary_comments (
470 diary_entry_id bigint NOT NULL,
471 user_id bigint NOT NULL,
473 created_at timestamp without time zone NOT NULL,
474 updated_at timestamp without time zone NOT NULL,
475 visible boolean DEFAULT true NOT NULL,
476 body_format format_enum DEFAULT 'html'::format_enum NOT NULL
481 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
484 CREATE SEQUENCE diary_comments_id_seq
493 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
496 ALTER SEQUENCE diary_comments_id_seq OWNED BY diary_comments.id;
500 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -; Tablespace:
503 CREATE TABLE diary_entries (
505 user_id bigint NOT NULL,
506 title character varying(255) NOT NULL,
508 created_at timestamp without time zone NOT NULL,
509 updated_at timestamp without time zone NOT NULL,
510 latitude double precision,
511 longitude double precision,
512 language_code character varying(255) DEFAULT 'en'::character varying NOT NULL,
513 visible boolean DEFAULT true NOT NULL,
514 body_format format_enum DEFAULT 'html'::format_enum NOT NULL
519 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
522 CREATE SEQUENCE diary_entries_id_seq
531 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
534 ALTER SEQUENCE diary_entries_id_seq OWNED BY diary_entries.id;
538 -- Name: friends; Type: TABLE; Schema: public; Owner: -; Tablespace:
541 CREATE TABLE friends (
543 user_id bigint NOT NULL,
544 friend_user_id bigint NOT NULL
549 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
552 CREATE SEQUENCE friends_id_seq
561 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
564 ALTER SEQUENCE friends_id_seq OWNED BY friends.id;
568 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -; Tablespace:
571 CREATE TABLE gps_points (
572 altitude double precision,
573 trackid integer NOT NULL,
574 latitude integer NOT NULL,
575 longitude integer NOT NULL,
576 gpx_id bigint NOT NULL,
577 "timestamp" timestamp without time zone,
583 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
586 CREATE TABLE gpx_file_tags (
587 gpx_id bigint DEFAULT 0 NOT NULL,
588 tag character varying(255) NOT NULL,
594 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
597 CREATE SEQUENCE gpx_file_tags_id_seq
606 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
609 ALTER SEQUENCE gpx_file_tags_id_seq OWNED BY gpx_file_tags.id;
613 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -; Tablespace:
616 CREATE TABLE gpx_files (
618 user_id bigint NOT NULL,
619 visible boolean DEFAULT true NOT NULL,
620 name character varying(255) DEFAULT ''::character varying NOT NULL,
622 latitude double precision,
623 longitude double precision,
624 "timestamp" timestamp without time zone NOT NULL,
625 description character varying(255) DEFAULT ''::character varying NOT NULL,
626 inserted boolean NOT NULL,
627 visibility gpx_visibility_enum DEFAULT 'public'::gpx_visibility_enum NOT NULL
632 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
635 CREATE SEQUENCE gpx_files_id_seq
644 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
647 ALTER SEQUENCE gpx_files_id_seq OWNED BY gpx_files.id;
651 -- Name: languages; Type: TABLE; Schema: public; Owner: -; Tablespace:
654 CREATE TABLE languages (
655 code character varying(255) NOT NULL,
656 english_name character varying(255) NOT NULL,
657 native_name character varying(255)
662 -- Name: messages; Type: TABLE; Schema: public; Owner: -; Tablespace:
665 CREATE TABLE messages (
667 from_user_id bigint NOT NULL,
668 title character varying(255) NOT NULL,
670 sent_on timestamp without time zone NOT NULL,
671 message_read boolean DEFAULT false NOT NULL,
672 to_user_id bigint NOT NULL,
673 to_user_visible boolean DEFAULT true NOT NULL,
674 from_user_visible boolean DEFAULT true NOT NULL,
675 body_format format_enum DEFAULT 'html'::format_enum NOT NULL
680 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
683 CREATE SEQUENCE messages_id_seq
692 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
695 ALTER SEQUENCE messages_id_seq OWNED BY messages.id;
699 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
702 CREATE TABLE node_tags (
703 node_id bigint NOT NULL,
704 version bigint NOT NULL,
705 k character varying(255) DEFAULT ''::character varying NOT NULL,
706 v character varying(255) DEFAULT ''::character varying NOT NULL
711 -- Name: nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
715 node_id bigint NOT NULL,
716 latitude integer NOT NULL,
717 longitude integer NOT NULL,
718 changeset_id bigint NOT NULL,
719 visible boolean NOT NULL,
720 "timestamp" timestamp without time zone NOT NULL,
721 tile bigint NOT NULL,
722 version bigint NOT NULL,
728 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -; Tablespace:
731 CREATE TABLE note_comments (
733 note_id bigint NOT NULL,
734 visible boolean NOT NULL,
735 created_at timestamp without time zone NOT NULL,
736 author_name character varying(255),
737 author_ip character varying(255),
740 event note_event_enum
745 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
748 CREATE SEQUENCE note_comments_id_seq
757 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
760 ALTER SEQUENCE note_comments_id_seq OWNED BY note_comments.id;
764 -- Name: notes; Type: TABLE; Schema: public; Owner: -; Tablespace:
769 latitude integer NOT NULL,
770 longitude integer NOT NULL,
771 tile bigint NOT NULL,
772 updated_at timestamp without time zone NOT NULL,
773 created_at timestamp without time zone NOT NULL,
774 nearby_place character varying(255),
775 status note_status_enum NOT NULL,
776 closed_at timestamp without time zone
781 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
784 CREATE SEQUENCE notes_id_seq
793 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
796 ALTER SEQUENCE notes_id_seq OWNED BY notes.id;
800 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -; Tablespace:
803 CREATE TABLE oauth_nonces (
805 nonce character varying(255),
807 created_at timestamp without time zone NOT NULL,
808 updated_at timestamp without time zone NOT NULL
813 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
816 CREATE SEQUENCE oauth_nonces_id_seq
825 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
828 ALTER SEQUENCE oauth_nonces_id_seq OWNED BY oauth_nonces.id;
832 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -; Tablespace:
835 CREATE TABLE oauth_tokens (
838 type character varying(20),
839 client_application_id integer,
840 token character varying(50),
841 secret character varying(50),
842 authorized_at timestamp without time zone,
843 invalidated_at timestamp without time zone,
844 created_at timestamp without time zone NOT NULL,
845 updated_at timestamp without time zone NOT NULL,
846 allow_read_prefs boolean DEFAULT false NOT NULL,
847 allow_write_prefs boolean DEFAULT false NOT NULL,
848 allow_write_diary boolean DEFAULT false NOT NULL,
849 allow_write_api boolean DEFAULT false NOT NULL,
850 allow_read_gpx boolean DEFAULT false NOT NULL,
851 allow_write_gpx boolean DEFAULT false NOT NULL,
852 callback_url character varying(255),
853 verifier character varying(20),
854 scope character varying(255),
855 valid_to timestamp without time zone
860 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
863 CREATE SEQUENCE oauth_tokens_id_seq
872 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
875 ALTER SEQUENCE oauth_tokens_id_seq OWNED BY oauth_tokens.id;
879 -- Name: redactions; Type: TABLE; Schema: public; Owner: -; Tablespace:
882 CREATE TABLE redactions (
884 title character varying(255),
886 created_at timestamp without time zone NOT NULL,
887 updated_at timestamp without time zone NOT NULL,
888 user_id bigint NOT NULL,
889 description_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
894 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
897 CREATE SEQUENCE redactions_id_seq
906 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
909 ALTER SEQUENCE redactions_id_seq OWNED BY redactions.id;
913 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -; Tablespace:
916 CREATE TABLE relation_members (
917 relation_id bigint DEFAULT 0 NOT NULL,
918 member_type nwr_enum NOT NULL,
919 member_id bigint NOT NULL,
920 member_role character varying(255) NOT NULL,
921 version bigint DEFAULT 0 NOT NULL,
922 sequence_id integer DEFAULT 0 NOT NULL
927 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
930 CREATE TABLE relation_tags (
931 relation_id bigint DEFAULT 0 NOT NULL,
932 k character varying(255) DEFAULT ''::character varying NOT NULL,
933 v character varying(255) DEFAULT ''::character varying NOT NULL,
934 version bigint NOT NULL
939 -- Name: relations; Type: TABLE; Schema: public; Owner: -; Tablespace:
942 CREATE TABLE relations (
943 relation_id bigint DEFAULT 0 NOT NULL,
944 changeset_id bigint NOT NULL,
945 "timestamp" timestamp without time zone NOT NULL,
946 version bigint NOT NULL,
947 visible boolean DEFAULT true NOT NULL,
953 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace:
956 CREATE TABLE schema_migrations (
957 version character varying(255) NOT NULL
962 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -; Tablespace:
965 CREATE TABLE user_blocks (
967 user_id bigint NOT NULL,
968 creator_id bigint NOT NULL,
969 reason text NOT NULL,
970 ends_at timestamp without time zone NOT NULL,
971 needs_view boolean DEFAULT false NOT NULL,
973 created_at timestamp without time zone NOT NULL,
974 updated_at timestamp without time zone NOT NULL,
975 reason_format format_enum DEFAULT 'html'::format_enum NOT NULL
980 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
983 CREATE SEQUENCE user_blocks_id_seq
992 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
995 ALTER SEQUENCE user_blocks_id_seq OWNED BY user_blocks.id;
999 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -; Tablespace:
1002 CREATE TABLE user_preferences (
1003 user_id bigint NOT NULL,
1004 k character varying(255) NOT NULL,
1005 v character varying(255) NOT NULL
1010 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -; Tablespace:
1013 CREATE TABLE user_roles (
1014 id integer NOT NULL,
1015 user_id bigint NOT NULL,
1016 created_at timestamp without time zone NOT NULL,
1017 updated_at timestamp without time zone NOT NULL,
1018 role user_role_enum NOT NULL,
1019 granter_id bigint NOT NULL
1024 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1027 CREATE SEQUENCE user_roles_id_seq
1036 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1039 ALTER SEQUENCE user_roles_id_seq OWNED BY user_roles.id;
1043 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -; Tablespace:
1046 CREATE TABLE user_tokens (
1048 user_id bigint NOT NULL,
1049 token character varying(255) NOT NULL,
1050 expiry timestamp without time zone NOT NULL,
1056 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1059 CREATE SEQUENCE user_tokens_id_seq
1068 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1071 ALTER SEQUENCE user_tokens_id_seq OWNED BY user_tokens.id;
1075 -- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace:
1078 CREATE TABLE users (
1079 email character varying(255) NOT NULL,
1081 pass_crypt character varying(255) NOT NULL,
1082 creation_time timestamp without time zone NOT NULL,
1083 display_name character varying(255) DEFAULT ''::character varying NOT NULL,
1084 data_public boolean DEFAULT false NOT NULL,
1085 description text DEFAULT ''::text NOT NULL,
1086 home_lat double precision,
1087 home_lon double precision,
1088 home_zoom smallint DEFAULT 3,
1089 nearby integer DEFAULT 50,
1090 pass_salt character varying(255),
1091 image_file_name text,
1092 email_valid boolean DEFAULT false NOT NULL,
1093 new_email character varying(255),
1094 creation_ip character varying(255),
1095 languages character varying(255),
1096 status user_status_enum DEFAULT 'pending'::user_status_enum NOT NULL,
1097 terms_agreed timestamp without time zone,
1098 consider_pd boolean DEFAULT false NOT NULL,
1099 openid_url character varying(255),
1100 preferred_editor character varying(255),
1101 terms_seen boolean DEFAULT false NOT NULL,
1102 description_format format_enum DEFAULT 'html'::format_enum NOT NULL,
1103 image_fingerprint character varying(255),
1104 changesets_count integer DEFAULT 0 NOT NULL,
1105 traces_count integer DEFAULT 0 NOT NULL,
1106 diary_entries_count integer DEFAULT 0 NOT NULL,
1107 image_use_gravatar boolean DEFAULT true NOT NULL
1112 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1115 CREATE SEQUENCE users_id_seq
1124 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1127 ALTER SEQUENCE users_id_seq OWNED BY users.id;
1131 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
1134 CREATE TABLE way_nodes (
1135 way_id bigint NOT NULL,
1136 node_id bigint NOT NULL,
1137 version bigint NOT NULL,
1138 sequence_id bigint NOT NULL
1143 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
1146 CREATE TABLE way_tags (
1147 way_id bigint DEFAULT 0 NOT NULL,
1148 k character varying(255) NOT NULL,
1149 v character varying(255) NOT NULL,
1150 version bigint NOT NULL
1155 -- Name: ways; Type: TABLE; Schema: public; Owner: -; Tablespace:
1159 way_id bigint DEFAULT 0 NOT NULL,
1160 changeset_id bigint NOT NULL,
1161 "timestamp" timestamp without time zone NOT NULL,
1162 version bigint NOT NULL,
1163 visible boolean DEFAULT true NOT NULL,
1164 redaction_id integer
1169 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1172 ALTER TABLE ONLY acls ALTER COLUMN id SET DEFAULT nextval('acls_id_seq'::regclass);
1176 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1179 ALTER TABLE ONLY changesets ALTER COLUMN id SET DEFAULT nextval('changesets_id_seq'::regclass);
1183 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1186 ALTER TABLE ONLY client_applications ALTER COLUMN id SET DEFAULT nextval('client_applications_id_seq'::regclass);
1190 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1193 ALTER TABLE ONLY countries ALTER COLUMN id SET DEFAULT nextval('countries_id_seq'::regclass);
1197 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1200 ALTER TABLE ONLY current_nodes ALTER COLUMN id SET DEFAULT nextval('current_nodes_id_seq'::regclass);
1204 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1207 ALTER TABLE ONLY current_relations ALTER COLUMN id SET DEFAULT nextval('current_relations_id_seq'::regclass);
1211 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1214 ALTER TABLE ONLY current_ways ALTER COLUMN id SET DEFAULT nextval('current_ways_id_seq'::regclass);
1218 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1221 ALTER TABLE ONLY diary_comments ALTER COLUMN id SET DEFAULT nextval('diary_comments_id_seq'::regclass);
1225 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1228 ALTER TABLE ONLY diary_entries ALTER COLUMN id SET DEFAULT nextval('diary_entries_id_seq'::regclass);
1232 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1235 ALTER TABLE ONLY friends ALTER COLUMN id SET DEFAULT nextval('friends_id_seq'::regclass);
1239 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1242 ALTER TABLE ONLY gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('gpx_file_tags_id_seq'::regclass);
1246 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1249 ALTER TABLE ONLY gpx_files ALTER COLUMN id SET DEFAULT nextval('gpx_files_id_seq'::regclass);
1253 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1256 ALTER TABLE ONLY messages ALTER COLUMN id SET DEFAULT nextval('messages_id_seq'::regclass);
1260 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1263 ALTER TABLE ONLY note_comments ALTER COLUMN id SET DEFAULT nextval('note_comments_id_seq'::regclass);
1267 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1270 ALTER TABLE ONLY notes ALTER COLUMN id SET DEFAULT nextval('notes_id_seq'::regclass);
1274 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1277 ALTER TABLE ONLY oauth_nonces ALTER COLUMN id SET DEFAULT nextval('oauth_nonces_id_seq'::regclass);
1281 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1284 ALTER TABLE ONLY oauth_tokens ALTER COLUMN id SET DEFAULT nextval('oauth_tokens_id_seq'::regclass);
1288 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1291 ALTER TABLE ONLY redactions ALTER COLUMN id SET DEFAULT nextval('redactions_id_seq'::regclass);
1295 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1298 ALTER TABLE ONLY user_blocks ALTER COLUMN id SET DEFAULT nextval('user_blocks_id_seq'::regclass);
1302 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1305 ALTER TABLE ONLY user_roles ALTER COLUMN id SET DEFAULT nextval('user_roles_id_seq'::regclass);
1309 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1312 ALTER TABLE ONLY user_tokens ALTER COLUMN id SET DEFAULT nextval('user_tokens_id_seq'::regclass);
1316 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1319 ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
1323 -- Name: acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1326 ALTER TABLE ONLY acls
1327 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1331 -- Name: changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1334 ALTER TABLE ONLY changesets
1335 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1339 -- Name: client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1342 ALTER TABLE ONLY client_applications
1343 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1347 -- Name: countries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1350 ALTER TABLE ONLY countries
1351 ADD CONSTRAINT countries_pkey PRIMARY KEY (id);
1355 -- Name: current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1358 ALTER TABLE ONLY current_node_tags
1359 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1363 -- Name: current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1366 ALTER TABLE ONLY current_nodes
1367 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1371 -- Name: current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1374 ALTER TABLE ONLY current_relation_members
1375 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1379 -- Name: current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1382 ALTER TABLE ONLY current_relation_tags
1383 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1387 -- Name: current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1390 ALTER TABLE ONLY current_relations
1391 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1395 -- Name: current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1398 ALTER TABLE ONLY current_way_nodes
1399 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1403 -- Name: current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1406 ALTER TABLE ONLY current_way_tags
1407 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1411 -- Name: current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1414 ALTER TABLE ONLY current_ways
1415 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1419 -- Name: diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1422 ALTER TABLE ONLY diary_comments
1423 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1427 -- Name: diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1430 ALTER TABLE ONLY diary_entries
1431 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1435 -- Name: friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1438 ALTER TABLE ONLY friends
1439 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1443 -- Name: gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1446 ALTER TABLE ONLY gpx_file_tags
1447 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1451 -- Name: gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1454 ALTER TABLE ONLY gpx_files
1455 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1459 -- Name: languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1462 ALTER TABLE ONLY languages
1463 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1467 -- Name: messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1470 ALTER TABLE ONLY messages
1471 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1475 -- Name: node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1478 ALTER TABLE ONLY node_tags
1479 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1483 -- Name: nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1486 ALTER TABLE ONLY nodes
1487 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1491 -- Name: note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1494 ALTER TABLE ONLY note_comments
1495 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1499 -- Name: notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1502 ALTER TABLE ONLY notes
1503 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1507 -- Name: oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1510 ALTER TABLE ONLY oauth_nonces
1511 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1515 -- Name: oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1518 ALTER TABLE ONLY oauth_tokens
1519 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1523 -- Name: redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1526 ALTER TABLE ONLY redactions
1527 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1531 -- Name: relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1534 ALTER TABLE ONLY relation_members
1535 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1539 -- Name: relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1542 ALTER TABLE ONLY relation_tags
1543 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1547 -- Name: relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1550 ALTER TABLE ONLY relations
1551 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1555 -- Name: user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1558 ALTER TABLE ONLY user_blocks
1559 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1563 -- Name: user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1566 ALTER TABLE ONLY user_preferences
1567 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1571 -- Name: user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1574 ALTER TABLE ONLY user_roles
1575 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1579 -- Name: user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1582 ALTER TABLE ONLY user_tokens
1583 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
1587 -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1590 ALTER TABLE ONLY users
1591 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
1595 -- Name: way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1598 ALTER TABLE ONLY way_nodes
1599 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
1603 -- Name: way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1606 ALTER TABLE ONLY way_tags
1607 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
1611 -- Name: ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1614 ALTER TABLE ONLY ways
1615 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
1619 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1622 CREATE INDEX acls_k_idx ON acls USING btree (k);
1626 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1629 CREATE INDEX changeset_tags_id_idx ON changeset_tags USING btree (changeset_id);
1633 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1636 CREATE INDEX changesets_bbox_idx ON changesets USING gist (min_lat, max_lat, min_lon, max_lon);
1640 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1643 CREATE INDEX changesets_closed_at_idx ON changesets USING btree (closed_at);
1647 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1650 CREATE INDEX changesets_created_at_idx ON changesets USING btree (created_at);
1654 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1657 CREATE INDEX changesets_user_id_created_at_idx ON changesets USING btree (user_id, created_at);
1661 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1664 CREATE INDEX changesets_user_id_id_idx ON changesets USING btree (user_id, id);
1668 -- Name: countries_code_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1671 CREATE UNIQUE INDEX countries_code_idx ON countries USING btree (code);
1675 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1678 CREATE INDEX current_nodes_tile_idx ON current_nodes USING btree (tile);
1682 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1685 CREATE INDEX current_nodes_timestamp_idx ON current_nodes USING btree ("timestamp");
1689 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1692 CREATE INDEX current_relation_members_member_idx ON current_relation_members USING btree (member_type, member_id);
1696 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1699 CREATE INDEX current_relations_timestamp_idx ON current_relations USING btree ("timestamp");
1703 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1706 CREATE INDEX current_way_nodes_node_idx ON current_way_nodes USING btree (node_id);
1710 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1713 CREATE INDEX current_ways_timestamp_idx ON current_ways USING btree ("timestamp");
1717 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1720 CREATE INDEX diary_comment_user_id_created_at_index ON diary_comments USING btree (user_id, created_at);
1724 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1727 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON diary_comments USING btree (diary_entry_id, id);
1731 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1734 CREATE INDEX diary_entry_created_at_index ON diary_entries USING btree (created_at);
1738 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1741 CREATE INDEX diary_entry_language_code_created_at_index ON diary_entries USING btree (language_code, created_at);
1745 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1748 CREATE INDEX diary_entry_user_id_created_at_index ON diary_entries USING btree (user_id, created_at);
1752 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1755 CREATE INDEX friends_user_id_idx ON friends USING btree (user_id);
1759 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1762 CREATE INDEX gpx_file_tags_gpxid_idx ON gpx_file_tags USING btree (gpx_id);
1766 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1769 CREATE INDEX gpx_file_tags_tag_idx ON gpx_file_tags USING btree (tag);
1773 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1776 CREATE INDEX gpx_files_timestamp_idx ON gpx_files USING btree ("timestamp");
1780 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1783 CREATE INDEX gpx_files_user_id_idx ON gpx_files USING btree (user_id);
1787 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1790 CREATE INDEX gpx_files_visible_visibility_idx ON gpx_files USING btree (visible, visibility);
1794 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -; Tablespace:
1797 CREATE UNIQUE INDEX index_client_applications_on_key ON client_applications USING btree (key);
1801 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -; Tablespace:
1804 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON oauth_nonces USING btree (nonce, "timestamp");
1808 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -; Tablespace:
1811 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON oauth_tokens USING btree (token);
1815 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1818 CREATE INDEX index_user_blocks_on_user_id ON user_blocks USING btree (user_id);
1822 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1825 CREATE INDEX messages_from_user_id_idx ON messages USING btree (from_user_id);
1829 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1832 CREATE INDEX messages_to_user_id_idx ON messages USING btree (to_user_id);
1836 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1839 CREATE INDEX nodes_changeset_id_idx ON nodes USING btree (changeset_id);
1843 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1846 CREATE INDEX nodes_tile_idx ON nodes USING btree (tile);
1850 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1853 CREATE INDEX nodes_timestamp_idx ON nodes USING btree ("timestamp");
1857 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1860 CREATE INDEX note_comments_note_id_idx ON note_comments USING btree (note_id);
1864 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1867 CREATE INDEX notes_created_at_idx ON notes USING btree (created_at);
1871 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1874 CREATE INDEX notes_tile_status_idx ON notes USING btree (tile, status);
1878 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1881 CREATE INDEX notes_updated_at_idx ON notes USING btree (updated_at);
1885 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1888 CREATE INDEX points_gpxid_idx ON gps_points USING btree (gpx_id);
1892 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1895 CREATE INDEX points_tile_idx ON gps_points USING btree (tile);
1899 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1902 CREATE INDEX relation_members_member_idx ON relation_members USING btree (member_type, member_id);
1906 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1909 CREATE INDEX relations_changeset_id_idx ON relations USING btree (changeset_id);
1913 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1916 CREATE INDEX relations_timestamp_idx ON relations USING btree ("timestamp");
1920 -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
1923 CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
1927 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1930 CREATE INDEX user_id_idx ON friends USING btree (friend_user_id);
1934 -- Name: user_openid_url_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1937 CREATE UNIQUE INDEX user_openid_url_idx ON users USING btree (openid_url);
1941 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -; Tablespace:
1944 CREATE UNIQUE INDEX user_roles_id_role_unique ON user_roles USING btree (user_id, role);
1948 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1951 CREATE UNIQUE INDEX user_tokens_token_idx ON user_tokens USING btree (token);
1955 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1958 CREATE INDEX user_tokens_user_id_idx ON user_tokens USING btree (user_id);
1962 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1965 CREATE UNIQUE INDEX users_display_name_idx ON users USING btree (display_name);
1969 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1972 CREATE INDEX users_display_name_lower_idx ON users USING btree (lower((display_name)::text));
1976 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1979 CREATE UNIQUE INDEX users_email_idx ON users USING btree (email);
1983 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1986 CREATE INDEX users_email_lower_idx ON users USING btree (lower((email)::text));
1990 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1993 CREATE INDEX way_nodes_node_idx ON way_nodes USING btree (node_id);
1997 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2000 CREATE INDEX ways_changeset_id_idx ON ways USING btree (changeset_id);
2004 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2007 CREATE INDEX ways_timestamp_idx ON ways USING btree ("timestamp");
2011 -- Name: changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2014 ALTER TABLE ONLY changeset_tags
2015 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2019 -- Name: changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2022 ALTER TABLE ONLY changesets
2023 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2027 -- Name: client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2030 ALTER TABLE ONLY client_applications
2031 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2035 -- Name: current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2038 ALTER TABLE ONLY current_node_tags
2039 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
2043 -- Name: current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2046 ALTER TABLE ONLY current_nodes
2047 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2051 -- Name: current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2054 ALTER TABLE ONLY current_relation_members
2055 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
2059 -- Name: current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2062 ALTER TABLE ONLY current_relation_tags
2063 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
2067 -- Name: current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2070 ALTER TABLE ONLY current_relations
2071 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2075 -- Name: current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2078 ALTER TABLE ONLY current_way_nodes
2079 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
2083 -- Name: current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2086 ALTER TABLE ONLY current_way_nodes
2087 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
2091 -- Name: current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2094 ALTER TABLE ONLY current_way_tags
2095 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
2099 -- Name: current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2102 ALTER TABLE ONLY current_ways
2103 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2107 -- Name: diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2110 ALTER TABLE ONLY diary_comments
2111 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES diary_entries(id);
2115 -- Name: diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2118 ALTER TABLE ONLY diary_comments
2119 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2123 -- Name: diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2126 ALTER TABLE ONLY diary_entries
2127 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES languages(code);
2131 -- Name: diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2134 ALTER TABLE ONLY diary_entries
2135 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2139 -- Name: friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2142 ALTER TABLE ONLY friends
2143 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES users(id);
2147 -- Name: friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2150 ALTER TABLE ONLY friends
2151 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2155 -- Name: gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2158 ALTER TABLE ONLY gps_points
2159 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
2163 -- Name: gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2166 ALTER TABLE ONLY gpx_file_tags
2167 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
2171 -- Name: gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2174 ALTER TABLE ONLY gpx_files
2175 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2179 -- Name: messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2182 ALTER TABLE ONLY messages
2183 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES users(id);
2187 -- Name: messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2190 ALTER TABLE ONLY messages
2191 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES users(id);
2195 -- Name: node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2198 ALTER TABLE ONLY node_tags
2199 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES nodes(node_id, version);
2203 -- Name: nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2206 ALTER TABLE ONLY nodes
2207 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2211 -- Name: nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2214 ALTER TABLE ONLY nodes
2215 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2219 -- Name: note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2222 ALTER TABLE ONLY note_comments
2223 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES users(id);
2227 -- Name: note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2230 ALTER TABLE ONLY note_comments
2231 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES notes(id);
2235 -- Name: oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2238 ALTER TABLE ONLY oauth_tokens
2239 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES client_applications(id);
2243 -- Name: oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2246 ALTER TABLE ONLY oauth_tokens
2247 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2251 -- Name: redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2254 ALTER TABLE ONLY redactions
2255 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2259 -- Name: relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2262 ALTER TABLE ONLY relation_members
2263 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2267 -- Name: relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2270 ALTER TABLE ONLY relation_tags
2271 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2275 -- Name: relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2278 ALTER TABLE ONLY relations
2279 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2283 -- Name: relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2286 ALTER TABLE ONLY relations
2287 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2291 -- Name: user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2294 ALTER TABLE ONLY user_blocks
2295 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES users(id);
2299 -- Name: user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2302 ALTER TABLE ONLY user_blocks
2303 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES users(id);
2307 -- Name: user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2310 ALTER TABLE ONLY user_blocks
2311 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2315 -- Name: user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2318 ALTER TABLE ONLY user_preferences
2319 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2323 -- Name: user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2326 ALTER TABLE ONLY user_roles
2327 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES users(id);
2331 -- Name: user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2334 ALTER TABLE ONLY user_roles
2335 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2339 -- Name: user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2342 ALTER TABLE ONLY user_tokens
2343 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2347 -- Name: way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2350 ALTER TABLE ONLY way_nodes
2351 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2355 -- Name: way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2358 ALTER TABLE ONLY way_tags
2359 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2363 -- Name: ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2366 ALTER TABLE ONLY ways
2367 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2371 -- Name: ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2374 ALTER TABLE ONLY ways
2375 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2379 -- PostgreSQL database dump complete
2382 INSERT INTO schema_migrations (version) VALUES ('1');
2384 INSERT INTO schema_migrations (version) VALUES ('10');
2386 INSERT INTO schema_migrations (version) VALUES ('11');
2388 INSERT INTO schema_migrations (version) VALUES ('12');
2390 INSERT INTO schema_migrations (version) VALUES ('13');
2392 INSERT INTO schema_migrations (version) VALUES ('14');
2394 INSERT INTO schema_migrations (version) VALUES ('15');
2396 INSERT INTO schema_migrations (version) VALUES ('16');
2398 INSERT INTO schema_migrations (version) VALUES ('17');
2400 INSERT INTO schema_migrations (version) VALUES ('18');
2402 INSERT INTO schema_migrations (version) VALUES ('19');
2404 INSERT INTO schema_migrations (version) VALUES ('2');
2406 INSERT INTO schema_migrations (version) VALUES ('20');
2408 INSERT INTO schema_migrations (version) VALUES ('20100513171259');
2410 INSERT INTO schema_migrations (version) VALUES ('20100516124737');
2412 INSERT INTO schema_migrations (version) VALUES ('20100910084426');
2414 INSERT INTO schema_migrations (version) VALUES ('20101114011429');
2416 INSERT INTO schema_migrations (version) VALUES ('20110322001319');
2418 INSERT INTO schema_migrations (version) VALUES ('20110508145337');
2420 INSERT INTO schema_migrations (version) VALUES ('20110521142405');
2422 INSERT INTO schema_migrations (version) VALUES ('20110925112722');
2424 INSERT INTO schema_migrations (version) VALUES ('20111116184519');
2426 INSERT INTO schema_migrations (version) VALUES ('20111212183945');
2428 INSERT INTO schema_migrations (version) VALUES ('20120123184321');
2430 INSERT INTO schema_migrations (version) VALUES ('20120208122334');
2432 INSERT INTO schema_migrations (version) VALUES ('20120208194454');
2434 INSERT INTO schema_migrations (version) VALUES ('20120214210114');
2436 INSERT INTO schema_migrations (version) VALUES ('20120219161649');
2438 INSERT INTO schema_migrations (version) VALUES ('20120318201948');
2440 INSERT INTO schema_migrations (version) VALUES ('20120328090602');
2442 INSERT INTO schema_migrations (version) VALUES ('20120404205604');
2444 INSERT INTO schema_migrations (version) VALUES ('20120808231205');
2446 INSERT INTO schema_migrations (version) VALUES ('20121005195010');
2448 INSERT INTO schema_migrations (version) VALUES ('20121012044047');
2450 INSERT INTO schema_migrations (version) VALUES ('21');
2452 INSERT INTO schema_migrations (version) VALUES ('22');
2454 INSERT INTO schema_migrations (version) VALUES ('23');
2456 INSERT INTO schema_migrations (version) VALUES ('24');
2458 INSERT INTO schema_migrations (version) VALUES ('25');
2460 INSERT INTO schema_migrations (version) VALUES ('26');
2462 INSERT INTO schema_migrations (version) VALUES ('27');
2464 INSERT INTO schema_migrations (version) VALUES ('28');
2466 INSERT INTO schema_migrations (version) VALUES ('29');
2468 INSERT INTO schema_migrations (version) VALUES ('3');
2470 INSERT INTO schema_migrations (version) VALUES ('30');
2472 INSERT INTO schema_migrations (version) VALUES ('31');
2474 INSERT INTO schema_migrations (version) VALUES ('32');
2476 INSERT INTO schema_migrations (version) VALUES ('33');
2478 INSERT INTO schema_migrations (version) VALUES ('34');
2480 INSERT INTO schema_migrations (version) VALUES ('35');
2482 INSERT INTO schema_migrations (version) VALUES ('36');
2484 INSERT INTO schema_migrations (version) VALUES ('37');
2486 INSERT INTO schema_migrations (version) VALUES ('38');
2488 INSERT INTO schema_migrations (version) VALUES ('39');
2490 INSERT INTO schema_migrations (version) VALUES ('4');
2492 INSERT INTO schema_migrations (version) VALUES ('40');
2494 INSERT INTO schema_migrations (version) VALUES ('41');
2496 INSERT INTO schema_migrations (version) VALUES ('42');
2498 INSERT INTO schema_migrations (version) VALUES ('43');
2500 INSERT INTO schema_migrations (version) VALUES ('44');
2502 INSERT INTO schema_migrations (version) VALUES ('45');
2504 INSERT INTO schema_migrations (version) VALUES ('46');
2506 INSERT INTO schema_migrations (version) VALUES ('47');
2508 INSERT INTO schema_migrations (version) VALUES ('48');
2510 INSERT INTO schema_migrations (version) VALUES ('49');
2512 INSERT INTO schema_migrations (version) VALUES ('5');
2514 INSERT INTO schema_migrations (version) VALUES ('50');
2516 INSERT INTO schema_migrations (version) VALUES ('51');
2518 INSERT INTO schema_migrations (version) VALUES ('52');
2520 INSERT INTO schema_migrations (version) VALUES ('53');
2522 INSERT INTO schema_migrations (version) VALUES ('54');
2524 INSERT INTO schema_migrations (version) VALUES ('55');
2526 INSERT INTO schema_migrations (version) VALUES ('56');
2528 INSERT INTO schema_migrations (version) VALUES ('57');
2530 INSERT INTO schema_migrations (version) VALUES ('6');
2532 INSERT INTO schema_migrations (version) VALUES ('7');
2534 INSERT INTO schema_migrations (version) VALUES ('8');
2536 INSERT INTO schema_migrations (version) VALUES ('9');