1 SET statement_timeout = 0;
3 SET idle_in_transaction_session_timeout = 0;
4 SET client_encoding = 'UTF8';
5 SET standard_conforming_strings = on;
6 SET check_function_bodies = false;
7 SET client_min_messages = warning;
8 SET row_security = off;
11 -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
14 CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
18 -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
21 COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
25 -- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: -
28 CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public;
32 -- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: -
35 COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST';
38 SET search_path = public, pg_catalog;
41 -- Name: format_enum; Type: TYPE; Schema: public; Owner: -
44 CREATE TYPE format_enum AS ENUM (
52 -- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: -
55 CREATE TYPE gpx_visibility_enum AS ENUM (
64 -- Name: note_event_enum; Type: TYPE; Schema: public; Owner: -
67 CREATE TYPE note_event_enum AS ENUM (
77 -- Name: note_status_enum; Type: TYPE; Schema: public; Owner: -
80 CREATE TYPE note_status_enum AS ENUM (
88 -- Name: nwr_enum; Type: TYPE; Schema: public; Owner: -
91 CREATE TYPE nwr_enum AS ENUM (
99 -- Name: user_role_enum; Type: TYPE; Schema: public; Owner: -
102 CREATE TYPE user_role_enum AS ENUM (
109 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
112 CREATE TYPE user_status_enum AS ENUM (
122 -- Name: maptile_for_point(bigint, bigint, integer); Type: FUNCTION; Schema: public; Owner: -
125 CREATE FUNCTION maptile_for_point(bigint, bigint, integer) RETURNS integer
127 AS '$libdir/libpgosm', 'maptile_for_point';
131 -- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
134 CREATE FUNCTION tile_for_point(integer, integer) RETURNS bigint
136 AS '$libdir/libpgosm', 'tile_for_point';
140 -- Name: xid_to_int4(xid); Type: FUNCTION; Schema: public; Owner: -
143 CREATE FUNCTION xid_to_int4(xid) RETURNS integer
144 LANGUAGE c IMMUTABLE STRICT
145 AS '$libdir/libpgosm', 'xid_to_int4';
148 SET default_tablespace = '';
150 SET default_with_oids = false;
153 -- Name: acls; Type: TABLE; Schema: public; Owner: -
159 k character varying(255) NOT NULL,
160 v character varying(255),
161 domain character varying(255)
166 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
169 CREATE SEQUENCE acls_id_seq
178 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
181 ALTER SEQUENCE acls_id_seq OWNED BY acls.id;
185 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
188 CREATE TABLE ar_internal_metadata (
189 key character varying NOT NULL,
190 value character varying,
191 created_at timestamp without time zone NOT NULL,
192 updated_at timestamp without time zone NOT NULL
197 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
200 CREATE TABLE changeset_comments (
202 changeset_id bigint NOT NULL,
203 author_id bigint NOT NULL,
205 created_at timestamp without time zone NOT NULL,
206 visible boolean NOT NULL
211 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
214 CREATE SEQUENCE changeset_comments_id_seq
223 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
226 ALTER SEQUENCE changeset_comments_id_seq OWNED BY changeset_comments.id;
230 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
233 CREATE TABLE changeset_tags (
234 changeset_id bigint NOT NULL,
235 k character varying(255) DEFAULT ''::character varying NOT NULL,
236 v character varying(255) DEFAULT ''::character varying NOT NULL
241 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
244 CREATE TABLE changesets (
246 user_id bigint NOT NULL,
247 created_at timestamp without time zone NOT NULL,
252 closed_at timestamp without time zone NOT NULL,
253 num_changes integer DEFAULT 0 NOT NULL
258 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
261 CREATE SEQUENCE changesets_id_seq
270 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
273 ALTER SEQUENCE changesets_id_seq OWNED BY changesets.id;
277 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
280 CREATE TABLE changesets_subscribers (
281 subscriber_id bigint NOT NULL,
282 changeset_id bigint NOT NULL
287 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
290 CREATE TABLE client_applications (
292 name character varying(255),
293 url character varying(255),
294 support_url character varying(255),
295 callback_url character varying(255),
296 key character varying(50),
297 secret character varying(50),
299 created_at timestamp without time zone,
300 updated_at timestamp without time zone,
301 allow_read_prefs boolean DEFAULT false NOT NULL,
302 allow_write_prefs boolean DEFAULT false NOT NULL,
303 allow_write_diary boolean DEFAULT false NOT NULL,
304 allow_write_api boolean DEFAULT false NOT NULL,
305 allow_read_gpx boolean DEFAULT false NOT NULL,
306 allow_write_gpx boolean DEFAULT false NOT NULL,
307 allow_write_notes boolean DEFAULT false NOT NULL
312 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
315 CREATE SEQUENCE client_applications_id_seq
324 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
327 ALTER SEQUENCE client_applications_id_seq OWNED BY client_applications.id;
331 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
334 CREATE TABLE current_node_tags (
335 node_id bigint NOT NULL,
336 k character varying(255) DEFAULT ''::character varying NOT NULL,
337 v character varying(255) DEFAULT ''::character varying NOT NULL
342 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
345 CREATE TABLE current_nodes (
347 latitude integer NOT NULL,
348 longitude integer NOT NULL,
349 changeset_id bigint NOT NULL,
350 visible boolean NOT NULL,
351 "timestamp" timestamp without time zone NOT NULL,
352 tile bigint NOT NULL,
353 version bigint NOT NULL
358 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
361 CREATE SEQUENCE current_nodes_id_seq
370 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
373 ALTER SEQUENCE current_nodes_id_seq OWNED BY current_nodes.id;
377 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
380 CREATE TABLE current_relation_members (
381 relation_id bigint NOT NULL,
382 member_type nwr_enum NOT NULL,
383 member_id bigint NOT NULL,
384 member_role character varying(255) NOT NULL,
385 sequence_id integer DEFAULT 0 NOT NULL
390 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
393 CREATE TABLE current_relation_tags (
394 relation_id bigint NOT NULL,
395 k character varying(255) DEFAULT ''::character varying NOT NULL,
396 v character varying(255) DEFAULT ''::character varying NOT NULL
401 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
404 CREATE TABLE current_relations (
406 changeset_id bigint NOT NULL,
407 "timestamp" timestamp without time zone NOT NULL,
408 visible boolean NOT NULL,
409 version bigint NOT NULL
414 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
417 CREATE SEQUENCE current_relations_id_seq
426 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
429 ALTER SEQUENCE current_relations_id_seq OWNED BY current_relations.id;
433 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
436 CREATE TABLE current_way_nodes (
437 way_id bigint NOT NULL,
438 node_id bigint NOT NULL,
439 sequence_id bigint NOT NULL
444 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
447 CREATE TABLE current_way_tags (
448 way_id bigint NOT NULL,
449 k character varying(255) DEFAULT ''::character varying NOT NULL,
450 v character varying(255) DEFAULT ''::character varying NOT NULL
455 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
458 CREATE TABLE current_ways (
460 changeset_id bigint NOT NULL,
461 "timestamp" timestamp without time zone NOT NULL,
462 visible boolean NOT NULL,
463 version bigint NOT NULL
468 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
471 CREATE SEQUENCE current_ways_id_seq
480 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
483 ALTER SEQUENCE current_ways_id_seq OWNED BY current_ways.id;
487 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
490 CREATE TABLE diary_comments (
492 diary_entry_id bigint NOT NULL,
493 user_id bigint NOT NULL,
495 created_at timestamp without time zone NOT NULL,
496 updated_at timestamp without time zone NOT NULL,
497 visible boolean DEFAULT true NOT NULL,
498 body_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
503 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
506 CREATE SEQUENCE diary_comments_id_seq
515 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
518 ALTER SEQUENCE diary_comments_id_seq OWNED BY diary_comments.id;
522 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
525 CREATE TABLE diary_entries (
527 user_id bigint NOT NULL,
528 title character varying(255) NOT NULL,
530 created_at timestamp without time zone NOT NULL,
531 updated_at timestamp without time zone NOT NULL,
532 latitude double precision,
533 longitude double precision,
534 language_code character varying(255) DEFAULT 'en'::character varying NOT NULL,
535 visible boolean DEFAULT true NOT NULL,
536 body_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
541 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
544 CREATE SEQUENCE diary_entries_id_seq
553 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
556 ALTER SEQUENCE diary_entries_id_seq OWNED BY diary_entries.id;
560 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
563 CREATE TABLE diary_entry_subscriptions (
564 user_id bigint NOT NULL,
565 diary_entry_id bigint NOT NULL
570 -- Name: friends; Type: TABLE; Schema: public; Owner: -
573 CREATE TABLE friends (
575 user_id bigint NOT NULL,
576 friend_user_id bigint NOT NULL
581 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
584 CREATE SEQUENCE friends_id_seq
593 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
596 ALTER SEQUENCE friends_id_seq OWNED BY friends.id;
600 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
603 CREATE TABLE gps_points (
604 altitude double precision,
605 trackid integer NOT NULL,
606 latitude integer NOT NULL,
607 longitude integer NOT NULL,
608 gpx_id bigint NOT NULL,
609 "timestamp" timestamp without time zone,
615 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
618 CREATE TABLE gpx_file_tags (
619 gpx_id bigint DEFAULT 0 NOT NULL,
620 tag character varying(255) NOT NULL,
626 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
629 CREATE SEQUENCE gpx_file_tags_id_seq
638 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
641 ALTER SEQUENCE gpx_file_tags_id_seq OWNED BY gpx_file_tags.id;
645 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
648 CREATE TABLE gpx_files (
650 user_id bigint NOT NULL,
651 visible boolean DEFAULT true NOT NULL,
652 name character varying(255) DEFAULT ''::character varying NOT NULL,
654 latitude double precision,
655 longitude double precision,
656 "timestamp" timestamp without time zone NOT NULL,
657 description character varying(255) DEFAULT ''::character varying NOT NULL,
658 inserted boolean NOT NULL,
659 visibility gpx_visibility_enum DEFAULT 'public'::gpx_visibility_enum NOT NULL
664 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
667 CREATE SEQUENCE gpx_files_id_seq
676 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
679 ALTER SEQUENCE gpx_files_id_seq OWNED BY gpx_files.id;
683 -- Name: languages; Type: TABLE; Schema: public; Owner: -
686 CREATE TABLE languages (
687 code character varying(255) NOT NULL,
688 english_name character varying(255) NOT NULL,
689 native_name character varying(255)
694 -- Name: messages; Type: TABLE; Schema: public; Owner: -
697 CREATE TABLE messages (
699 from_user_id bigint NOT NULL,
700 title character varying(255) NOT NULL,
702 sent_on timestamp without time zone NOT NULL,
703 message_read boolean DEFAULT false NOT NULL,
704 to_user_id bigint NOT NULL,
705 to_user_visible boolean DEFAULT true NOT NULL,
706 from_user_visible boolean DEFAULT true NOT NULL,
707 body_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
712 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
715 CREATE SEQUENCE messages_id_seq
724 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
727 ALTER SEQUENCE messages_id_seq OWNED BY messages.id;
731 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
734 CREATE TABLE node_tags (
735 node_id bigint NOT NULL,
736 version bigint NOT NULL,
737 k character varying(255) DEFAULT ''::character varying NOT NULL,
738 v character varying(255) DEFAULT ''::character varying NOT NULL
743 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
747 node_id bigint NOT NULL,
748 latitude integer NOT NULL,
749 longitude integer NOT NULL,
750 changeset_id bigint NOT NULL,
751 visible boolean NOT NULL,
752 "timestamp" timestamp without time zone NOT NULL,
753 tile bigint NOT NULL,
754 version bigint NOT NULL,
760 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
763 CREATE TABLE note_comments (
765 note_id bigint NOT NULL,
766 visible boolean NOT NULL,
767 created_at timestamp without time zone NOT NULL,
771 event note_event_enum
776 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
779 CREATE SEQUENCE note_comments_id_seq
788 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
791 ALTER SEQUENCE note_comments_id_seq OWNED BY note_comments.id;
795 -- Name: notes; Type: TABLE; Schema: public; Owner: -
800 latitude integer NOT NULL,
801 longitude integer NOT NULL,
802 tile bigint NOT NULL,
803 updated_at timestamp without time zone NOT NULL,
804 created_at timestamp without time zone NOT NULL,
805 status note_status_enum NOT NULL,
806 closed_at timestamp without time zone
811 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
814 CREATE SEQUENCE notes_id_seq
823 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
826 ALTER SEQUENCE notes_id_seq OWNED BY notes.id;
830 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
833 CREATE TABLE oauth_nonces (
835 nonce character varying(255),
837 created_at timestamp without time zone,
838 updated_at timestamp without time zone
843 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
846 CREATE SEQUENCE oauth_nonces_id_seq
855 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
858 ALTER SEQUENCE oauth_nonces_id_seq OWNED BY oauth_nonces.id;
862 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
865 CREATE TABLE oauth_tokens (
868 type character varying(20),
869 client_application_id integer,
870 token character varying(50),
871 secret character varying(50),
872 authorized_at timestamp without time zone,
873 invalidated_at timestamp without time zone,
874 created_at timestamp without time zone,
875 updated_at timestamp without time zone,
876 allow_read_prefs boolean DEFAULT false NOT NULL,
877 allow_write_prefs boolean DEFAULT false NOT NULL,
878 allow_write_diary boolean DEFAULT false NOT NULL,
879 allow_write_api boolean DEFAULT false NOT NULL,
880 allow_read_gpx boolean DEFAULT false NOT NULL,
881 allow_write_gpx boolean DEFAULT false NOT NULL,
882 callback_url character varying(255),
883 verifier character varying(20),
884 scope character varying(255),
885 valid_to timestamp without time zone,
886 allow_write_notes boolean DEFAULT false NOT NULL
891 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
894 CREATE SEQUENCE oauth_tokens_id_seq
903 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
906 ALTER SEQUENCE oauth_tokens_id_seq OWNED BY oauth_tokens.id;
910 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
913 CREATE TABLE redactions (
915 title character varying(255),
917 created_at timestamp without time zone NOT NULL,
918 updated_at timestamp without time zone NOT NULL,
919 user_id bigint NOT NULL,
920 description_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
925 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
928 CREATE SEQUENCE redactions_id_seq
937 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
940 ALTER SEQUENCE redactions_id_seq OWNED BY redactions.id;
944 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
947 CREATE TABLE relation_members (
948 relation_id bigint DEFAULT 0 NOT NULL,
949 member_type nwr_enum NOT NULL,
950 member_id bigint NOT NULL,
951 member_role character varying(255) NOT NULL,
952 version bigint DEFAULT 0 NOT NULL,
953 sequence_id integer DEFAULT 0 NOT NULL
958 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
961 CREATE TABLE relation_tags (
962 relation_id bigint DEFAULT 0 NOT NULL,
963 k character varying(255) DEFAULT ''::character varying NOT NULL,
964 v character varying(255) DEFAULT ''::character varying NOT NULL,
965 version bigint NOT NULL
970 -- Name: relations; Type: TABLE; Schema: public; Owner: -
973 CREATE TABLE relations (
974 relation_id bigint DEFAULT 0 NOT NULL,
975 changeset_id bigint NOT NULL,
976 "timestamp" timestamp without time zone NOT NULL,
977 version bigint NOT NULL,
978 visible boolean DEFAULT true NOT NULL,
984 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
987 CREATE TABLE schema_migrations (
988 version character varying(255) NOT NULL
993 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
996 CREATE TABLE user_blocks (
998 user_id bigint NOT NULL,
999 creator_id bigint NOT NULL,
1000 reason text NOT NULL,
1001 ends_at timestamp without time zone NOT NULL,
1002 needs_view boolean DEFAULT false NOT NULL,
1004 created_at timestamp without time zone,
1005 updated_at timestamp without time zone,
1006 reason_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
1011 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1014 CREATE SEQUENCE user_blocks_id_seq
1023 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1026 ALTER SEQUENCE user_blocks_id_seq OWNED BY user_blocks.id;
1030 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1033 CREATE TABLE user_preferences (
1034 user_id bigint NOT NULL,
1035 k character varying(255) NOT NULL,
1036 v character varying(255) NOT NULL
1041 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1044 CREATE TABLE user_roles (
1045 id integer NOT NULL,
1046 user_id bigint NOT NULL,
1047 created_at timestamp without time zone,
1048 updated_at timestamp without time zone,
1049 role user_role_enum NOT NULL,
1050 granter_id bigint NOT NULL
1055 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1058 CREATE SEQUENCE user_roles_id_seq
1067 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1070 ALTER SEQUENCE user_roles_id_seq OWNED BY user_roles.id;
1074 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1077 CREATE TABLE user_tokens (
1079 user_id bigint NOT NULL,
1080 token character varying(255) NOT NULL,
1081 expiry timestamp without time zone NOT NULL,
1087 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1090 CREATE SEQUENCE user_tokens_id_seq
1099 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1102 ALTER SEQUENCE user_tokens_id_seq OWNED BY user_tokens.id;
1106 -- Name: users; Type: TABLE; Schema: public; Owner: -
1109 CREATE TABLE users (
1110 email character varying(255) NOT NULL,
1112 pass_crypt character varying(255) NOT NULL,
1113 creation_time timestamp without time zone NOT NULL,
1114 display_name character varying(255) DEFAULT ''::character varying NOT NULL,
1115 data_public boolean DEFAULT false NOT NULL,
1116 description text DEFAULT ''::text NOT NULL,
1117 home_lat double precision,
1118 home_lon double precision,
1119 home_zoom smallint DEFAULT 3,
1120 nearby integer DEFAULT 50,
1121 pass_salt character varying(255),
1122 image_file_name text,
1123 email_valid boolean DEFAULT false NOT NULL,
1124 new_email character varying(255),
1125 creation_ip character varying(255),
1126 languages character varying(255),
1127 status user_status_enum DEFAULT 'pending'::user_status_enum NOT NULL,
1128 terms_agreed timestamp without time zone,
1129 consider_pd boolean DEFAULT false NOT NULL,
1130 preferred_editor character varying(255),
1131 terms_seen boolean DEFAULT false NOT NULL,
1132 auth_uid character varying(255),
1133 description_format format_enum DEFAULT 'markdown'::format_enum NOT NULL,
1134 image_fingerprint character varying(255),
1135 changesets_count integer DEFAULT 0 NOT NULL,
1136 traces_count integer DEFAULT 0 NOT NULL,
1137 diary_entries_count integer DEFAULT 0 NOT NULL,
1138 image_use_gravatar boolean DEFAULT false NOT NULL,
1139 image_content_type character varying(255),
1140 auth_provider character varying(255),
1146 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1149 CREATE SEQUENCE users_id_seq
1158 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1161 ALTER SEQUENCE users_id_seq OWNED BY users.id;
1165 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1168 CREATE TABLE way_nodes (
1169 way_id bigint NOT NULL,
1170 node_id bigint NOT NULL,
1171 version bigint NOT NULL,
1172 sequence_id bigint NOT NULL
1177 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1180 CREATE TABLE way_tags (
1181 way_id bigint DEFAULT 0 NOT NULL,
1182 k character varying(255) NOT NULL,
1183 v character varying(255) NOT NULL,
1184 version bigint NOT NULL
1189 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1193 way_id bigint DEFAULT 0 NOT NULL,
1194 changeset_id bigint NOT NULL,
1195 "timestamp" timestamp without time zone NOT NULL,
1196 version bigint NOT NULL,
1197 visible boolean DEFAULT true NOT NULL,
1198 redaction_id integer
1203 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1206 ALTER TABLE ONLY acls ALTER COLUMN id SET DEFAULT nextval('acls_id_seq'::regclass);
1210 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1213 ALTER TABLE ONLY changeset_comments ALTER COLUMN id SET DEFAULT nextval('changeset_comments_id_seq'::regclass);
1217 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1220 ALTER TABLE ONLY changesets ALTER COLUMN id SET DEFAULT nextval('changesets_id_seq'::regclass);
1224 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1227 ALTER TABLE ONLY client_applications ALTER COLUMN id SET DEFAULT nextval('client_applications_id_seq'::regclass);
1231 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1234 ALTER TABLE ONLY current_nodes ALTER COLUMN id SET DEFAULT nextval('current_nodes_id_seq'::regclass);
1238 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1241 ALTER TABLE ONLY current_relations ALTER COLUMN id SET DEFAULT nextval('current_relations_id_seq'::regclass);
1245 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1248 ALTER TABLE ONLY current_ways ALTER COLUMN id SET DEFAULT nextval('current_ways_id_seq'::regclass);
1252 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1255 ALTER TABLE ONLY diary_comments ALTER COLUMN id SET DEFAULT nextval('diary_comments_id_seq'::regclass);
1259 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1262 ALTER TABLE ONLY diary_entries ALTER COLUMN id SET DEFAULT nextval('diary_entries_id_seq'::regclass);
1266 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1269 ALTER TABLE ONLY friends ALTER COLUMN id SET DEFAULT nextval('friends_id_seq'::regclass);
1273 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1276 ALTER TABLE ONLY gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('gpx_file_tags_id_seq'::regclass);
1280 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1283 ALTER TABLE ONLY gpx_files ALTER COLUMN id SET DEFAULT nextval('gpx_files_id_seq'::regclass);
1287 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1290 ALTER TABLE ONLY messages ALTER COLUMN id SET DEFAULT nextval('messages_id_seq'::regclass);
1294 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1297 ALTER TABLE ONLY note_comments ALTER COLUMN id SET DEFAULT nextval('note_comments_id_seq'::regclass);
1301 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1304 ALTER TABLE ONLY notes ALTER COLUMN id SET DEFAULT nextval('notes_id_seq'::regclass);
1308 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1311 ALTER TABLE ONLY oauth_nonces ALTER COLUMN id SET DEFAULT nextval('oauth_nonces_id_seq'::regclass);
1315 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1318 ALTER TABLE ONLY oauth_tokens ALTER COLUMN id SET DEFAULT nextval('oauth_tokens_id_seq'::regclass);
1322 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1325 ALTER TABLE ONLY redactions ALTER COLUMN id SET DEFAULT nextval('redactions_id_seq'::regclass);
1329 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1332 ALTER TABLE ONLY user_blocks ALTER COLUMN id SET DEFAULT nextval('user_blocks_id_seq'::regclass);
1336 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1339 ALTER TABLE ONLY user_roles ALTER COLUMN id SET DEFAULT nextval('user_roles_id_seq'::regclass);
1343 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1346 ALTER TABLE ONLY user_tokens ALTER COLUMN id SET DEFAULT nextval('user_tokens_id_seq'::regclass);
1350 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1353 ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
1357 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1360 ALTER TABLE ONLY acls
1361 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1365 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1368 ALTER TABLE ONLY ar_internal_metadata
1369 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1373 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1376 ALTER TABLE ONLY changeset_comments
1377 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1381 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1384 ALTER TABLE ONLY changesets
1385 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1389 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1392 ALTER TABLE ONLY client_applications
1393 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1397 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1400 ALTER TABLE ONLY current_node_tags
1401 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1405 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1408 ALTER TABLE ONLY current_nodes
1409 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1413 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1416 ALTER TABLE ONLY current_relation_members
1417 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1421 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1424 ALTER TABLE ONLY current_relation_tags
1425 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1429 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1432 ALTER TABLE ONLY current_relations
1433 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1437 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1440 ALTER TABLE ONLY current_way_nodes
1441 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1445 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1448 ALTER TABLE ONLY current_way_tags
1449 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1453 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1456 ALTER TABLE ONLY current_ways
1457 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1461 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1464 ALTER TABLE ONLY diary_comments
1465 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1469 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1472 ALTER TABLE ONLY diary_entries
1473 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1477 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1480 ALTER TABLE ONLY diary_entry_subscriptions
1481 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1485 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1488 ALTER TABLE ONLY friends
1489 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1493 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1496 ALTER TABLE ONLY gpx_file_tags
1497 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1501 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1504 ALTER TABLE ONLY gpx_files
1505 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1509 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1512 ALTER TABLE ONLY languages
1513 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1517 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1520 ALTER TABLE ONLY messages
1521 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1525 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1528 ALTER TABLE ONLY node_tags
1529 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1533 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1536 ALTER TABLE ONLY nodes
1537 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1541 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1544 ALTER TABLE ONLY note_comments
1545 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1549 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1552 ALTER TABLE ONLY notes
1553 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1557 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1560 ALTER TABLE ONLY oauth_nonces
1561 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1565 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1568 ALTER TABLE ONLY oauth_tokens
1569 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1573 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1576 ALTER TABLE ONLY redactions
1577 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1581 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1584 ALTER TABLE ONLY relation_members
1585 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1589 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1592 ALTER TABLE ONLY relation_tags
1593 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1597 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1600 ALTER TABLE ONLY relations
1601 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1605 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1608 ALTER TABLE ONLY user_blocks
1609 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1613 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1616 ALTER TABLE ONLY user_preferences
1617 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1621 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1624 ALTER TABLE ONLY user_roles
1625 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1629 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1632 ALTER TABLE ONLY user_tokens
1633 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
1637 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1640 ALTER TABLE ONLY users
1641 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
1645 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1648 ALTER TABLE ONLY way_nodes
1649 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
1653 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1656 ALTER TABLE ONLY way_tags
1657 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
1661 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1664 ALTER TABLE ONLY ways
1665 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
1669 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
1672 CREATE INDEX acls_k_idx ON acls USING btree (k);
1676 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
1679 CREATE INDEX changeset_tags_id_idx ON changeset_tags USING btree (changeset_id);
1683 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
1686 CREATE INDEX changesets_bbox_idx ON changesets USING gist (min_lat, max_lat, min_lon, max_lon);
1690 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
1693 CREATE INDEX changesets_closed_at_idx ON changesets USING btree (closed_at);
1697 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
1700 CREATE INDEX changesets_created_at_idx ON changesets USING btree (created_at);
1704 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
1707 CREATE INDEX changesets_user_id_created_at_idx ON changesets USING btree (user_id, created_at);
1711 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
1714 CREATE INDEX changesets_user_id_id_idx ON changesets USING btree (user_id, id);
1718 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
1721 CREATE INDEX current_nodes_tile_idx ON current_nodes USING btree (tile);
1725 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1728 CREATE INDEX current_nodes_timestamp_idx ON current_nodes USING btree ("timestamp");
1732 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
1735 CREATE INDEX current_relation_members_member_idx ON current_relation_members USING btree (member_type, member_id);
1739 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1742 CREATE INDEX current_relations_timestamp_idx ON current_relations USING btree ("timestamp");
1746 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
1749 CREATE INDEX current_way_nodes_node_idx ON current_way_nodes USING btree (node_id);
1753 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1756 CREATE INDEX current_ways_timestamp_idx ON current_ways USING btree ("timestamp");
1760 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
1763 CREATE INDEX diary_comment_user_id_created_at_index ON diary_comments USING btree (user_id, created_at);
1767 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
1770 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON diary_comments USING btree (diary_entry_id, id);
1774 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
1777 CREATE INDEX diary_entry_created_at_index ON diary_entries USING btree (created_at);
1781 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
1784 CREATE INDEX diary_entry_language_code_created_at_index ON diary_entries USING btree (language_code, created_at);
1788 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
1791 CREATE INDEX diary_entry_user_id_created_at_index ON diary_entries USING btree (user_id, created_at);
1795 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -
1798 CREATE INDEX friends_user_id_idx ON friends USING btree (user_id);
1802 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
1805 CREATE INDEX gpx_file_tags_gpxid_idx ON gpx_file_tags USING btree (gpx_id);
1809 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
1812 CREATE INDEX gpx_file_tags_tag_idx ON gpx_file_tags USING btree (tag);
1816 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1819 CREATE INDEX gpx_files_timestamp_idx ON gpx_files USING btree ("timestamp");
1823 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
1826 CREATE INDEX gpx_files_user_id_idx ON gpx_files USING btree (user_id);
1830 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
1833 CREATE INDEX gpx_files_visible_visibility_idx ON gpx_files USING btree (visible, visibility);
1837 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
1840 CREATE INDEX index_changeset_comments_on_created_at ON changeset_comments USING btree (created_at);
1844 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
1847 CREATE INDEX index_changesets_subscribers_on_changeset_id ON changesets_subscribers USING btree (changeset_id);
1851 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
1854 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON changesets_subscribers USING btree (subscriber_id, changeset_id);
1858 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
1861 CREATE UNIQUE INDEX index_client_applications_on_key ON client_applications USING btree (key);
1865 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
1868 CREATE INDEX index_client_applications_on_user_id ON client_applications USING btree (user_id);
1872 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
1875 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON diary_entry_subscriptions USING btree (diary_entry_id);
1879 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
1882 CREATE INDEX index_note_comments_on_body ON note_comments USING gin (to_tsvector('english'::regconfig, body));
1886 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
1889 CREATE INDEX index_note_comments_on_created_at ON note_comments USING btree (created_at);
1893 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
1896 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON oauth_nonces USING btree (nonce, "timestamp");
1900 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
1903 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON oauth_tokens USING btree (token);
1907 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
1910 CREATE INDEX index_oauth_tokens_on_user_id ON oauth_tokens USING btree (user_id);
1914 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
1917 CREATE INDEX index_user_blocks_on_user_id ON user_blocks USING btree (user_id);
1921 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
1924 CREATE INDEX messages_from_user_id_idx ON messages USING btree (from_user_id);
1928 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
1931 CREATE INDEX messages_to_user_id_idx ON messages USING btree (to_user_id);
1935 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
1938 CREATE INDEX nodes_changeset_id_idx ON nodes USING btree (changeset_id);
1942 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
1945 CREATE INDEX nodes_tile_idx ON nodes USING btree (tile);
1949 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1952 CREATE INDEX nodes_timestamp_idx ON nodes USING btree ("timestamp");
1956 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
1959 CREATE INDEX note_comments_note_id_idx ON note_comments USING btree (note_id);
1963 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
1966 CREATE INDEX notes_created_at_idx ON notes USING btree (created_at);
1970 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
1973 CREATE INDEX notes_tile_status_idx ON notes USING btree (tile, status);
1977 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
1980 CREATE INDEX notes_updated_at_idx ON notes USING btree (updated_at);
1984 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
1987 CREATE INDEX points_gpxid_idx ON gps_points USING btree (gpx_id);
1991 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
1994 CREATE INDEX points_tile_idx ON gps_points USING btree (tile);
1998 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2001 CREATE INDEX relation_members_member_idx ON relation_members USING btree (member_type, member_id);
2005 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2008 CREATE INDEX relations_changeset_id_idx ON relations USING btree (changeset_id);
2012 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2015 CREATE INDEX relations_timestamp_idx ON relations USING btree ("timestamp");
2019 -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -
2022 CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
2026 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2029 CREATE INDEX user_id_idx ON friends USING btree (friend_user_id);
2033 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2036 CREATE UNIQUE INDEX user_roles_id_role_unique ON user_roles USING btree (user_id, role);
2040 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2043 CREATE UNIQUE INDEX user_tokens_token_idx ON user_tokens USING btree (token);
2047 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2050 CREATE INDEX user_tokens_user_id_idx ON user_tokens USING btree (user_id);
2054 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2057 CREATE UNIQUE INDEX users_auth_idx ON users USING btree (auth_provider, auth_uid);
2061 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2064 CREATE UNIQUE INDEX users_display_name_idx ON users USING btree (display_name);
2068 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2071 CREATE INDEX users_display_name_lower_idx ON users USING btree (lower((display_name)::text));
2075 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2078 CREATE UNIQUE INDEX users_email_idx ON users USING btree (email);
2082 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2085 CREATE INDEX users_email_lower_idx ON users USING btree (lower((email)::text));
2089 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2092 CREATE INDEX users_home_idx ON users USING btree (home_tile);
2096 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2099 CREATE INDEX way_nodes_node_idx ON way_nodes USING btree (node_id);
2103 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2106 CREATE INDEX ways_changeset_id_idx ON ways USING btree (changeset_id);
2110 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2113 CREATE INDEX ways_timestamp_idx ON ways USING btree ("timestamp");
2117 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2120 ALTER TABLE ONLY changeset_comments
2121 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES users(id);
2125 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2128 ALTER TABLE ONLY changeset_comments
2129 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2133 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2136 ALTER TABLE ONLY changeset_tags
2137 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2141 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2144 ALTER TABLE ONLY changesets_subscribers
2145 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2149 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2152 ALTER TABLE ONLY changesets_subscribers
2153 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES users(id);
2157 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2160 ALTER TABLE ONLY changesets
2161 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2165 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2168 ALTER TABLE ONLY client_applications
2169 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2173 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2176 ALTER TABLE ONLY current_node_tags
2177 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
2181 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2184 ALTER TABLE ONLY current_nodes
2185 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2189 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2192 ALTER TABLE ONLY current_relation_members
2193 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
2197 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2200 ALTER TABLE ONLY current_relation_tags
2201 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
2205 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2208 ALTER TABLE ONLY current_relations
2209 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2213 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2216 ALTER TABLE ONLY current_way_nodes
2217 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
2221 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2224 ALTER TABLE ONLY current_way_nodes
2225 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
2229 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2232 ALTER TABLE ONLY current_way_tags
2233 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
2237 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2240 ALTER TABLE ONLY current_ways
2241 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2245 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2248 ALTER TABLE ONLY diary_comments
2249 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES diary_entries(id);
2253 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2256 ALTER TABLE ONLY diary_comments
2257 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2261 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2264 ALTER TABLE ONLY diary_entries
2265 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES languages(code);
2269 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2272 ALTER TABLE ONLY diary_entries
2273 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2277 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2280 ALTER TABLE ONLY diary_entry_subscriptions
2281 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES diary_entries(id);
2285 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2288 ALTER TABLE ONLY diary_entry_subscriptions
2289 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2293 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2296 ALTER TABLE ONLY friends
2297 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES users(id);
2301 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2304 ALTER TABLE ONLY friends
2305 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2309 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2312 ALTER TABLE ONLY gps_points
2313 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
2317 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2320 ALTER TABLE ONLY gpx_file_tags
2321 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
2325 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2328 ALTER TABLE ONLY gpx_files
2329 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2333 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2336 ALTER TABLE ONLY messages
2337 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES users(id);
2341 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2344 ALTER TABLE ONLY messages
2345 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES users(id);
2349 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2352 ALTER TABLE ONLY node_tags
2353 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES nodes(node_id, version);
2357 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2360 ALTER TABLE ONLY nodes
2361 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2365 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2368 ALTER TABLE ONLY nodes
2369 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2373 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2376 ALTER TABLE ONLY note_comments
2377 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES users(id);
2381 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2384 ALTER TABLE ONLY note_comments
2385 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES notes(id);
2389 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2392 ALTER TABLE ONLY oauth_tokens
2393 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES client_applications(id);
2397 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2400 ALTER TABLE ONLY oauth_tokens
2401 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2405 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2408 ALTER TABLE ONLY redactions
2409 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2413 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2416 ALTER TABLE ONLY relation_members
2417 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2421 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2424 ALTER TABLE ONLY relation_tags
2425 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2429 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2432 ALTER TABLE ONLY relations
2433 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2437 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2440 ALTER TABLE ONLY relations
2441 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2445 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2448 ALTER TABLE ONLY user_blocks
2449 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES users(id);
2453 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2456 ALTER TABLE ONLY user_blocks
2457 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES users(id);
2461 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2464 ALTER TABLE ONLY user_blocks
2465 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2469 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2472 ALTER TABLE ONLY user_preferences
2473 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2477 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2480 ALTER TABLE ONLY user_roles
2481 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES users(id);
2485 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2488 ALTER TABLE ONLY user_roles
2489 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2493 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2496 ALTER TABLE ONLY user_tokens
2497 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2501 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2504 ALTER TABLE ONLY way_nodes
2505 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2509 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2512 ALTER TABLE ONLY way_tags
2513 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2517 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2520 ALTER TABLE ONLY ways
2521 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2525 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2528 ALTER TABLE ONLY ways
2529 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2533 -- PostgreSQL database dump complete
2536 SET search_path TO "$user", public;
2538 INSERT INTO "schema_migrations" (version) VALUES