2 -- PostgreSQL database dump
5 -- Dumped from database version 9.5.3
6 -- Dumped by pg_dump version 9.5.3
8 SET statement_timeout = 0;
10 SET client_encoding = 'UTF8';
11 SET standard_conforming_strings = on;
12 SET check_function_bodies = false;
13 SET client_min_messages = warning;
14 SET row_security = off;
17 -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
20 CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
24 -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
27 COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
31 -- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: -
34 CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public;
38 -- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: -
41 COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST';
44 SET search_path = public, pg_catalog;
47 -- Name: format_enum; Type: TYPE; Schema: public; Owner: -
50 CREATE TYPE format_enum AS ENUM (
58 -- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: -
61 CREATE TYPE gpx_visibility_enum AS ENUM (
70 -- Name: note_event_enum; Type: TYPE; Schema: public; Owner: -
73 CREATE TYPE note_event_enum AS ENUM (
83 -- Name: note_status_enum; Type: TYPE; Schema: public; Owner: -
86 CREATE TYPE note_status_enum AS ENUM (
94 -- Name: nwr_enum; Type: TYPE; Schema: public; Owner: -
97 CREATE TYPE nwr_enum AS ENUM (
105 -- Name: user_role_enum; Type: TYPE; Schema: public; Owner: -
108 CREATE TYPE user_role_enum AS ENUM (
115 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
118 CREATE TYPE user_status_enum AS ENUM (
128 -- Name: maptile_for_point(bigint, bigint, integer); Type: FUNCTION; Schema: public; Owner: -
131 CREATE FUNCTION maptile_for_point(bigint, bigint, integer) RETURNS integer
133 AS '$libdir/libpgosm', 'maptile_for_point';
137 -- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
140 CREATE FUNCTION tile_for_point(integer, integer) RETURNS bigint
142 AS '$libdir/libpgosm', 'tile_for_point';
146 -- Name: xid_to_int4(xid); Type: FUNCTION; Schema: public; Owner: -
149 CREATE FUNCTION xid_to_int4(xid) RETURNS integer
150 LANGUAGE c IMMUTABLE STRICT
151 AS '$libdir/libpgosm', 'xid_to_int4';
154 SET default_tablespace = '';
156 SET default_with_oids = false;
159 -- Name: acls; Type: TABLE; Schema: public; Owner: -
165 k character varying(255) NOT NULL,
166 v character varying(255),
167 domain character varying(255)
172 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
175 CREATE SEQUENCE acls_id_seq
184 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
187 ALTER SEQUENCE acls_id_seq OWNED BY acls.id;
191 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
194 CREATE TABLE changeset_comments (
196 changeset_id bigint NOT NULL,
197 author_id bigint NOT NULL,
199 created_at timestamp without time zone NOT NULL,
200 visible boolean NOT NULL
205 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
208 CREATE SEQUENCE changeset_comments_id_seq
217 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
220 ALTER SEQUENCE changeset_comments_id_seq OWNED BY changeset_comments.id;
224 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
227 CREATE TABLE changeset_tags (
228 changeset_id bigint NOT NULL,
229 k character varying(255) DEFAULT ''::character varying NOT NULL,
230 v character varying(255) DEFAULT ''::character varying NOT NULL
235 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
238 CREATE TABLE changesets (
240 user_id bigint NOT NULL,
241 created_at timestamp without time zone NOT NULL,
246 closed_at timestamp without time zone NOT NULL,
247 num_changes integer DEFAULT 0 NOT NULL
252 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
255 CREATE SEQUENCE changesets_id_seq
264 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
267 ALTER SEQUENCE changesets_id_seq OWNED BY changesets.id;
271 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
274 CREATE TABLE changesets_subscribers (
275 subscriber_id bigint NOT NULL,
276 changeset_id bigint NOT NULL
281 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
284 CREATE TABLE client_applications (
286 name character varying(255),
287 url character varying(255),
288 support_url character varying(255),
289 callback_url character varying(255),
290 key character varying(50),
291 secret character varying(50),
293 created_at timestamp without time zone,
294 updated_at timestamp without time zone,
295 allow_read_prefs boolean DEFAULT false NOT NULL,
296 allow_write_prefs boolean DEFAULT false NOT NULL,
297 allow_write_diary boolean DEFAULT false NOT NULL,
298 allow_write_api boolean DEFAULT false NOT NULL,
299 allow_read_gpx boolean DEFAULT false NOT NULL,
300 allow_write_gpx boolean DEFAULT false NOT NULL,
301 allow_write_notes boolean DEFAULT false NOT NULL
306 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
309 CREATE SEQUENCE client_applications_id_seq
318 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
321 ALTER SEQUENCE client_applications_id_seq OWNED BY client_applications.id;
325 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
328 CREATE TABLE current_node_tags (
329 node_id bigint NOT NULL,
330 k character varying(255) DEFAULT ''::character varying NOT NULL,
331 v character varying(255) DEFAULT ''::character varying NOT NULL
336 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
339 CREATE TABLE current_nodes (
341 latitude integer NOT NULL,
342 longitude integer NOT NULL,
343 changeset_id bigint NOT NULL,
344 visible boolean NOT NULL,
345 "timestamp" timestamp without time zone NOT NULL,
346 tile bigint NOT NULL,
347 version bigint NOT NULL
352 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
355 CREATE SEQUENCE current_nodes_id_seq
364 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
367 ALTER SEQUENCE current_nodes_id_seq OWNED BY current_nodes.id;
371 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
374 CREATE TABLE current_relation_members (
375 relation_id bigint NOT NULL,
376 member_type nwr_enum NOT NULL,
377 member_id bigint NOT NULL,
378 member_role character varying(255) NOT NULL,
379 sequence_id integer DEFAULT 0 NOT NULL
384 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
387 CREATE TABLE current_relation_tags (
388 relation_id bigint NOT NULL,
389 k character varying(255) DEFAULT ''::character varying NOT NULL,
390 v character varying(255) DEFAULT ''::character varying NOT NULL
395 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
398 CREATE TABLE current_relations (
400 changeset_id bigint NOT NULL,
401 "timestamp" timestamp without time zone NOT NULL,
402 visible boolean NOT NULL,
403 version bigint NOT NULL
408 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
411 CREATE SEQUENCE current_relations_id_seq
420 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
423 ALTER SEQUENCE current_relations_id_seq OWNED BY current_relations.id;
427 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
430 CREATE TABLE current_way_nodes (
431 way_id bigint NOT NULL,
432 node_id bigint NOT NULL,
433 sequence_id bigint NOT NULL
438 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
441 CREATE TABLE current_way_tags (
442 way_id bigint NOT NULL,
443 k character varying(255) DEFAULT ''::character varying NOT NULL,
444 v character varying(255) DEFAULT ''::character varying NOT NULL
449 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
452 CREATE TABLE current_ways (
454 changeset_id bigint NOT NULL,
455 "timestamp" timestamp without time zone NOT NULL,
456 visible boolean NOT NULL,
457 version bigint NOT NULL
462 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
465 CREATE SEQUENCE current_ways_id_seq
474 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
477 ALTER SEQUENCE current_ways_id_seq OWNED BY current_ways.id;
481 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
484 CREATE TABLE diary_comments (
486 diary_entry_id bigint NOT NULL,
487 user_id bigint NOT NULL,
489 created_at timestamp without time zone NOT NULL,
490 updated_at timestamp without time zone NOT NULL,
491 visible boolean DEFAULT true NOT NULL,
492 body_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
497 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
500 CREATE SEQUENCE diary_comments_id_seq
509 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
512 ALTER SEQUENCE diary_comments_id_seq OWNED BY diary_comments.id;
516 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
519 CREATE TABLE diary_entries (
521 user_id bigint NOT NULL,
522 title character varying(255) NOT NULL,
524 created_at timestamp without time zone NOT NULL,
525 updated_at timestamp without time zone NOT NULL,
526 latitude double precision,
527 longitude double precision,
528 language_code character varying(255) DEFAULT 'en'::character varying NOT NULL,
529 visible boolean DEFAULT true NOT NULL,
530 body_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
535 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
538 CREATE SEQUENCE diary_entries_id_seq
547 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
550 ALTER SEQUENCE diary_entries_id_seq OWNED BY diary_entries.id;
554 -- Name: friends; Type: TABLE; Schema: public; Owner: -
557 CREATE TABLE friends (
559 user_id bigint NOT NULL,
560 friend_user_id bigint NOT NULL
565 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
568 CREATE SEQUENCE friends_id_seq
577 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
580 ALTER SEQUENCE friends_id_seq OWNED BY friends.id;
584 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
587 CREATE TABLE gps_points (
588 altitude double precision,
589 trackid integer NOT NULL,
590 latitude integer NOT NULL,
591 longitude integer NOT NULL,
592 gpx_id bigint NOT NULL,
593 "timestamp" timestamp without time zone,
599 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
602 CREATE TABLE gpx_file_tags (
603 gpx_id bigint DEFAULT 0 NOT NULL,
604 tag character varying(255) NOT NULL,
610 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
613 CREATE SEQUENCE gpx_file_tags_id_seq
622 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
625 ALTER SEQUENCE gpx_file_tags_id_seq OWNED BY gpx_file_tags.id;
629 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
632 CREATE TABLE gpx_files (
634 user_id bigint NOT NULL,
635 visible boolean DEFAULT true NOT NULL,
636 name character varying(255) DEFAULT ''::character varying NOT NULL,
638 latitude double precision,
639 longitude double precision,
640 "timestamp" timestamp without time zone NOT NULL,
641 description character varying(255) DEFAULT ''::character varying NOT NULL,
642 inserted boolean NOT NULL,
643 visibility gpx_visibility_enum DEFAULT 'public'::gpx_visibility_enum NOT NULL
648 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
651 CREATE SEQUENCE gpx_files_id_seq
660 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
663 ALTER SEQUENCE gpx_files_id_seq OWNED BY gpx_files.id;
667 -- Name: languages; Type: TABLE; Schema: public; Owner: -
670 CREATE TABLE languages (
671 code character varying(255) NOT NULL,
672 english_name character varying(255) NOT NULL,
673 native_name character varying(255)
678 -- Name: messages; Type: TABLE; Schema: public; Owner: -
681 CREATE TABLE messages (
683 from_user_id bigint NOT NULL,
684 title character varying(255) NOT NULL,
686 sent_on timestamp without time zone NOT NULL,
687 message_read boolean DEFAULT false NOT NULL,
688 to_user_id bigint NOT NULL,
689 to_user_visible boolean DEFAULT true NOT NULL,
690 from_user_visible boolean DEFAULT true NOT NULL,
691 body_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
696 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
699 CREATE SEQUENCE messages_id_seq
708 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
711 ALTER SEQUENCE messages_id_seq OWNED BY messages.id;
715 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
718 CREATE TABLE node_tags (
719 node_id bigint NOT NULL,
720 version bigint NOT NULL,
721 k character varying(255) DEFAULT ''::character varying NOT NULL,
722 v character varying(255) DEFAULT ''::character varying NOT NULL
727 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
731 node_id bigint NOT NULL,
732 latitude integer NOT NULL,
733 longitude integer NOT NULL,
734 changeset_id bigint NOT NULL,
735 visible boolean NOT NULL,
736 "timestamp" timestamp without time zone NOT NULL,
737 tile bigint NOT NULL,
738 version bigint NOT NULL,
744 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
747 CREATE TABLE note_comments (
749 note_id bigint NOT NULL,
750 visible boolean NOT NULL,
751 created_at timestamp without time zone NOT NULL,
755 event note_event_enum
760 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
763 CREATE SEQUENCE note_comments_id_seq
772 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
775 ALTER SEQUENCE note_comments_id_seq OWNED BY note_comments.id;
779 -- Name: notes; Type: TABLE; Schema: public; Owner: -
784 latitude integer NOT NULL,
785 longitude integer NOT NULL,
786 tile bigint NOT NULL,
787 updated_at timestamp without time zone NOT NULL,
788 created_at timestamp without time zone NOT NULL,
789 status note_status_enum NOT NULL,
790 closed_at timestamp without time zone
795 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
798 CREATE SEQUENCE notes_id_seq
807 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
810 ALTER SEQUENCE notes_id_seq OWNED BY notes.id;
814 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
817 CREATE TABLE oauth_nonces (
819 nonce character varying(255),
821 created_at timestamp without time zone,
822 updated_at timestamp without time zone
827 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
830 CREATE SEQUENCE oauth_nonces_id_seq
839 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
842 ALTER SEQUENCE oauth_nonces_id_seq OWNED BY oauth_nonces.id;
846 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
849 CREATE TABLE oauth_tokens (
852 type character varying(20),
853 client_application_id integer,
854 token character varying(50),
855 secret character varying(50),
856 authorized_at timestamp without time zone,
857 invalidated_at timestamp without time zone,
858 created_at timestamp without time zone,
859 updated_at timestamp without time zone,
860 allow_read_prefs boolean DEFAULT false NOT NULL,
861 allow_write_prefs boolean DEFAULT false NOT NULL,
862 allow_write_diary boolean DEFAULT false NOT NULL,
863 allow_write_api boolean DEFAULT false NOT NULL,
864 allow_read_gpx boolean DEFAULT false NOT NULL,
865 allow_write_gpx boolean DEFAULT false NOT NULL,
866 callback_url character varying(255),
867 verifier character varying(20),
868 scope character varying(255),
869 valid_to timestamp without time zone,
870 allow_write_notes boolean DEFAULT false NOT NULL
875 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
878 CREATE SEQUENCE oauth_tokens_id_seq
887 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
890 ALTER SEQUENCE oauth_tokens_id_seq OWNED BY oauth_tokens.id;
894 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
897 CREATE TABLE redactions (
899 title character varying(255),
901 created_at timestamp without time zone NOT NULL,
902 updated_at timestamp without time zone NOT NULL,
903 user_id bigint NOT NULL,
904 description_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
909 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
912 CREATE SEQUENCE redactions_id_seq
921 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
924 ALTER SEQUENCE redactions_id_seq OWNED BY redactions.id;
928 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
931 CREATE TABLE relation_members (
932 relation_id bigint DEFAULT 0 NOT NULL,
933 member_type nwr_enum NOT NULL,
934 member_id bigint NOT NULL,
935 member_role character varying(255) NOT NULL,
936 version bigint DEFAULT 0 NOT NULL,
937 sequence_id integer DEFAULT 0 NOT NULL
942 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
945 CREATE TABLE relation_tags (
946 relation_id bigint DEFAULT 0 NOT NULL,
947 k character varying(255) DEFAULT ''::character varying NOT NULL,
948 v character varying(255) DEFAULT ''::character varying NOT NULL,
949 version bigint NOT NULL
954 -- Name: relations; Type: TABLE; Schema: public; Owner: -
957 CREATE TABLE relations (
958 relation_id bigint DEFAULT 0 NOT NULL,
959 changeset_id bigint NOT NULL,
960 "timestamp" timestamp without time zone NOT NULL,
961 version bigint NOT NULL,
962 visible boolean DEFAULT true NOT NULL,
968 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
971 CREATE TABLE schema_migrations (
972 version character varying(255) NOT NULL
977 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
980 CREATE TABLE user_blocks (
982 user_id bigint NOT NULL,
983 creator_id bigint NOT NULL,
984 reason text NOT NULL,
985 ends_at timestamp without time zone NOT NULL,
986 needs_view boolean DEFAULT false NOT NULL,
988 created_at timestamp without time zone,
989 updated_at timestamp without time zone,
990 reason_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
995 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
998 CREATE SEQUENCE user_blocks_id_seq
1007 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1010 ALTER SEQUENCE user_blocks_id_seq OWNED BY user_blocks.id;
1014 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1017 CREATE TABLE user_preferences (
1018 user_id bigint NOT NULL,
1019 k character varying(255) NOT NULL,
1020 v character varying(255) NOT NULL
1025 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1028 CREATE TABLE user_roles (
1029 id integer NOT NULL,
1030 user_id bigint NOT NULL,
1031 created_at timestamp without time zone,
1032 updated_at timestamp without time zone,
1033 role user_role_enum NOT NULL,
1034 granter_id bigint NOT NULL
1039 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1042 CREATE SEQUENCE user_roles_id_seq
1051 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1054 ALTER SEQUENCE user_roles_id_seq OWNED BY user_roles.id;
1058 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1061 CREATE TABLE user_tokens (
1063 user_id bigint NOT NULL,
1064 token character varying(255) NOT NULL,
1065 expiry timestamp without time zone NOT NULL,
1071 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1074 CREATE SEQUENCE user_tokens_id_seq
1083 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1086 ALTER SEQUENCE user_tokens_id_seq OWNED BY user_tokens.id;
1090 -- Name: users; Type: TABLE; Schema: public; Owner: -
1093 CREATE TABLE users (
1094 email character varying(255) NOT NULL,
1096 pass_crypt character varying(255) NOT NULL,
1097 creation_time timestamp without time zone NOT NULL,
1098 display_name character varying(255) DEFAULT ''::character varying NOT NULL,
1099 data_public boolean DEFAULT false NOT NULL,
1100 description text DEFAULT ''::text NOT NULL,
1101 home_lat double precision,
1102 home_lon double precision,
1103 home_zoom smallint DEFAULT 3,
1104 nearby integer DEFAULT 50,
1105 pass_salt character varying(255),
1106 image_file_name text,
1107 email_valid boolean DEFAULT false NOT NULL,
1108 new_email character varying(255),
1109 creation_ip character varying(255),
1110 languages character varying(255),
1111 status user_status_enum DEFAULT 'pending'::user_status_enum NOT NULL,
1112 terms_agreed timestamp without time zone,
1113 consider_pd boolean DEFAULT false NOT NULL,
1114 preferred_editor character varying(255),
1115 terms_seen boolean DEFAULT false NOT NULL,
1116 auth_uid character varying(255),
1117 description_format format_enum DEFAULT 'markdown'::format_enum NOT NULL,
1118 image_fingerprint character varying(255),
1119 changesets_count integer DEFAULT 0 NOT NULL,
1120 traces_count integer DEFAULT 0 NOT NULL,
1121 diary_entries_count integer DEFAULT 0 NOT NULL,
1122 image_use_gravatar boolean DEFAULT false NOT NULL,
1123 image_content_type character varying(255),
1124 auth_provider character varying
1129 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1132 CREATE SEQUENCE users_id_seq
1141 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1144 ALTER SEQUENCE users_id_seq OWNED BY users.id;
1148 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1151 CREATE TABLE way_nodes (
1152 way_id bigint NOT NULL,
1153 node_id bigint NOT NULL,
1154 version bigint NOT NULL,
1155 sequence_id bigint NOT NULL
1160 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1163 CREATE TABLE way_tags (
1164 way_id bigint DEFAULT 0 NOT NULL,
1165 k character varying(255) NOT NULL,
1166 v character varying(255) NOT NULL,
1167 version bigint NOT NULL
1172 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1176 way_id bigint DEFAULT 0 NOT NULL,
1177 changeset_id bigint NOT NULL,
1178 "timestamp" timestamp without time zone NOT NULL,
1179 version bigint NOT NULL,
1180 visible boolean DEFAULT true NOT NULL,
1181 redaction_id integer
1186 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1189 ALTER TABLE ONLY acls ALTER COLUMN id SET DEFAULT nextval('acls_id_seq'::regclass);
1193 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1196 ALTER TABLE ONLY changeset_comments ALTER COLUMN id SET DEFAULT nextval('changeset_comments_id_seq'::regclass);
1200 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1203 ALTER TABLE ONLY changesets ALTER COLUMN id SET DEFAULT nextval('changesets_id_seq'::regclass);
1207 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1210 ALTER TABLE ONLY client_applications ALTER COLUMN id SET DEFAULT nextval('client_applications_id_seq'::regclass);
1214 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1217 ALTER TABLE ONLY current_nodes ALTER COLUMN id SET DEFAULT nextval('current_nodes_id_seq'::regclass);
1221 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1224 ALTER TABLE ONLY current_relations ALTER COLUMN id SET DEFAULT nextval('current_relations_id_seq'::regclass);
1228 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1231 ALTER TABLE ONLY current_ways ALTER COLUMN id SET DEFAULT nextval('current_ways_id_seq'::regclass);
1235 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1238 ALTER TABLE ONLY diary_comments ALTER COLUMN id SET DEFAULT nextval('diary_comments_id_seq'::regclass);
1242 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1245 ALTER TABLE ONLY diary_entries ALTER COLUMN id SET DEFAULT nextval('diary_entries_id_seq'::regclass);
1249 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1252 ALTER TABLE ONLY friends ALTER COLUMN id SET DEFAULT nextval('friends_id_seq'::regclass);
1256 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1259 ALTER TABLE ONLY gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('gpx_file_tags_id_seq'::regclass);
1263 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1266 ALTER TABLE ONLY gpx_files ALTER COLUMN id SET DEFAULT nextval('gpx_files_id_seq'::regclass);
1270 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1273 ALTER TABLE ONLY messages ALTER COLUMN id SET DEFAULT nextval('messages_id_seq'::regclass);
1277 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1280 ALTER TABLE ONLY note_comments ALTER COLUMN id SET DEFAULT nextval('note_comments_id_seq'::regclass);
1284 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1287 ALTER TABLE ONLY notes ALTER COLUMN id SET DEFAULT nextval('notes_id_seq'::regclass);
1291 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1294 ALTER TABLE ONLY oauth_nonces ALTER COLUMN id SET DEFAULT nextval('oauth_nonces_id_seq'::regclass);
1298 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1301 ALTER TABLE ONLY oauth_tokens ALTER COLUMN id SET DEFAULT nextval('oauth_tokens_id_seq'::regclass);
1305 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1308 ALTER TABLE ONLY redactions ALTER COLUMN id SET DEFAULT nextval('redactions_id_seq'::regclass);
1312 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1315 ALTER TABLE ONLY user_blocks ALTER COLUMN id SET DEFAULT nextval('user_blocks_id_seq'::regclass);
1319 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1322 ALTER TABLE ONLY user_roles ALTER COLUMN id SET DEFAULT nextval('user_roles_id_seq'::regclass);
1326 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1329 ALTER TABLE ONLY user_tokens ALTER COLUMN id SET DEFAULT nextval('user_tokens_id_seq'::regclass);
1333 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1336 ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
1340 -- Name: acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1343 ALTER TABLE ONLY acls
1344 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1348 -- Name: changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1351 ALTER TABLE ONLY changeset_comments
1352 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1356 -- Name: changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1359 ALTER TABLE ONLY changesets
1360 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1364 -- Name: client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1367 ALTER TABLE ONLY client_applications
1368 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1372 -- Name: current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1375 ALTER TABLE ONLY current_node_tags
1376 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1380 -- Name: current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1383 ALTER TABLE ONLY current_nodes
1384 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1388 -- Name: current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1391 ALTER TABLE ONLY current_relation_members
1392 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1396 -- Name: current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1399 ALTER TABLE ONLY current_relation_tags
1400 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1404 -- Name: current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1407 ALTER TABLE ONLY current_relations
1408 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1412 -- Name: current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1415 ALTER TABLE ONLY current_way_nodes
1416 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1420 -- Name: current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1423 ALTER TABLE ONLY current_way_tags
1424 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1428 -- Name: current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1431 ALTER TABLE ONLY current_ways
1432 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1436 -- Name: diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1439 ALTER TABLE ONLY diary_comments
1440 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1444 -- Name: diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1447 ALTER TABLE ONLY diary_entries
1448 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1452 -- Name: friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1455 ALTER TABLE ONLY friends
1456 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1460 -- Name: gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1463 ALTER TABLE ONLY gpx_file_tags
1464 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1468 -- Name: gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1471 ALTER TABLE ONLY gpx_files
1472 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1476 -- Name: languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1479 ALTER TABLE ONLY languages
1480 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1484 -- Name: messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1487 ALTER TABLE ONLY messages
1488 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1492 -- Name: node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1495 ALTER TABLE ONLY node_tags
1496 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1500 -- Name: nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1503 ALTER TABLE ONLY nodes
1504 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1508 -- Name: note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1511 ALTER TABLE ONLY note_comments
1512 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1516 -- Name: notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1519 ALTER TABLE ONLY notes
1520 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1524 -- Name: oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1527 ALTER TABLE ONLY oauth_nonces
1528 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1532 -- Name: oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1535 ALTER TABLE ONLY oauth_tokens
1536 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1540 -- Name: redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1543 ALTER TABLE ONLY redactions
1544 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1548 -- Name: relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1551 ALTER TABLE ONLY relation_members
1552 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1556 -- Name: relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1559 ALTER TABLE ONLY relation_tags
1560 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1564 -- Name: relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1567 ALTER TABLE ONLY relations
1568 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1572 -- Name: user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1575 ALTER TABLE ONLY user_blocks
1576 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1580 -- Name: user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1583 ALTER TABLE ONLY user_preferences
1584 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1588 -- Name: user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1591 ALTER TABLE ONLY user_roles
1592 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1596 -- Name: user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1599 ALTER TABLE ONLY user_tokens
1600 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
1604 -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1607 ALTER TABLE ONLY users
1608 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
1612 -- Name: way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1615 ALTER TABLE ONLY way_nodes
1616 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
1620 -- Name: way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1623 ALTER TABLE ONLY way_tags
1624 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
1628 -- Name: ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1631 ALTER TABLE ONLY ways
1632 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
1636 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
1639 CREATE INDEX acls_k_idx ON acls USING btree (k);
1643 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
1646 CREATE INDEX changeset_tags_id_idx ON changeset_tags USING btree (changeset_id);
1650 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
1653 CREATE INDEX changesets_bbox_idx ON changesets USING gist (min_lat, max_lat, min_lon, max_lon);
1657 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
1660 CREATE INDEX changesets_closed_at_idx ON changesets USING btree (closed_at);
1664 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
1667 CREATE INDEX changesets_created_at_idx ON changesets USING btree (created_at);
1671 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
1674 CREATE INDEX changesets_user_id_created_at_idx ON changesets USING btree (user_id, created_at);
1678 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
1681 CREATE INDEX changesets_user_id_id_idx ON changesets USING btree (user_id, id);
1685 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
1688 CREATE INDEX current_nodes_tile_idx ON current_nodes USING btree (tile);
1692 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1695 CREATE INDEX current_nodes_timestamp_idx ON current_nodes USING btree ("timestamp");
1699 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
1702 CREATE INDEX current_relation_members_member_idx ON current_relation_members USING btree (member_type, member_id);
1706 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1709 CREATE INDEX current_relations_timestamp_idx ON current_relations USING btree ("timestamp");
1713 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
1716 CREATE INDEX current_way_nodes_node_idx ON current_way_nodes USING btree (node_id);
1720 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1723 CREATE INDEX current_ways_timestamp_idx ON current_ways USING btree ("timestamp");
1727 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
1730 CREATE INDEX diary_comment_user_id_created_at_index ON diary_comments USING btree (user_id, created_at);
1734 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
1737 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON diary_comments USING btree (diary_entry_id, id);
1741 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
1744 CREATE INDEX diary_entry_created_at_index ON diary_entries USING btree (created_at);
1748 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
1751 CREATE INDEX diary_entry_language_code_created_at_index ON diary_entries USING btree (language_code, created_at);
1755 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
1758 CREATE INDEX diary_entry_user_id_created_at_index ON diary_entries USING btree (user_id, created_at);
1762 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -
1765 CREATE INDEX friends_user_id_idx ON friends USING btree (user_id);
1769 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
1772 CREATE INDEX gpx_file_tags_gpxid_idx ON gpx_file_tags USING btree (gpx_id);
1776 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
1779 CREATE INDEX gpx_file_tags_tag_idx ON gpx_file_tags USING btree (tag);
1783 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1786 CREATE INDEX gpx_files_timestamp_idx ON gpx_files USING btree ("timestamp");
1790 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
1793 CREATE INDEX gpx_files_user_id_idx ON gpx_files USING btree (user_id);
1797 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
1800 CREATE INDEX gpx_files_visible_visibility_idx ON gpx_files USING btree (visible, visibility);
1804 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
1807 CREATE INDEX index_changeset_comments_on_created_at ON changeset_comments USING btree (created_at);
1811 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
1814 CREATE INDEX index_changesets_subscribers_on_changeset_id ON changesets_subscribers USING btree (changeset_id);
1818 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
1821 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON changesets_subscribers USING btree (subscriber_id, changeset_id);
1825 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
1828 CREATE UNIQUE INDEX index_client_applications_on_key ON client_applications USING btree (key);
1832 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
1835 CREATE INDEX index_note_comments_on_body ON note_comments USING gin (to_tsvector('english'::regconfig, body));
1839 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
1842 CREATE INDEX index_note_comments_on_created_at ON note_comments USING btree (created_at);
1846 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
1849 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON oauth_nonces USING btree (nonce, "timestamp");
1853 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
1856 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON oauth_tokens USING btree (token);
1860 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
1863 CREATE INDEX index_user_blocks_on_user_id ON user_blocks USING btree (user_id);
1867 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
1870 CREATE INDEX messages_from_user_id_idx ON messages USING btree (from_user_id);
1874 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
1877 CREATE INDEX messages_to_user_id_idx ON messages USING btree (to_user_id);
1881 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
1884 CREATE INDEX nodes_changeset_id_idx ON nodes USING btree (changeset_id);
1888 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
1891 CREATE INDEX nodes_tile_idx ON nodes USING btree (tile);
1895 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1898 CREATE INDEX nodes_timestamp_idx ON nodes USING btree ("timestamp");
1902 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
1905 CREATE INDEX note_comments_note_id_idx ON note_comments USING btree (note_id);
1909 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
1912 CREATE INDEX notes_created_at_idx ON notes USING btree (created_at);
1916 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
1919 CREATE INDEX notes_tile_status_idx ON notes USING btree (tile, status);
1923 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
1926 CREATE INDEX notes_updated_at_idx ON notes USING btree (updated_at);
1930 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
1933 CREATE INDEX points_gpxid_idx ON gps_points USING btree (gpx_id);
1937 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
1940 CREATE INDEX points_tile_idx ON gps_points USING btree (tile);
1944 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
1947 CREATE INDEX relation_members_member_idx ON relation_members USING btree (member_type, member_id);
1951 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
1954 CREATE INDEX relations_changeset_id_idx ON relations USING btree (changeset_id);
1958 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1961 CREATE INDEX relations_timestamp_idx ON relations USING btree ("timestamp");
1965 -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -
1968 CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
1972 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
1975 CREATE INDEX user_id_idx ON friends USING btree (friend_user_id);
1979 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
1982 CREATE UNIQUE INDEX user_roles_id_role_unique ON user_roles USING btree (user_id, role);
1986 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
1989 CREATE UNIQUE INDEX user_tokens_token_idx ON user_tokens USING btree (token);
1993 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
1996 CREATE INDEX user_tokens_user_id_idx ON user_tokens USING btree (user_id);
2000 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2003 CREATE UNIQUE INDEX users_auth_idx ON users USING btree (auth_provider, auth_uid);
2007 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2010 CREATE UNIQUE INDEX users_display_name_idx ON users USING btree (display_name);
2014 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2017 CREATE INDEX users_display_name_lower_idx ON users USING btree (lower((display_name)::text));
2021 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2024 CREATE UNIQUE INDEX users_email_idx ON users USING btree (email);
2028 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2031 CREATE INDEX users_email_lower_idx ON users USING btree (lower((email)::text));
2035 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2038 CREATE INDEX way_nodes_node_idx ON way_nodes USING btree (node_id);
2042 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2045 CREATE INDEX ways_changeset_id_idx ON ways USING btree (changeset_id);
2049 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2052 CREATE INDEX ways_timestamp_idx ON ways USING btree ("timestamp");
2056 -- Name: changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2059 ALTER TABLE ONLY changeset_comments
2060 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES users(id);
2064 -- Name: changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2067 ALTER TABLE ONLY changeset_comments
2068 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2072 -- Name: changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2075 ALTER TABLE ONLY changeset_tags
2076 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2080 -- Name: changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2083 ALTER TABLE ONLY changesets_subscribers
2084 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2088 -- Name: changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2091 ALTER TABLE ONLY changesets_subscribers
2092 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES users(id);
2096 -- Name: changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2099 ALTER TABLE ONLY changesets
2100 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2104 -- Name: client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2107 ALTER TABLE ONLY client_applications
2108 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2112 -- Name: current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2115 ALTER TABLE ONLY current_node_tags
2116 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
2120 -- Name: current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2123 ALTER TABLE ONLY current_nodes
2124 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2128 -- Name: current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2131 ALTER TABLE ONLY current_relation_members
2132 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
2136 -- Name: current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2139 ALTER TABLE ONLY current_relation_tags
2140 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
2144 -- Name: current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2147 ALTER TABLE ONLY current_relations
2148 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2152 -- Name: current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2155 ALTER TABLE ONLY current_way_nodes
2156 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
2160 -- Name: current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2163 ALTER TABLE ONLY current_way_nodes
2164 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
2168 -- Name: current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2171 ALTER TABLE ONLY current_way_tags
2172 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
2176 -- Name: current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2179 ALTER TABLE ONLY current_ways
2180 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2184 -- Name: diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2187 ALTER TABLE ONLY diary_comments
2188 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES diary_entries(id);
2192 -- Name: diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2195 ALTER TABLE ONLY diary_comments
2196 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2200 -- Name: diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2203 ALTER TABLE ONLY diary_entries
2204 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES languages(code);
2208 -- Name: diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2211 ALTER TABLE ONLY diary_entries
2212 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2216 -- Name: friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2219 ALTER TABLE ONLY friends
2220 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES users(id);
2224 -- Name: friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2227 ALTER TABLE ONLY friends
2228 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2232 -- Name: gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2235 ALTER TABLE ONLY gps_points
2236 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
2240 -- Name: gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2243 ALTER TABLE ONLY gpx_file_tags
2244 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
2248 -- Name: gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2251 ALTER TABLE ONLY gpx_files
2252 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2256 -- Name: messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2259 ALTER TABLE ONLY messages
2260 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES users(id);
2264 -- Name: messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2267 ALTER TABLE ONLY messages
2268 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES users(id);
2272 -- Name: node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2275 ALTER TABLE ONLY node_tags
2276 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES nodes(node_id, version);
2280 -- Name: nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2283 ALTER TABLE ONLY nodes
2284 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2288 -- Name: nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2291 ALTER TABLE ONLY nodes
2292 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2296 -- Name: note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2299 ALTER TABLE ONLY note_comments
2300 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES users(id);
2304 -- Name: note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2307 ALTER TABLE ONLY note_comments
2308 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES notes(id);
2312 -- Name: oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2315 ALTER TABLE ONLY oauth_tokens
2316 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES client_applications(id);
2320 -- Name: oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2323 ALTER TABLE ONLY oauth_tokens
2324 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2328 -- Name: redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2331 ALTER TABLE ONLY redactions
2332 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2336 -- Name: relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2339 ALTER TABLE ONLY relation_members
2340 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2344 -- Name: relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2347 ALTER TABLE ONLY relation_tags
2348 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2352 -- Name: relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2355 ALTER TABLE ONLY relations
2356 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2360 -- Name: relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2363 ALTER TABLE ONLY relations
2364 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2368 -- Name: user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2371 ALTER TABLE ONLY user_blocks
2372 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES users(id);
2376 -- Name: user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2379 ALTER TABLE ONLY user_blocks
2380 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES users(id);
2384 -- Name: user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2387 ALTER TABLE ONLY user_blocks
2388 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2392 -- Name: user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2395 ALTER TABLE ONLY user_preferences
2396 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2400 -- Name: user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2403 ALTER TABLE ONLY user_roles
2404 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES users(id);
2408 -- Name: user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2411 ALTER TABLE ONLY user_roles
2412 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2416 -- Name: user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2419 ALTER TABLE ONLY user_tokens
2420 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2424 -- Name: way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2427 ALTER TABLE ONLY way_nodes
2428 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2432 -- Name: way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2435 ALTER TABLE ONLY way_tags
2436 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2440 -- Name: ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2443 ALTER TABLE ONLY ways
2444 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2448 -- Name: ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2451 ALTER TABLE ONLY ways
2452 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2456 -- PostgreSQL database dump complete
2459 SET search_path TO "$user", public;
2461 INSERT INTO schema_migrations (version) VALUES ('1');
2463 INSERT INTO schema_migrations (version) VALUES ('10');
2465 INSERT INTO schema_migrations (version) VALUES ('11');
2467 INSERT INTO schema_migrations (version) VALUES ('12');
2469 INSERT INTO schema_migrations (version) VALUES ('13');
2471 INSERT INTO schema_migrations (version) VALUES ('14');
2473 INSERT INTO schema_migrations (version) VALUES ('15');
2475 INSERT INTO schema_migrations (version) VALUES ('16');
2477 INSERT INTO schema_migrations (version) VALUES ('17');
2479 INSERT INTO schema_migrations (version) VALUES ('18');
2481 INSERT INTO schema_migrations (version) VALUES ('19');
2483 INSERT INTO schema_migrations (version) VALUES ('2');
2485 INSERT INTO schema_migrations (version) VALUES ('20');
2487 INSERT INTO schema_migrations (version) VALUES ('20100513171259');
2489 INSERT INTO schema_migrations (version) VALUES ('20100516124737');
2491 INSERT INTO schema_migrations (version) VALUES ('20100910084426');
2493 INSERT INTO schema_migrations (version) VALUES ('20101114011429');
2495 INSERT INTO schema_migrations (version) VALUES ('20110322001319');
2497 INSERT INTO schema_migrations (version) VALUES ('20110508145337');
2499 INSERT INTO schema_migrations (version) VALUES ('20110521142405');
2501 INSERT INTO schema_migrations (version) VALUES ('20110925112722');
2503 INSERT INTO schema_migrations (version) VALUES ('20111116184519');
2505 INSERT INTO schema_migrations (version) VALUES ('20111212183945');
2507 INSERT INTO schema_migrations (version) VALUES ('20120123184321');
2509 INSERT INTO schema_migrations (version) VALUES ('20120208122334');
2511 INSERT INTO schema_migrations (version) VALUES ('20120208194454');
2513 INSERT INTO schema_migrations (version) VALUES ('20120214210114');
2515 INSERT INTO schema_migrations (version) VALUES ('20120219161649');
2517 INSERT INTO schema_migrations (version) VALUES ('20120318201948');
2519 INSERT INTO schema_migrations (version) VALUES ('20120328090602');
2521 INSERT INTO schema_migrations (version) VALUES ('20120404205604');
2523 INSERT INTO schema_migrations (version) VALUES ('20120808231205');
2525 INSERT INTO schema_migrations (version) VALUES ('20121005195010');
2527 INSERT INTO schema_migrations (version) VALUES ('20121012044047');
2529 INSERT INTO schema_migrations (version) VALUES ('20121119165817');
2531 INSERT INTO schema_migrations (version) VALUES ('20121202155309');
2533 INSERT INTO schema_migrations (version) VALUES ('20121203124841');
2535 INSERT INTO schema_migrations (version) VALUES ('20130328184137');
2537 INSERT INTO schema_migrations (version) VALUES ('20131029121300');
2539 INSERT INTO schema_migrations (version) VALUES ('20131212124700');
2541 INSERT INTO schema_migrations (version) VALUES ('20140115192822');
2543 INSERT INTO schema_migrations (version) VALUES ('20140117185510');
2545 INSERT INTO schema_migrations (version) VALUES ('20140210003018');
2547 INSERT INTO schema_migrations (version) VALUES ('20140507110937');
2549 INSERT INTO schema_migrations (version) VALUES ('20140519141742');
2551 INSERT INTO schema_migrations (version) VALUES ('20150110152606');
2553 INSERT INTO schema_migrations (version) VALUES ('20150111192335');
2555 INSERT INTO schema_migrations (version) VALUES ('20150222101847');
2557 INSERT INTO schema_migrations (version) VALUES ('20150818224516');
2559 INSERT INTO schema_migrations (version) VALUES ('21');
2561 INSERT INTO schema_migrations (version) VALUES ('22');
2563 INSERT INTO schema_migrations (version) VALUES ('23');
2565 INSERT INTO schema_migrations (version) VALUES ('24');
2567 INSERT INTO schema_migrations (version) VALUES ('25');
2569 INSERT INTO schema_migrations (version) VALUES ('26');
2571 INSERT INTO schema_migrations (version) VALUES ('27');
2573 INSERT INTO schema_migrations (version) VALUES ('28');
2575 INSERT INTO schema_migrations (version) VALUES ('29');
2577 INSERT INTO schema_migrations (version) VALUES ('3');
2579 INSERT INTO schema_migrations (version) VALUES ('30');
2581 INSERT INTO schema_migrations (version) VALUES ('31');
2583 INSERT INTO schema_migrations (version) VALUES ('32');
2585 INSERT INTO schema_migrations (version) VALUES ('33');
2587 INSERT INTO schema_migrations (version) VALUES ('34');
2589 INSERT INTO schema_migrations (version) VALUES ('35');
2591 INSERT INTO schema_migrations (version) VALUES ('36');
2593 INSERT INTO schema_migrations (version) VALUES ('37');
2595 INSERT INTO schema_migrations (version) VALUES ('38');
2597 INSERT INTO schema_migrations (version) VALUES ('39');
2599 INSERT INTO schema_migrations (version) VALUES ('4');
2601 INSERT INTO schema_migrations (version) VALUES ('40');
2603 INSERT INTO schema_migrations (version) VALUES ('41');
2605 INSERT INTO schema_migrations (version) VALUES ('42');
2607 INSERT INTO schema_migrations (version) VALUES ('43');
2609 INSERT INTO schema_migrations (version) VALUES ('44');
2611 INSERT INTO schema_migrations (version) VALUES ('45');
2613 INSERT INTO schema_migrations (version) VALUES ('46');
2615 INSERT INTO schema_migrations (version) VALUES ('47');
2617 INSERT INTO schema_migrations (version) VALUES ('48');
2619 INSERT INTO schema_migrations (version) VALUES ('49');
2621 INSERT INTO schema_migrations (version) VALUES ('5');
2623 INSERT INTO schema_migrations (version) VALUES ('50');
2625 INSERT INTO schema_migrations (version) VALUES ('51');
2627 INSERT INTO schema_migrations (version) VALUES ('52');
2629 INSERT INTO schema_migrations (version) VALUES ('53');
2631 INSERT INTO schema_migrations (version) VALUES ('54');
2633 INSERT INTO schema_migrations (version) VALUES ('55');
2635 INSERT INTO schema_migrations (version) VALUES ('56');
2637 INSERT INTO schema_migrations (version) VALUES ('57');
2639 INSERT INTO schema_migrations (version) VALUES ('6');
2641 INSERT INTO schema_migrations (version) VALUES ('7');
2643 INSERT INTO schema_migrations (version) VALUES ('8');
2645 INSERT INTO schema_migrations (version) VALUES ('9');