2 -- PostgreSQL database dump
5 -- Dumped from database version 9.5.7
6 -- Dumped by pg_dump version 9.5.7
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: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
194 CREATE TABLE ar_internal_metadata (
195 key character varying NOT NULL,
196 value character varying,
197 created_at timestamp without time zone NOT NULL,
198 updated_at timestamp without time zone NOT NULL
203 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
206 CREATE TABLE changeset_comments (
208 changeset_id bigint NOT NULL,
209 author_id bigint NOT NULL,
211 created_at timestamp without time zone NOT NULL,
212 visible boolean NOT NULL
217 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
220 CREATE SEQUENCE changeset_comments_id_seq
229 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
232 ALTER SEQUENCE changeset_comments_id_seq OWNED BY changeset_comments.id;
236 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
239 CREATE TABLE changeset_tags (
240 changeset_id bigint NOT NULL,
241 k character varying(255) DEFAULT ''::character varying NOT NULL,
242 v character varying(255) DEFAULT ''::character varying NOT NULL
247 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
250 CREATE TABLE changesets (
252 user_id bigint NOT NULL,
253 created_at timestamp without time zone NOT NULL,
258 closed_at timestamp without time zone NOT NULL,
259 num_changes integer DEFAULT 0 NOT NULL
264 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
267 CREATE SEQUENCE changesets_id_seq
276 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
279 ALTER SEQUENCE changesets_id_seq OWNED BY changesets.id;
283 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
286 CREATE TABLE changesets_subscribers (
287 subscriber_id bigint NOT NULL,
288 changeset_id bigint NOT NULL
293 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
296 CREATE TABLE client_applications (
298 name character varying(255),
299 url character varying(255),
300 support_url character varying(255),
301 callback_url character varying(255),
302 key character varying(50),
303 secret character varying(50),
305 created_at timestamp without time zone,
306 updated_at timestamp without time zone,
307 allow_read_prefs boolean DEFAULT false NOT NULL,
308 allow_write_prefs boolean DEFAULT false NOT NULL,
309 allow_write_diary boolean DEFAULT false NOT NULL,
310 allow_write_api boolean DEFAULT false NOT NULL,
311 allow_read_gpx boolean DEFAULT false NOT NULL,
312 allow_write_gpx boolean DEFAULT false NOT NULL,
313 allow_write_notes boolean DEFAULT false NOT NULL
318 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
321 CREATE SEQUENCE client_applications_id_seq
330 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
333 ALTER SEQUENCE client_applications_id_seq OWNED BY client_applications.id;
337 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
340 CREATE TABLE current_node_tags (
341 node_id bigint NOT NULL,
342 k character varying(255) DEFAULT ''::character varying NOT NULL,
343 v character varying(255) DEFAULT ''::character varying NOT NULL
348 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
351 CREATE TABLE current_nodes (
353 latitude integer NOT NULL,
354 longitude integer NOT NULL,
355 changeset_id bigint NOT NULL,
356 visible boolean NOT NULL,
357 "timestamp" timestamp without time zone NOT NULL,
358 tile bigint NOT NULL,
359 version bigint NOT NULL
364 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
367 CREATE SEQUENCE current_nodes_id_seq
376 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
379 ALTER SEQUENCE current_nodes_id_seq OWNED BY current_nodes.id;
383 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
386 CREATE TABLE current_relation_members (
387 relation_id bigint NOT NULL,
388 member_type nwr_enum NOT NULL,
389 member_id bigint NOT NULL,
390 member_role character varying(255) NOT NULL,
391 sequence_id integer DEFAULT 0 NOT NULL
396 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
399 CREATE TABLE current_relation_tags (
400 relation_id bigint NOT NULL,
401 k character varying(255) DEFAULT ''::character varying NOT NULL,
402 v character varying(255) DEFAULT ''::character varying NOT NULL
407 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
410 CREATE TABLE current_relations (
412 changeset_id bigint NOT NULL,
413 "timestamp" timestamp without time zone NOT NULL,
414 visible boolean NOT NULL,
415 version bigint NOT NULL
420 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
423 CREATE SEQUENCE current_relations_id_seq
432 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
435 ALTER SEQUENCE current_relations_id_seq OWNED BY current_relations.id;
439 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
442 CREATE TABLE current_way_nodes (
443 way_id bigint NOT NULL,
444 node_id bigint NOT NULL,
445 sequence_id bigint NOT NULL
450 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
453 CREATE TABLE current_way_tags (
454 way_id bigint NOT NULL,
455 k character varying(255) DEFAULT ''::character varying NOT NULL,
456 v character varying(255) DEFAULT ''::character varying NOT NULL
461 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
464 CREATE TABLE current_ways (
466 changeset_id bigint NOT NULL,
467 "timestamp" timestamp without time zone NOT NULL,
468 visible boolean NOT NULL,
469 version bigint NOT NULL
474 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
477 CREATE SEQUENCE current_ways_id_seq
486 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
489 ALTER SEQUENCE current_ways_id_seq OWNED BY current_ways.id;
493 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
496 CREATE TABLE diary_comments (
498 diary_entry_id bigint NOT NULL,
499 user_id bigint NOT NULL,
501 created_at timestamp without time zone NOT NULL,
502 updated_at timestamp without time zone NOT NULL,
503 visible boolean DEFAULT true NOT NULL,
504 body_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
509 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
512 CREATE SEQUENCE diary_comments_id_seq
521 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
524 ALTER SEQUENCE diary_comments_id_seq OWNED BY diary_comments.id;
528 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
531 CREATE TABLE diary_entries (
533 user_id bigint NOT NULL,
534 title character varying(255) NOT NULL,
536 created_at timestamp without time zone NOT NULL,
537 updated_at timestamp without time zone NOT NULL,
538 latitude double precision,
539 longitude double precision,
540 language_code character varying(255) DEFAULT 'en'::character varying NOT NULL,
541 visible boolean DEFAULT true NOT NULL,
542 body_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
547 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
550 CREATE SEQUENCE diary_entries_id_seq
559 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
562 ALTER SEQUENCE diary_entries_id_seq OWNED BY diary_entries.id;
566 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
569 CREATE TABLE diary_entry_subscriptions (
570 user_id bigint NOT NULL,
571 diary_entry_id bigint NOT NULL
576 -- Name: friends; Type: TABLE; Schema: public; Owner: -
579 CREATE TABLE friends (
581 user_id bigint NOT NULL,
582 friend_user_id bigint NOT NULL
587 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
590 CREATE SEQUENCE friends_id_seq
599 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
602 ALTER SEQUENCE friends_id_seq OWNED BY friends.id;
606 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
609 CREATE TABLE gps_points (
610 altitude double precision,
611 trackid integer NOT NULL,
612 latitude integer NOT NULL,
613 longitude integer NOT NULL,
614 gpx_id bigint NOT NULL,
615 "timestamp" timestamp without time zone,
621 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
624 CREATE TABLE gpx_file_tags (
625 gpx_id bigint DEFAULT 0 NOT NULL,
626 tag character varying(255) NOT NULL,
632 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
635 CREATE SEQUENCE gpx_file_tags_id_seq
644 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
647 ALTER SEQUENCE gpx_file_tags_id_seq OWNED BY gpx_file_tags.id;
651 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
654 CREATE TABLE gpx_files (
656 user_id bigint NOT NULL,
657 visible boolean DEFAULT true NOT NULL,
658 name character varying(255) DEFAULT ''::character varying NOT NULL,
660 latitude double precision,
661 longitude double precision,
662 "timestamp" timestamp without time zone NOT NULL,
663 description character varying(255) DEFAULT ''::character varying NOT NULL,
664 inserted boolean NOT NULL,
665 visibility gpx_visibility_enum DEFAULT 'public'::gpx_visibility_enum NOT NULL
670 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
673 CREATE SEQUENCE gpx_files_id_seq
682 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
685 ALTER SEQUENCE gpx_files_id_seq OWNED BY gpx_files.id;
689 -- Name: languages; Type: TABLE; Schema: public; Owner: -
692 CREATE TABLE languages (
693 code character varying(255) NOT NULL,
694 english_name character varying(255) NOT NULL,
695 native_name character varying(255)
700 -- Name: messages; Type: TABLE; Schema: public; Owner: -
703 CREATE TABLE messages (
705 from_user_id bigint NOT NULL,
706 title character varying(255) NOT NULL,
708 sent_on timestamp without time zone NOT NULL,
709 message_read boolean DEFAULT false NOT NULL,
710 to_user_id bigint NOT NULL,
711 to_user_visible boolean DEFAULT true NOT NULL,
712 from_user_visible boolean DEFAULT true NOT NULL,
713 body_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
718 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
721 CREATE SEQUENCE messages_id_seq
730 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
733 ALTER SEQUENCE messages_id_seq OWNED BY messages.id;
737 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
740 CREATE TABLE node_tags (
741 node_id bigint NOT NULL,
742 version bigint NOT NULL,
743 k character varying(255) DEFAULT ''::character varying NOT NULL,
744 v character varying(255) DEFAULT ''::character varying NOT NULL
749 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
753 node_id bigint NOT NULL,
754 latitude integer NOT NULL,
755 longitude integer NOT NULL,
756 changeset_id bigint NOT NULL,
757 visible boolean NOT NULL,
758 "timestamp" timestamp without time zone NOT NULL,
759 tile bigint NOT NULL,
760 version bigint NOT NULL,
766 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
769 CREATE TABLE note_comments (
771 note_id bigint NOT NULL,
772 visible boolean NOT NULL,
773 created_at timestamp without time zone NOT NULL,
777 event note_event_enum
782 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
785 CREATE SEQUENCE note_comments_id_seq
794 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
797 ALTER SEQUENCE note_comments_id_seq OWNED BY note_comments.id;
801 -- Name: notes; Type: TABLE; Schema: public; Owner: -
806 latitude integer NOT NULL,
807 longitude integer NOT NULL,
808 tile bigint NOT NULL,
809 updated_at timestamp without time zone NOT NULL,
810 created_at timestamp without time zone NOT NULL,
811 status note_status_enum NOT NULL,
812 closed_at timestamp without time zone
817 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
820 CREATE SEQUENCE notes_id_seq
829 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
832 ALTER SEQUENCE notes_id_seq OWNED BY notes.id;
836 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
839 CREATE TABLE oauth_nonces (
841 nonce character varying(255),
843 created_at timestamp without time zone,
844 updated_at timestamp without time zone
849 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
852 CREATE SEQUENCE oauth_nonces_id_seq
861 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
864 ALTER SEQUENCE oauth_nonces_id_seq OWNED BY oauth_nonces.id;
868 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
871 CREATE TABLE oauth_tokens (
874 type character varying(20),
875 client_application_id integer,
876 token character varying(50),
877 secret character varying(50),
878 authorized_at timestamp without time zone,
879 invalidated_at timestamp without time zone,
880 created_at timestamp without time zone,
881 updated_at timestamp without time zone,
882 allow_read_prefs boolean DEFAULT false NOT NULL,
883 allow_write_prefs boolean DEFAULT false NOT NULL,
884 allow_write_diary boolean DEFAULT false NOT NULL,
885 allow_write_api boolean DEFAULT false NOT NULL,
886 allow_read_gpx boolean DEFAULT false NOT NULL,
887 allow_write_gpx boolean DEFAULT false NOT NULL,
888 callback_url character varying(255),
889 verifier character varying(20),
890 scope character varying(255),
891 valid_to timestamp without time zone,
892 allow_write_notes boolean DEFAULT false NOT NULL
897 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
900 CREATE SEQUENCE oauth_tokens_id_seq
909 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
912 ALTER SEQUENCE oauth_tokens_id_seq OWNED BY oauth_tokens.id;
916 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
919 CREATE TABLE redactions (
921 title character varying(255),
923 created_at timestamp without time zone NOT NULL,
924 updated_at timestamp without time zone NOT NULL,
925 user_id bigint NOT NULL,
926 description_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
931 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
934 CREATE SEQUENCE redactions_id_seq
943 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
946 ALTER SEQUENCE redactions_id_seq OWNED BY redactions.id;
950 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
953 CREATE TABLE relation_members (
954 relation_id bigint DEFAULT 0 NOT NULL,
955 member_type nwr_enum NOT NULL,
956 member_id bigint NOT NULL,
957 member_role character varying(255) NOT NULL,
958 version bigint DEFAULT 0 NOT NULL,
959 sequence_id integer DEFAULT 0 NOT NULL
964 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
967 CREATE TABLE relation_tags (
968 relation_id bigint DEFAULT 0 NOT NULL,
969 k character varying(255) DEFAULT ''::character varying NOT NULL,
970 v character varying(255) DEFAULT ''::character varying NOT NULL,
971 version bigint NOT NULL
976 -- Name: relations; Type: TABLE; Schema: public; Owner: -
979 CREATE TABLE relations (
980 relation_id bigint DEFAULT 0 NOT NULL,
981 changeset_id bigint NOT NULL,
982 "timestamp" timestamp without time zone NOT NULL,
983 version bigint NOT NULL,
984 visible boolean DEFAULT true NOT NULL,
990 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
993 CREATE TABLE schema_migrations (
994 version character varying(255) NOT NULL
999 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1002 CREATE TABLE user_blocks (
1003 id integer NOT NULL,
1004 user_id bigint NOT NULL,
1005 creator_id bigint NOT NULL,
1006 reason text NOT NULL,
1007 ends_at timestamp without time zone NOT NULL,
1008 needs_view boolean DEFAULT false NOT NULL,
1010 created_at timestamp without time zone,
1011 updated_at timestamp without time zone,
1012 reason_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
1017 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1020 CREATE SEQUENCE user_blocks_id_seq
1029 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1032 ALTER SEQUENCE user_blocks_id_seq OWNED BY user_blocks.id;
1036 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1039 CREATE TABLE user_preferences (
1040 user_id bigint NOT NULL,
1041 k character varying(255) NOT NULL,
1042 v character varying(255) NOT NULL
1047 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1050 CREATE TABLE user_roles (
1051 id integer NOT NULL,
1052 user_id bigint NOT NULL,
1053 created_at timestamp without time zone,
1054 updated_at timestamp without time zone,
1055 role user_role_enum NOT NULL,
1056 granter_id bigint NOT NULL
1061 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1064 CREATE SEQUENCE user_roles_id_seq
1073 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1076 ALTER SEQUENCE user_roles_id_seq OWNED BY user_roles.id;
1080 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1083 CREATE TABLE user_tokens (
1085 user_id bigint NOT NULL,
1086 token character varying(255) NOT NULL,
1087 expiry timestamp without time zone NOT NULL,
1093 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1096 CREATE SEQUENCE user_tokens_id_seq
1105 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1108 ALTER SEQUENCE user_tokens_id_seq OWNED BY user_tokens.id;
1112 -- Name: users; Type: TABLE; Schema: public; Owner: -
1115 CREATE TABLE users (
1116 email character varying(255) NOT NULL,
1118 pass_crypt character varying(255) NOT NULL,
1119 creation_time timestamp without time zone NOT NULL,
1120 display_name character varying(255) DEFAULT ''::character varying NOT NULL,
1121 data_public boolean DEFAULT false NOT NULL,
1122 description text DEFAULT ''::text NOT NULL,
1123 home_lat double precision,
1124 home_lon double precision,
1125 home_zoom smallint DEFAULT 3,
1126 nearby integer DEFAULT 50,
1127 pass_salt character varying(255),
1128 image_file_name text,
1129 email_valid boolean DEFAULT false NOT NULL,
1130 new_email character varying(255),
1131 creation_ip character varying(255),
1132 languages character varying(255),
1133 status user_status_enum DEFAULT 'pending'::user_status_enum NOT NULL,
1134 terms_agreed timestamp without time zone,
1135 consider_pd boolean DEFAULT false NOT NULL,
1136 preferred_editor character varying(255),
1137 terms_seen boolean DEFAULT false NOT NULL,
1138 auth_uid character varying(255),
1139 description_format format_enum DEFAULT 'markdown'::format_enum NOT NULL,
1140 image_fingerprint character varying(255),
1141 changesets_count integer DEFAULT 0 NOT NULL,
1142 traces_count integer DEFAULT 0 NOT NULL,
1143 diary_entries_count integer DEFAULT 0 NOT NULL,
1144 image_use_gravatar boolean DEFAULT false NOT NULL,
1145 image_content_type character varying(255),
1146 auth_provider character varying
1151 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1154 CREATE SEQUENCE users_id_seq
1163 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1166 ALTER SEQUENCE users_id_seq OWNED BY users.id;
1170 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1173 CREATE TABLE way_nodes (
1174 way_id bigint NOT NULL,
1175 node_id bigint NOT NULL,
1176 version bigint NOT NULL,
1177 sequence_id bigint NOT NULL
1182 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1185 CREATE TABLE way_tags (
1186 way_id bigint DEFAULT 0 NOT NULL,
1187 k character varying(255) NOT NULL,
1188 v character varying(255) NOT NULL,
1189 version bigint NOT NULL
1194 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1198 way_id bigint DEFAULT 0 NOT NULL,
1199 changeset_id bigint NOT NULL,
1200 "timestamp" timestamp without time zone NOT NULL,
1201 version bigint NOT NULL,
1202 visible boolean DEFAULT true NOT NULL,
1203 redaction_id integer
1208 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1211 ALTER TABLE ONLY acls ALTER COLUMN id SET DEFAULT nextval('acls_id_seq'::regclass);
1215 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1218 ALTER TABLE ONLY changeset_comments ALTER COLUMN id SET DEFAULT nextval('changeset_comments_id_seq'::regclass);
1222 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1225 ALTER TABLE ONLY changesets ALTER COLUMN id SET DEFAULT nextval('changesets_id_seq'::regclass);
1229 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1232 ALTER TABLE ONLY client_applications ALTER COLUMN id SET DEFAULT nextval('client_applications_id_seq'::regclass);
1236 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1239 ALTER TABLE ONLY current_nodes ALTER COLUMN id SET DEFAULT nextval('current_nodes_id_seq'::regclass);
1243 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1246 ALTER TABLE ONLY current_relations ALTER COLUMN id SET DEFAULT nextval('current_relations_id_seq'::regclass);
1250 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1253 ALTER TABLE ONLY current_ways ALTER COLUMN id SET DEFAULT nextval('current_ways_id_seq'::regclass);
1257 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1260 ALTER TABLE ONLY diary_comments ALTER COLUMN id SET DEFAULT nextval('diary_comments_id_seq'::regclass);
1264 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1267 ALTER TABLE ONLY diary_entries ALTER COLUMN id SET DEFAULT nextval('diary_entries_id_seq'::regclass);
1271 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1274 ALTER TABLE ONLY friends ALTER COLUMN id SET DEFAULT nextval('friends_id_seq'::regclass);
1278 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1281 ALTER TABLE ONLY gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('gpx_file_tags_id_seq'::regclass);
1285 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1288 ALTER TABLE ONLY gpx_files ALTER COLUMN id SET DEFAULT nextval('gpx_files_id_seq'::regclass);
1292 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1295 ALTER TABLE ONLY messages ALTER COLUMN id SET DEFAULT nextval('messages_id_seq'::regclass);
1299 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1302 ALTER TABLE ONLY note_comments ALTER COLUMN id SET DEFAULT nextval('note_comments_id_seq'::regclass);
1306 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1309 ALTER TABLE ONLY notes ALTER COLUMN id SET DEFAULT nextval('notes_id_seq'::regclass);
1313 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1316 ALTER TABLE ONLY oauth_nonces ALTER COLUMN id SET DEFAULT nextval('oauth_nonces_id_seq'::regclass);
1320 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1323 ALTER TABLE ONLY oauth_tokens ALTER COLUMN id SET DEFAULT nextval('oauth_tokens_id_seq'::regclass);
1327 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1330 ALTER TABLE ONLY redactions ALTER COLUMN id SET DEFAULT nextval('redactions_id_seq'::regclass);
1334 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1337 ALTER TABLE ONLY user_blocks ALTER COLUMN id SET DEFAULT nextval('user_blocks_id_seq'::regclass);
1341 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1344 ALTER TABLE ONLY user_roles ALTER COLUMN id SET DEFAULT nextval('user_roles_id_seq'::regclass);
1348 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1351 ALTER TABLE ONLY user_tokens ALTER COLUMN id SET DEFAULT nextval('user_tokens_id_seq'::regclass);
1355 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1358 ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
1362 -- Name: acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1365 ALTER TABLE ONLY acls
1366 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1370 -- Name: ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1373 ALTER TABLE ONLY ar_internal_metadata
1374 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1378 -- Name: changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1381 ALTER TABLE ONLY changeset_comments
1382 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1386 -- Name: changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1389 ALTER TABLE ONLY changesets
1390 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1394 -- Name: client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1397 ALTER TABLE ONLY client_applications
1398 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1402 -- Name: current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1405 ALTER TABLE ONLY current_node_tags
1406 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1410 -- Name: current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1413 ALTER TABLE ONLY current_nodes
1414 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1418 -- Name: current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1421 ALTER TABLE ONLY current_relation_members
1422 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1426 -- Name: current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1429 ALTER TABLE ONLY current_relation_tags
1430 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1434 -- Name: current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1437 ALTER TABLE ONLY current_relations
1438 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1442 -- Name: current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1445 ALTER TABLE ONLY current_way_nodes
1446 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1450 -- Name: current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1453 ALTER TABLE ONLY current_way_tags
1454 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1458 -- Name: current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1461 ALTER TABLE ONLY current_ways
1462 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1466 -- Name: diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1469 ALTER TABLE ONLY diary_comments
1470 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1474 -- Name: diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1477 ALTER TABLE ONLY diary_entries
1478 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1482 -- Name: diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1485 ALTER TABLE ONLY diary_entry_subscriptions
1486 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1490 -- Name: friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1493 ALTER TABLE ONLY friends
1494 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1498 -- Name: gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1501 ALTER TABLE ONLY gpx_file_tags
1502 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1506 -- Name: gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1509 ALTER TABLE ONLY gpx_files
1510 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1514 -- Name: languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1517 ALTER TABLE ONLY languages
1518 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1522 -- Name: messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1525 ALTER TABLE ONLY messages
1526 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1530 -- Name: node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1533 ALTER TABLE ONLY node_tags
1534 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1538 -- Name: nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1541 ALTER TABLE ONLY nodes
1542 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1546 -- Name: note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1549 ALTER TABLE ONLY note_comments
1550 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1554 -- Name: notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1557 ALTER TABLE ONLY notes
1558 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1562 -- Name: oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1565 ALTER TABLE ONLY oauth_nonces
1566 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1570 -- Name: oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1573 ALTER TABLE ONLY oauth_tokens
1574 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1578 -- Name: redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1581 ALTER TABLE ONLY redactions
1582 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1586 -- Name: relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1589 ALTER TABLE ONLY relation_members
1590 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1594 -- Name: relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1597 ALTER TABLE ONLY relation_tags
1598 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1602 -- Name: relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1605 ALTER TABLE ONLY relations
1606 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1610 -- Name: user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1613 ALTER TABLE ONLY user_blocks
1614 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1618 -- Name: user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1621 ALTER TABLE ONLY user_preferences
1622 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1626 -- Name: user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1629 ALTER TABLE ONLY user_roles
1630 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1634 -- Name: user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1637 ALTER TABLE ONLY user_tokens
1638 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
1642 -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1645 ALTER TABLE ONLY users
1646 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
1650 -- Name: way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1653 ALTER TABLE ONLY way_nodes
1654 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
1658 -- Name: way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1661 ALTER TABLE ONLY way_tags
1662 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
1666 -- Name: ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1669 ALTER TABLE ONLY ways
1670 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
1674 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
1677 CREATE INDEX acls_k_idx ON acls USING btree (k);
1681 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
1684 CREATE INDEX changeset_tags_id_idx ON changeset_tags USING btree (changeset_id);
1688 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
1691 CREATE INDEX changesets_bbox_idx ON changesets USING gist (min_lat, max_lat, min_lon, max_lon);
1695 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
1698 CREATE INDEX changesets_closed_at_idx ON changesets USING btree (closed_at);
1702 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
1705 CREATE INDEX changesets_created_at_idx ON changesets USING btree (created_at);
1709 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
1712 CREATE INDEX changesets_user_id_created_at_idx ON changesets USING btree (user_id, created_at);
1716 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
1719 CREATE INDEX changesets_user_id_id_idx ON changesets USING btree (user_id, id);
1723 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
1726 CREATE INDEX current_nodes_tile_idx ON current_nodes USING btree (tile);
1730 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1733 CREATE INDEX current_nodes_timestamp_idx ON current_nodes USING btree ("timestamp");
1737 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
1740 CREATE INDEX current_relation_members_member_idx ON current_relation_members USING btree (member_type, member_id);
1744 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1747 CREATE INDEX current_relations_timestamp_idx ON current_relations USING btree ("timestamp");
1751 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
1754 CREATE INDEX current_way_nodes_node_idx ON current_way_nodes USING btree (node_id);
1758 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1761 CREATE INDEX current_ways_timestamp_idx ON current_ways USING btree ("timestamp");
1765 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
1768 CREATE INDEX diary_comment_user_id_created_at_index ON diary_comments USING btree (user_id, created_at);
1772 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
1775 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON diary_comments USING btree (diary_entry_id, id);
1779 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
1782 CREATE INDEX diary_entry_created_at_index ON diary_entries USING btree (created_at);
1786 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
1789 CREATE INDEX diary_entry_language_code_created_at_index ON diary_entries USING btree (language_code, created_at);
1793 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
1796 CREATE INDEX diary_entry_user_id_created_at_index ON diary_entries USING btree (user_id, created_at);
1800 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -
1803 CREATE INDEX friends_user_id_idx ON friends USING btree (user_id);
1807 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
1810 CREATE INDEX gpx_file_tags_gpxid_idx ON gpx_file_tags USING btree (gpx_id);
1814 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
1817 CREATE INDEX gpx_file_tags_tag_idx ON gpx_file_tags USING btree (tag);
1821 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1824 CREATE INDEX gpx_files_timestamp_idx ON gpx_files USING btree ("timestamp");
1828 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
1831 CREATE INDEX gpx_files_user_id_idx ON gpx_files USING btree (user_id);
1835 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
1838 CREATE INDEX gpx_files_visible_visibility_idx ON gpx_files USING btree (visible, visibility);
1842 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
1845 CREATE INDEX index_changeset_comments_on_created_at ON changeset_comments USING btree (created_at);
1849 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
1852 CREATE INDEX index_changesets_subscribers_on_changeset_id ON changesets_subscribers USING btree (changeset_id);
1856 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
1859 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON changesets_subscribers USING btree (subscriber_id, changeset_id);
1863 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
1866 CREATE UNIQUE INDEX index_client_applications_on_key ON client_applications USING btree (key);
1870 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
1873 CREATE INDEX index_client_applications_on_user_id ON client_applications USING btree (user_id);
1877 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
1880 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON diary_entry_subscriptions USING btree (diary_entry_id);
1884 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
1887 CREATE INDEX index_note_comments_on_body ON note_comments USING gin (to_tsvector('english'::regconfig, body));
1891 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
1894 CREATE INDEX index_note_comments_on_created_at ON note_comments USING btree (created_at);
1898 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
1901 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON oauth_nonces USING btree (nonce, "timestamp");
1905 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
1908 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON oauth_tokens USING btree (token);
1912 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
1915 CREATE INDEX index_oauth_tokens_on_user_id ON oauth_tokens USING btree (user_id);
1919 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
1922 CREATE INDEX index_user_blocks_on_user_id ON user_blocks USING btree (user_id);
1926 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
1929 CREATE INDEX messages_from_user_id_idx ON messages USING btree (from_user_id);
1933 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
1936 CREATE INDEX messages_to_user_id_idx ON messages USING btree (to_user_id);
1940 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
1943 CREATE INDEX nodes_changeset_id_idx ON nodes USING btree (changeset_id);
1947 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
1950 CREATE INDEX nodes_tile_idx ON nodes USING btree (tile);
1954 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1957 CREATE INDEX nodes_timestamp_idx ON nodes USING btree ("timestamp");
1961 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
1964 CREATE INDEX note_comments_note_id_idx ON note_comments USING btree (note_id);
1968 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
1971 CREATE INDEX notes_created_at_idx ON notes USING btree (created_at);
1975 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
1978 CREATE INDEX notes_tile_status_idx ON notes USING btree (tile, status);
1982 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
1985 CREATE INDEX notes_updated_at_idx ON notes USING btree (updated_at);
1989 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
1992 CREATE INDEX points_gpxid_idx ON gps_points USING btree (gpx_id);
1996 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
1999 CREATE INDEX points_tile_idx ON gps_points USING btree (tile);
2003 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2006 CREATE INDEX relation_members_member_idx ON relation_members USING btree (member_type, member_id);
2010 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2013 CREATE INDEX relations_changeset_id_idx ON relations USING btree (changeset_id);
2017 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2020 CREATE INDEX relations_timestamp_idx ON relations USING btree ("timestamp");
2024 -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -
2027 CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
2031 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2034 CREATE INDEX user_id_idx ON friends USING btree (friend_user_id);
2038 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2041 CREATE UNIQUE INDEX user_roles_id_role_unique ON user_roles USING btree (user_id, role);
2045 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2048 CREATE UNIQUE INDEX user_tokens_token_idx ON user_tokens USING btree (token);
2052 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2055 CREATE INDEX user_tokens_user_id_idx ON user_tokens USING btree (user_id);
2059 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2062 CREATE UNIQUE INDEX users_auth_idx ON users USING btree (auth_provider, auth_uid);
2066 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2069 CREATE UNIQUE INDEX users_display_name_idx ON users USING btree (display_name);
2073 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2076 CREATE INDEX users_display_name_lower_idx ON users USING btree (lower((display_name)::text));
2080 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2083 CREATE UNIQUE INDEX users_email_idx ON users USING btree (email);
2087 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2090 CREATE INDEX users_email_lower_idx ON users USING btree (lower((email)::text));
2094 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2097 CREATE INDEX way_nodes_node_idx ON way_nodes USING btree (node_id);
2101 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2104 CREATE INDEX ways_changeset_id_idx ON ways USING btree (changeset_id);
2108 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2111 CREATE INDEX ways_timestamp_idx ON ways USING btree ("timestamp");
2115 -- Name: changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2118 ALTER TABLE ONLY changeset_comments
2119 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES users(id);
2123 -- Name: changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2126 ALTER TABLE ONLY changeset_comments
2127 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2131 -- Name: changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2134 ALTER TABLE ONLY changeset_tags
2135 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2139 -- Name: changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2142 ALTER TABLE ONLY changesets_subscribers
2143 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2147 -- Name: changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2150 ALTER TABLE ONLY changesets_subscribers
2151 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES users(id);
2155 -- Name: changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2158 ALTER TABLE ONLY changesets
2159 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2163 -- Name: client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2166 ALTER TABLE ONLY client_applications
2167 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2171 -- Name: current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2174 ALTER TABLE ONLY current_node_tags
2175 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
2179 -- Name: current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2182 ALTER TABLE ONLY current_nodes
2183 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2187 -- Name: current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2190 ALTER TABLE ONLY current_relation_members
2191 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
2195 -- Name: current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2198 ALTER TABLE ONLY current_relation_tags
2199 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
2203 -- Name: current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2206 ALTER TABLE ONLY current_relations
2207 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2211 -- Name: current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2214 ALTER TABLE ONLY current_way_nodes
2215 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
2219 -- Name: current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2222 ALTER TABLE ONLY current_way_nodes
2223 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
2227 -- Name: current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2230 ALTER TABLE ONLY current_way_tags
2231 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
2235 -- Name: current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2238 ALTER TABLE ONLY current_ways
2239 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2243 -- Name: diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2246 ALTER TABLE ONLY diary_comments
2247 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES diary_entries(id);
2251 -- Name: diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2254 ALTER TABLE ONLY diary_comments
2255 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2259 -- Name: diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2262 ALTER TABLE ONLY diary_entries
2263 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES languages(code);
2267 -- Name: diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2270 ALTER TABLE ONLY diary_entries
2271 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2275 -- Name: diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2278 ALTER TABLE ONLY diary_entry_subscriptions
2279 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES diary_entries(id);
2283 -- Name: diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2286 ALTER TABLE ONLY diary_entry_subscriptions
2287 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2291 -- Name: friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2294 ALTER TABLE ONLY friends
2295 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES users(id);
2299 -- Name: friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2302 ALTER TABLE ONLY friends
2303 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2307 -- Name: gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2310 ALTER TABLE ONLY gps_points
2311 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
2315 -- Name: gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2318 ALTER TABLE ONLY gpx_file_tags
2319 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
2323 -- Name: gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2326 ALTER TABLE ONLY gpx_files
2327 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2331 -- Name: messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2334 ALTER TABLE ONLY messages
2335 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES users(id);
2339 -- Name: messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2342 ALTER TABLE ONLY messages
2343 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES users(id);
2347 -- Name: node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2350 ALTER TABLE ONLY node_tags
2351 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES nodes(node_id, version);
2355 -- Name: nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2358 ALTER TABLE ONLY nodes
2359 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2363 -- Name: nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2366 ALTER TABLE ONLY nodes
2367 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2371 -- Name: note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2374 ALTER TABLE ONLY note_comments
2375 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES users(id);
2379 -- Name: note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2382 ALTER TABLE ONLY note_comments
2383 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES notes(id);
2387 -- Name: oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2390 ALTER TABLE ONLY oauth_tokens
2391 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES client_applications(id);
2395 -- Name: oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2398 ALTER TABLE ONLY oauth_tokens
2399 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2403 -- Name: redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2406 ALTER TABLE ONLY redactions
2407 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2411 -- Name: relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2414 ALTER TABLE ONLY relation_members
2415 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2419 -- Name: relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2422 ALTER TABLE ONLY relation_tags
2423 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2427 -- Name: relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2430 ALTER TABLE ONLY relations
2431 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2435 -- Name: relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2438 ALTER TABLE ONLY relations
2439 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2443 -- Name: user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2446 ALTER TABLE ONLY user_blocks
2447 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES users(id);
2451 -- Name: user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2454 ALTER TABLE ONLY user_blocks
2455 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES users(id);
2459 -- Name: user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2462 ALTER TABLE ONLY user_blocks
2463 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2467 -- Name: user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2470 ALTER TABLE ONLY user_preferences
2471 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2475 -- Name: user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2478 ALTER TABLE ONLY user_roles
2479 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES users(id);
2483 -- Name: user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2486 ALTER TABLE ONLY user_roles
2487 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2491 -- Name: user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2494 ALTER TABLE ONLY user_tokens
2495 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2499 -- Name: way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2502 ALTER TABLE ONLY way_nodes
2503 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2507 -- Name: way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2510 ALTER TABLE ONLY way_tags
2511 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2515 -- Name: ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2518 ALTER TABLE ONLY ways
2519 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2523 -- Name: ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2526 ALTER TABLE ONLY ways
2527 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2531 -- PostgreSQL database dump complete
2534 SET search_path TO "$user", public;
2536 INSERT INTO "schema_migrations" (version) VALUES