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: issue_comments; Type: TABLE; Schema: public; Owner: -
692 CREATE TABLE issue_comments (
694 issue_id integer NOT NULL,
695 user_id integer NOT NULL,
697 created_at timestamp without time zone NOT NULL,
698 updated_at timestamp without time zone NOT NULL
703 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
706 CREATE SEQUENCE issue_comments_id_seq
715 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
718 ALTER SEQUENCE issue_comments_id_seq OWNED BY issue_comments.id;
722 -- Name: issues; Type: TABLE; Schema: public; Owner: -
725 CREATE TABLE issues (
727 reportable_type character varying NOT NULL,
728 reportable_id integer NOT NULL,
729 reported_user_id integer,
731 assigned_role user_role_enum NOT NULL,
732 resolved_at timestamp without time zone,
735 reports_count integer DEFAULT 0,
736 created_at timestamp without time zone NOT NULL,
737 updated_at timestamp without time zone NOT NULL
742 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
745 CREATE SEQUENCE issues_id_seq
754 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
757 ALTER SEQUENCE issues_id_seq OWNED BY issues.id;
761 -- Name: languages; Type: TABLE; Schema: public; Owner: -
764 CREATE TABLE languages (
765 code character varying(255) NOT NULL,
766 english_name character varying(255) NOT NULL,
767 native_name character varying(255)
772 -- Name: messages; Type: TABLE; Schema: public; Owner: -
775 CREATE TABLE messages (
777 from_user_id bigint NOT NULL,
778 title character varying(255) NOT NULL,
780 sent_on timestamp without time zone NOT NULL,
781 message_read boolean DEFAULT false NOT NULL,
782 to_user_id bigint NOT NULL,
783 to_user_visible boolean DEFAULT true NOT NULL,
784 from_user_visible boolean DEFAULT true NOT NULL,
785 body_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
790 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
793 CREATE SEQUENCE messages_id_seq
802 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
805 ALTER SEQUENCE messages_id_seq OWNED BY messages.id;
809 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
812 CREATE TABLE node_tags (
813 node_id bigint NOT NULL,
814 version bigint NOT NULL,
815 k character varying(255) DEFAULT ''::character varying NOT NULL,
816 v character varying(255) DEFAULT ''::character varying NOT NULL
821 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
825 node_id bigint NOT NULL,
826 latitude integer NOT NULL,
827 longitude integer NOT NULL,
828 changeset_id bigint NOT NULL,
829 visible boolean NOT NULL,
830 "timestamp" timestamp without time zone NOT NULL,
831 tile bigint NOT NULL,
832 version bigint NOT NULL,
838 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
841 CREATE TABLE note_comments (
843 note_id bigint NOT NULL,
844 visible boolean NOT NULL,
845 created_at timestamp without time zone NOT NULL,
849 event note_event_enum
854 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
857 CREATE SEQUENCE note_comments_id_seq
866 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
869 ALTER SEQUENCE note_comments_id_seq OWNED BY note_comments.id;
873 -- Name: notes; Type: TABLE; Schema: public; Owner: -
878 latitude integer NOT NULL,
879 longitude integer NOT NULL,
880 tile bigint NOT NULL,
881 updated_at timestamp without time zone NOT NULL,
882 created_at timestamp without time zone NOT NULL,
883 status note_status_enum NOT NULL,
884 closed_at timestamp without time zone
889 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
892 CREATE SEQUENCE notes_id_seq
901 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
904 ALTER SEQUENCE notes_id_seq OWNED BY notes.id;
908 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
911 CREATE TABLE oauth_nonces (
913 nonce character varying(255),
915 created_at timestamp without time zone,
916 updated_at timestamp without time zone
921 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
924 CREATE SEQUENCE oauth_nonces_id_seq
933 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
936 ALTER SEQUENCE oauth_nonces_id_seq OWNED BY oauth_nonces.id;
940 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
943 CREATE TABLE oauth_tokens (
946 type character varying(20),
947 client_application_id integer,
948 token character varying(50),
949 secret character varying(50),
950 authorized_at timestamp without time zone,
951 invalidated_at timestamp without time zone,
952 created_at timestamp without time zone,
953 updated_at timestamp without time zone,
954 allow_read_prefs boolean DEFAULT false NOT NULL,
955 allow_write_prefs boolean DEFAULT false NOT NULL,
956 allow_write_diary boolean DEFAULT false NOT NULL,
957 allow_write_api boolean DEFAULT false NOT NULL,
958 allow_read_gpx boolean DEFAULT false NOT NULL,
959 allow_write_gpx boolean DEFAULT false NOT NULL,
960 callback_url character varying(255),
961 verifier character varying(20),
962 scope character varying(255),
963 valid_to timestamp without time zone,
964 allow_write_notes boolean DEFAULT false NOT NULL
969 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
972 CREATE SEQUENCE oauth_tokens_id_seq
981 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
984 ALTER SEQUENCE oauth_tokens_id_seq OWNED BY oauth_tokens.id;
988 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
991 CREATE TABLE redactions (
993 title character varying(255),
995 created_at timestamp without time zone NOT NULL,
996 updated_at timestamp without time zone NOT NULL,
997 user_id bigint NOT NULL,
998 description_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
1003 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1006 CREATE SEQUENCE redactions_id_seq
1015 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1018 ALTER SEQUENCE redactions_id_seq OWNED BY redactions.id;
1022 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1025 CREATE TABLE relation_members (
1026 relation_id bigint DEFAULT 0 NOT NULL,
1027 member_type nwr_enum NOT NULL,
1028 member_id bigint NOT NULL,
1029 member_role character varying(255) NOT NULL,
1030 version bigint DEFAULT 0 NOT NULL,
1031 sequence_id integer DEFAULT 0 NOT NULL
1036 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1039 CREATE TABLE relation_tags (
1040 relation_id bigint DEFAULT 0 NOT NULL,
1041 k character varying(255) DEFAULT ''::character varying NOT NULL,
1042 v character varying(255) DEFAULT ''::character varying NOT NULL,
1043 version bigint NOT NULL
1048 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1051 CREATE TABLE relations (
1052 relation_id bigint DEFAULT 0 NOT NULL,
1053 changeset_id bigint NOT NULL,
1054 "timestamp" timestamp without time zone NOT NULL,
1055 version bigint NOT NULL,
1056 visible boolean DEFAULT true NOT NULL,
1057 redaction_id integer
1062 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1065 CREATE TABLE reports (
1066 id integer NOT NULL,
1069 details text NOT NULL,
1070 category character varying NOT NULL,
1071 created_at timestamp without time zone NOT NULL,
1072 updated_at timestamp without time zone NOT NULL
1077 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1080 CREATE SEQUENCE reports_id_seq
1089 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1092 ALTER SEQUENCE reports_id_seq OWNED BY reports.id;
1096 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1099 CREATE TABLE schema_migrations (
1100 version character varying(255) NOT NULL
1105 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1108 CREATE TABLE user_blocks (
1109 id integer NOT NULL,
1110 user_id bigint NOT NULL,
1111 creator_id bigint NOT NULL,
1112 reason text NOT NULL,
1113 ends_at timestamp without time zone NOT NULL,
1114 needs_view boolean DEFAULT false NOT NULL,
1116 created_at timestamp without time zone,
1117 updated_at timestamp without time zone,
1118 reason_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
1123 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1126 CREATE SEQUENCE user_blocks_id_seq
1135 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1138 ALTER SEQUENCE user_blocks_id_seq OWNED BY user_blocks.id;
1142 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1145 CREATE TABLE user_preferences (
1146 user_id bigint NOT NULL,
1147 k character varying(255) NOT NULL,
1148 v character varying(255) NOT NULL
1153 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1156 CREATE TABLE user_roles (
1157 id integer NOT NULL,
1158 user_id bigint NOT NULL,
1159 created_at timestamp without time zone,
1160 updated_at timestamp without time zone,
1161 role user_role_enum NOT NULL,
1162 granter_id bigint NOT NULL
1167 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1170 CREATE SEQUENCE user_roles_id_seq
1179 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1182 ALTER SEQUENCE user_roles_id_seq OWNED BY user_roles.id;
1186 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1189 CREATE TABLE user_tokens (
1191 user_id bigint NOT NULL,
1192 token character varying(255) NOT NULL,
1193 expiry timestamp without time zone NOT NULL,
1199 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1202 CREATE SEQUENCE user_tokens_id_seq
1211 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1214 ALTER SEQUENCE user_tokens_id_seq OWNED BY user_tokens.id;
1218 -- Name: users; Type: TABLE; Schema: public; Owner: -
1221 CREATE TABLE users (
1222 email character varying(255) NOT NULL,
1224 pass_crypt character varying(255) NOT NULL,
1225 creation_time timestamp without time zone NOT NULL,
1226 display_name character varying(255) DEFAULT ''::character varying NOT NULL,
1227 data_public boolean DEFAULT false NOT NULL,
1228 description text DEFAULT ''::text NOT NULL,
1229 home_lat double precision,
1230 home_lon double precision,
1231 home_zoom smallint DEFAULT 3,
1232 nearby integer DEFAULT 50,
1233 pass_salt character varying(255),
1234 image_file_name text,
1235 email_valid boolean DEFAULT false NOT NULL,
1236 new_email character varying(255),
1237 creation_ip character varying(255),
1238 languages character varying(255),
1239 status user_status_enum DEFAULT 'pending'::user_status_enum NOT NULL,
1240 terms_agreed timestamp without time zone,
1241 consider_pd boolean DEFAULT false NOT NULL,
1242 preferred_editor character varying(255),
1243 terms_seen boolean DEFAULT false NOT NULL,
1244 auth_uid character varying(255),
1245 description_format format_enum DEFAULT 'markdown'::format_enum NOT NULL,
1246 image_fingerprint character varying(255),
1247 changesets_count integer DEFAULT 0 NOT NULL,
1248 traces_count integer DEFAULT 0 NOT NULL,
1249 diary_entries_count integer DEFAULT 0 NOT NULL,
1250 image_use_gravatar boolean DEFAULT false NOT NULL,
1251 image_content_type character varying(255),
1252 auth_provider character varying
1257 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1260 CREATE SEQUENCE users_id_seq
1269 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1272 ALTER SEQUENCE users_id_seq OWNED BY users.id;
1276 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1279 CREATE TABLE way_nodes (
1280 way_id bigint NOT NULL,
1281 node_id bigint NOT NULL,
1282 version bigint NOT NULL,
1283 sequence_id bigint NOT NULL
1288 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1291 CREATE TABLE way_tags (
1292 way_id bigint DEFAULT 0 NOT NULL,
1293 k character varying(255) NOT NULL,
1294 v character varying(255) NOT NULL,
1295 version bigint NOT NULL
1300 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1304 way_id bigint DEFAULT 0 NOT NULL,
1305 changeset_id bigint NOT NULL,
1306 "timestamp" timestamp without time zone NOT NULL,
1307 version bigint NOT NULL,
1308 visible boolean DEFAULT true NOT NULL,
1309 redaction_id integer
1314 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1317 ALTER TABLE ONLY acls ALTER COLUMN id SET DEFAULT nextval('acls_id_seq'::regclass);
1321 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1324 ALTER TABLE ONLY changeset_comments ALTER COLUMN id SET DEFAULT nextval('changeset_comments_id_seq'::regclass);
1328 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1331 ALTER TABLE ONLY changesets ALTER COLUMN id SET DEFAULT nextval('changesets_id_seq'::regclass);
1335 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1338 ALTER TABLE ONLY client_applications ALTER COLUMN id SET DEFAULT nextval('client_applications_id_seq'::regclass);
1342 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1345 ALTER TABLE ONLY current_nodes ALTER COLUMN id SET DEFAULT nextval('current_nodes_id_seq'::regclass);
1349 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1352 ALTER TABLE ONLY current_relations ALTER COLUMN id SET DEFAULT nextval('current_relations_id_seq'::regclass);
1356 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1359 ALTER TABLE ONLY current_ways ALTER COLUMN id SET DEFAULT nextval('current_ways_id_seq'::regclass);
1363 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1366 ALTER TABLE ONLY diary_comments ALTER COLUMN id SET DEFAULT nextval('diary_comments_id_seq'::regclass);
1370 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1373 ALTER TABLE ONLY diary_entries ALTER COLUMN id SET DEFAULT nextval('diary_entries_id_seq'::regclass);
1377 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1380 ALTER TABLE ONLY friends ALTER COLUMN id SET DEFAULT nextval('friends_id_seq'::regclass);
1384 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1387 ALTER TABLE ONLY gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('gpx_file_tags_id_seq'::regclass);
1391 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1394 ALTER TABLE ONLY gpx_files ALTER COLUMN id SET DEFAULT nextval('gpx_files_id_seq'::regclass);
1398 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1401 ALTER TABLE ONLY issue_comments ALTER COLUMN id SET DEFAULT nextval('issue_comments_id_seq'::regclass);
1405 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1408 ALTER TABLE ONLY issues ALTER COLUMN id SET DEFAULT nextval('issues_id_seq'::regclass);
1412 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1415 ALTER TABLE ONLY messages ALTER COLUMN id SET DEFAULT nextval('messages_id_seq'::regclass);
1419 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1422 ALTER TABLE ONLY note_comments ALTER COLUMN id SET DEFAULT nextval('note_comments_id_seq'::regclass);
1426 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1429 ALTER TABLE ONLY notes ALTER COLUMN id SET DEFAULT nextval('notes_id_seq'::regclass);
1433 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1436 ALTER TABLE ONLY oauth_nonces ALTER COLUMN id SET DEFAULT nextval('oauth_nonces_id_seq'::regclass);
1440 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1443 ALTER TABLE ONLY oauth_tokens ALTER COLUMN id SET DEFAULT nextval('oauth_tokens_id_seq'::regclass);
1447 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1450 ALTER TABLE ONLY redactions ALTER COLUMN id SET DEFAULT nextval('redactions_id_seq'::regclass);
1454 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1457 ALTER TABLE ONLY reports ALTER COLUMN id SET DEFAULT nextval('reports_id_seq'::regclass);
1461 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1464 ALTER TABLE ONLY user_blocks ALTER COLUMN id SET DEFAULT nextval('user_blocks_id_seq'::regclass);
1468 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1471 ALTER TABLE ONLY user_roles ALTER COLUMN id SET DEFAULT nextval('user_roles_id_seq'::regclass);
1475 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1478 ALTER TABLE ONLY user_tokens ALTER COLUMN id SET DEFAULT nextval('user_tokens_id_seq'::regclass);
1482 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1485 ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
1489 -- Name: acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1492 ALTER TABLE ONLY acls
1493 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1497 -- Name: ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1500 ALTER TABLE ONLY ar_internal_metadata
1501 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1505 -- Name: changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1508 ALTER TABLE ONLY changeset_comments
1509 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1513 -- Name: changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1516 ALTER TABLE ONLY changesets
1517 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1521 -- Name: client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1524 ALTER TABLE ONLY client_applications
1525 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1529 -- Name: current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1532 ALTER TABLE ONLY current_node_tags
1533 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1537 -- Name: current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1540 ALTER TABLE ONLY current_nodes
1541 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1545 -- Name: current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1548 ALTER TABLE ONLY current_relation_members
1549 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1553 -- Name: current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1556 ALTER TABLE ONLY current_relation_tags
1557 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1561 -- Name: current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1564 ALTER TABLE ONLY current_relations
1565 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1569 -- Name: current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1572 ALTER TABLE ONLY current_way_nodes
1573 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1577 -- Name: current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1580 ALTER TABLE ONLY current_way_tags
1581 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1585 -- Name: current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1588 ALTER TABLE ONLY current_ways
1589 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1593 -- Name: diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1596 ALTER TABLE ONLY diary_comments
1597 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1601 -- Name: diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1604 ALTER TABLE ONLY diary_entries
1605 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1609 -- Name: diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1612 ALTER TABLE ONLY diary_entry_subscriptions
1613 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1617 -- Name: friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1620 ALTER TABLE ONLY friends
1621 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1625 -- Name: gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1628 ALTER TABLE ONLY gpx_file_tags
1629 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1633 -- Name: gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1636 ALTER TABLE ONLY gpx_files
1637 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1641 -- Name: issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1644 ALTER TABLE ONLY issue_comments
1645 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1649 -- Name: issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1652 ALTER TABLE ONLY issues
1653 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
1657 -- Name: languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1660 ALTER TABLE ONLY languages
1661 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1665 -- Name: messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1668 ALTER TABLE ONLY messages
1669 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1673 -- Name: node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1676 ALTER TABLE ONLY node_tags
1677 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1681 -- Name: nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1684 ALTER TABLE ONLY nodes
1685 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1689 -- Name: note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1692 ALTER TABLE ONLY note_comments
1693 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1697 -- Name: notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1700 ALTER TABLE ONLY notes
1701 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1705 -- Name: oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1708 ALTER TABLE ONLY oauth_nonces
1709 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1713 -- Name: oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1716 ALTER TABLE ONLY oauth_tokens
1717 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1721 -- Name: redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1724 ALTER TABLE ONLY redactions
1725 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1729 -- Name: relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1732 ALTER TABLE ONLY relation_members
1733 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1737 -- Name: relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1740 ALTER TABLE ONLY relation_tags
1741 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1745 -- Name: relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1748 ALTER TABLE ONLY relations
1749 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1753 -- Name: reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1756 ALTER TABLE ONLY reports
1757 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
1761 -- Name: user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1764 ALTER TABLE ONLY user_blocks
1765 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1769 -- Name: user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1772 ALTER TABLE ONLY user_preferences
1773 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1777 -- Name: user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1780 ALTER TABLE ONLY user_roles
1781 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1785 -- Name: user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1788 ALTER TABLE ONLY user_tokens
1789 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
1793 -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1796 ALTER TABLE ONLY users
1797 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
1801 -- Name: way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1804 ALTER TABLE ONLY way_nodes
1805 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
1809 -- Name: way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1812 ALTER TABLE ONLY way_tags
1813 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
1817 -- Name: ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1820 ALTER TABLE ONLY ways
1821 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
1825 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
1828 CREATE INDEX acls_k_idx ON acls USING btree (k);
1832 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
1835 CREATE INDEX changeset_tags_id_idx ON changeset_tags USING btree (changeset_id);
1839 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
1842 CREATE INDEX changesets_bbox_idx ON changesets USING gist (min_lat, max_lat, min_lon, max_lon);
1846 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
1849 CREATE INDEX changesets_closed_at_idx ON changesets USING btree (closed_at);
1853 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
1856 CREATE INDEX changesets_created_at_idx ON changesets USING btree (created_at);
1860 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
1863 CREATE INDEX changesets_user_id_created_at_idx ON changesets USING btree (user_id, created_at);
1867 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
1870 CREATE INDEX changesets_user_id_id_idx ON changesets USING btree (user_id, id);
1874 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
1877 CREATE INDEX current_nodes_tile_idx ON current_nodes USING btree (tile);
1881 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1884 CREATE INDEX current_nodes_timestamp_idx ON current_nodes USING btree ("timestamp");
1888 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
1891 CREATE INDEX current_relation_members_member_idx ON current_relation_members USING btree (member_type, member_id);
1895 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1898 CREATE INDEX current_relations_timestamp_idx ON current_relations USING btree ("timestamp");
1902 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
1905 CREATE INDEX current_way_nodes_node_idx ON current_way_nodes USING btree (node_id);
1909 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1912 CREATE INDEX current_ways_timestamp_idx ON current_ways USING btree ("timestamp");
1916 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
1919 CREATE INDEX diary_comment_user_id_created_at_index ON diary_comments USING btree (user_id, created_at);
1923 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
1926 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON diary_comments USING btree (diary_entry_id, id);
1930 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
1933 CREATE INDEX diary_entry_created_at_index ON diary_entries USING btree (created_at);
1937 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
1940 CREATE INDEX diary_entry_language_code_created_at_index ON diary_entries USING btree (language_code, created_at);
1944 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
1947 CREATE INDEX diary_entry_user_id_created_at_index ON diary_entries USING btree (user_id, created_at);
1951 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -
1954 CREATE INDEX friends_user_id_idx ON friends USING btree (user_id);
1958 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
1961 CREATE INDEX gpx_file_tags_gpxid_idx ON gpx_file_tags USING btree (gpx_id);
1965 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
1968 CREATE INDEX gpx_file_tags_tag_idx ON gpx_file_tags USING btree (tag);
1972 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1975 CREATE INDEX gpx_files_timestamp_idx ON gpx_files USING btree ("timestamp");
1979 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
1982 CREATE INDEX gpx_files_user_id_idx ON gpx_files USING btree (user_id);
1986 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
1989 CREATE INDEX gpx_files_visible_visibility_idx ON gpx_files USING btree (visible, visibility);
1993 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
1996 CREATE INDEX index_changeset_comments_on_created_at ON changeset_comments USING btree (created_at);
2000 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2003 CREATE INDEX index_changesets_subscribers_on_changeset_id ON changesets_subscribers USING btree (changeset_id);
2007 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2010 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON changesets_subscribers USING btree (subscriber_id, changeset_id);
2014 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2017 CREATE UNIQUE INDEX index_client_applications_on_key ON client_applications USING btree (key);
2021 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2024 CREATE INDEX index_client_applications_on_user_id ON client_applications USING btree (user_id);
2028 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2031 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON diary_entry_subscriptions USING btree (diary_entry_id);
2035 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2038 CREATE INDEX index_issue_comments_on_issue_id ON issue_comments USING btree (issue_id);
2042 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2045 CREATE INDEX index_issue_comments_on_user_id ON issue_comments USING btree (user_id);
2049 -- Name: index_issues_on_reportable_id_and_reportable_type; Type: INDEX; Schema: public; Owner: -
2052 CREATE INDEX index_issues_on_reportable_id_and_reportable_type ON issues USING btree (reportable_id, reportable_type);
2056 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2059 CREATE INDEX index_issues_on_reported_user_id ON issues USING btree (reported_user_id);
2063 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2066 CREATE INDEX index_issues_on_updated_by ON issues USING btree (updated_by);
2070 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2073 CREATE INDEX index_note_comments_on_body ON note_comments USING gin (to_tsvector('english'::regconfig, body));
2077 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2080 CREATE INDEX index_note_comments_on_created_at ON note_comments USING btree (created_at);
2084 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2087 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON oauth_nonces USING btree (nonce, "timestamp");
2091 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2094 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON oauth_tokens USING btree (token);
2098 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2101 CREATE INDEX index_oauth_tokens_on_user_id ON oauth_tokens USING btree (user_id);
2105 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2108 CREATE INDEX index_reports_on_issue_id ON reports USING btree (issue_id);
2112 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2115 CREATE INDEX index_reports_on_user_id ON reports USING btree (user_id);
2119 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2122 CREATE INDEX index_user_blocks_on_user_id ON user_blocks USING btree (user_id);
2126 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2129 CREATE INDEX messages_from_user_id_idx ON messages USING btree (from_user_id);
2133 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2136 CREATE INDEX messages_to_user_id_idx ON messages USING btree (to_user_id);
2140 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2143 CREATE INDEX nodes_changeset_id_idx ON nodes USING btree (changeset_id);
2147 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2150 CREATE INDEX nodes_tile_idx ON nodes USING btree (tile);
2154 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2157 CREATE INDEX nodes_timestamp_idx ON nodes USING btree ("timestamp");
2161 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2164 CREATE INDEX note_comments_note_id_idx ON note_comments USING btree (note_id);
2168 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2171 CREATE INDEX notes_created_at_idx ON notes USING btree (created_at);
2175 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2178 CREATE INDEX notes_tile_status_idx ON notes USING btree (tile, status);
2182 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2185 CREATE INDEX notes_updated_at_idx ON notes USING btree (updated_at);
2189 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2192 CREATE INDEX points_gpxid_idx ON gps_points USING btree (gpx_id);
2196 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2199 CREATE INDEX points_tile_idx ON gps_points USING btree (tile);
2203 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2206 CREATE INDEX relation_members_member_idx ON relation_members USING btree (member_type, member_id);
2210 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2213 CREATE INDEX relations_changeset_id_idx ON relations USING btree (changeset_id);
2217 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2220 CREATE INDEX relations_timestamp_idx ON relations USING btree ("timestamp");
2224 -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -
2227 CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
2231 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2234 CREATE INDEX user_id_idx ON friends USING btree (friend_user_id);
2238 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2241 CREATE UNIQUE INDEX user_roles_id_role_unique ON user_roles USING btree (user_id, role);
2245 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2248 CREATE UNIQUE INDEX user_tokens_token_idx ON user_tokens USING btree (token);
2252 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2255 CREATE INDEX user_tokens_user_id_idx ON user_tokens USING btree (user_id);
2259 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2262 CREATE UNIQUE INDEX users_auth_idx ON users USING btree (auth_provider, auth_uid);
2266 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2269 CREATE UNIQUE INDEX users_display_name_idx ON users USING btree (display_name);
2273 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2276 CREATE INDEX users_display_name_lower_idx ON users USING btree (lower((display_name)::text));
2280 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2283 CREATE UNIQUE INDEX users_email_idx ON users USING btree (email);
2287 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2290 CREATE INDEX users_email_lower_idx ON users USING btree (lower((email)::text));
2294 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2297 CREATE INDEX way_nodes_node_idx ON way_nodes USING btree (node_id);
2301 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2304 CREATE INDEX ways_changeset_id_idx ON ways USING btree (changeset_id);
2308 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2311 CREATE INDEX ways_timestamp_idx ON ways USING btree ("timestamp");
2315 -- Name: changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2318 ALTER TABLE ONLY changeset_comments
2319 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES users(id);
2323 -- Name: changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2326 ALTER TABLE ONLY changeset_comments
2327 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2331 -- Name: changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2334 ALTER TABLE ONLY changeset_tags
2335 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2339 -- Name: changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2342 ALTER TABLE ONLY changesets_subscribers
2343 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2347 -- Name: changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2350 ALTER TABLE ONLY changesets_subscribers
2351 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES users(id);
2355 -- Name: changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2358 ALTER TABLE ONLY changesets
2359 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2363 -- Name: client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2366 ALTER TABLE ONLY client_applications
2367 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2371 -- Name: current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2374 ALTER TABLE ONLY current_node_tags
2375 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
2379 -- Name: current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2382 ALTER TABLE ONLY current_nodes
2383 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2387 -- Name: current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2390 ALTER TABLE ONLY current_relation_members
2391 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
2395 -- Name: current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2398 ALTER TABLE ONLY current_relation_tags
2399 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
2403 -- Name: current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2406 ALTER TABLE ONLY current_relations
2407 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2411 -- Name: current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2414 ALTER TABLE ONLY current_way_nodes
2415 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
2419 -- Name: current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2422 ALTER TABLE ONLY current_way_nodes
2423 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
2427 -- Name: current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2430 ALTER TABLE ONLY current_way_tags
2431 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
2435 -- Name: current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2438 ALTER TABLE ONLY current_ways
2439 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2443 -- Name: diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2446 ALTER TABLE ONLY diary_comments
2447 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES diary_entries(id);
2451 -- Name: diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2454 ALTER TABLE ONLY diary_comments
2455 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2459 -- Name: diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2462 ALTER TABLE ONLY diary_entries
2463 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES languages(code);
2467 -- Name: diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2470 ALTER TABLE ONLY diary_entries
2471 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2475 -- Name: diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2478 ALTER TABLE ONLY diary_entry_subscriptions
2479 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES diary_entries(id);
2483 -- Name: diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2486 ALTER TABLE ONLY diary_entry_subscriptions
2487 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2491 -- Name: friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2494 ALTER TABLE ONLY friends
2495 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES users(id);
2499 -- Name: friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2502 ALTER TABLE ONLY friends
2503 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2507 -- Name: gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2510 ALTER TABLE ONLY gps_points
2511 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
2515 -- Name: gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2518 ALTER TABLE ONLY gpx_file_tags
2519 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
2523 -- Name: gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2526 ALTER TABLE ONLY gpx_files
2527 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2531 -- Name: issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2534 ALTER TABLE ONLY issue_comments
2535 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
2539 -- Name: issue_comments_user_id; Type: FK CONSTRAINT; Schema: public; Owner: -
2542 ALTER TABLE ONLY issue_comments
2543 ADD CONSTRAINT issue_comments_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
2547 -- Name: issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2550 ALTER TABLE ONLY issues
2551 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES users(id) ON DELETE CASCADE;
2555 -- Name: issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2558 ALTER TABLE ONLY issues
2559 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES users(id) ON DELETE CASCADE;
2563 -- Name: messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2566 ALTER TABLE ONLY messages
2567 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES users(id);
2571 -- Name: messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2574 ALTER TABLE ONLY messages
2575 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES users(id);
2579 -- Name: node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2582 ALTER TABLE ONLY node_tags
2583 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES nodes(node_id, version);
2587 -- Name: nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2590 ALTER TABLE ONLY nodes
2591 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2595 -- Name: nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2598 ALTER TABLE ONLY nodes
2599 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2603 -- Name: note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2606 ALTER TABLE ONLY note_comments
2607 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES users(id);
2611 -- Name: note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2614 ALTER TABLE ONLY note_comments
2615 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES notes(id);
2619 -- Name: oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2622 ALTER TABLE ONLY oauth_tokens
2623 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES client_applications(id);
2627 -- Name: oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2630 ALTER TABLE ONLY oauth_tokens
2631 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2635 -- Name: redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2638 ALTER TABLE ONLY redactions
2639 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2643 -- Name: relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2646 ALTER TABLE ONLY relation_members
2647 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2651 -- Name: relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2654 ALTER TABLE ONLY relation_tags
2655 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2659 -- Name: relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2662 ALTER TABLE ONLY relations
2663 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2667 -- Name: relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2670 ALTER TABLE ONLY relations
2671 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2675 -- Name: reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2678 ALTER TABLE ONLY reports
2679 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
2683 -- Name: reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2686 ALTER TABLE ONLY reports
2687 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
2691 -- Name: user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2694 ALTER TABLE ONLY user_blocks
2695 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES users(id);
2699 -- Name: user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2702 ALTER TABLE ONLY user_blocks
2703 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES users(id);
2707 -- Name: user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2710 ALTER TABLE ONLY user_blocks
2711 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2715 -- Name: user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2718 ALTER TABLE ONLY user_preferences
2719 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2723 -- Name: user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2726 ALTER TABLE ONLY user_roles
2727 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES users(id);
2731 -- Name: user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2734 ALTER TABLE ONLY user_roles
2735 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2739 -- Name: user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2742 ALTER TABLE ONLY user_tokens
2743 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2747 -- Name: way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2750 ALTER TABLE ONLY way_nodes
2751 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2755 -- Name: way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2758 ALTER TABLE ONLY way_tags
2759 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2763 -- Name: ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2766 ALTER TABLE ONLY ways
2767 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2771 -- Name: ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2774 ALTER TABLE ONLY ways
2775 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2779 -- PostgreSQL database dump complete
2782 SET search_path TO "$user", public;
2784 INSERT INTO "schema_migrations" (version) VALUES