1 SET statement_timeout = 0;
3 SET idle_in_transaction_session_timeout = 0;
4 SET client_encoding = 'UTF8';
5 SET standard_conforming_strings = on;
6 SELECT pg_catalog.set_config('search_path', '', false);
7 SET check_function_bodies = false;
8 SET client_min_messages = warning;
9 SET row_security = off;
12 -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
15 CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
19 -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
22 COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
26 -- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: -
29 CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public;
33 -- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: -
36 COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST';
40 -- Name: format_enum; Type: TYPE; Schema: public; Owner: -
43 CREATE TYPE public.format_enum AS ENUM (
51 -- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: -
54 CREATE TYPE public.gpx_visibility_enum AS ENUM (
63 -- Name: issue_status_enum; Type: TYPE; Schema: public; Owner: -
66 CREATE TYPE public.issue_status_enum AS ENUM (
74 -- Name: note_event_enum; Type: TYPE; Schema: public; Owner: -
77 CREATE TYPE public.note_event_enum AS ENUM (
87 -- Name: note_status_enum; Type: TYPE; Schema: public; Owner: -
90 CREATE TYPE public.note_status_enum AS ENUM (
98 -- Name: nwr_enum; Type: TYPE; Schema: public; Owner: -
101 CREATE TYPE public.nwr_enum AS ENUM (
109 -- Name: user_role_enum; Type: TYPE; Schema: public; Owner: -
112 CREATE TYPE public.user_role_enum AS ENUM (
119 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
122 CREATE TYPE public.user_status_enum AS ENUM (
132 -- Name: maptile_for_point(bigint, bigint, integer); Type: FUNCTION; Schema: public; Owner: -
135 CREATE FUNCTION public.maptile_for_point(bigint, bigint, integer) RETURNS integer
137 AS '$libdir/libpgosm.so', 'maptile_for_point';
141 -- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
144 CREATE FUNCTION public.tile_for_point(integer, integer) RETURNS bigint
146 AS '$libdir/libpgosm.so', 'tile_for_point';
150 -- Name: xid_to_int4(xid); Type: FUNCTION; Schema: public; Owner: -
153 CREATE FUNCTION public.xid_to_int4(xid) RETURNS integer
154 LANGUAGE c IMMUTABLE STRICT
155 AS '$libdir/libpgosm.so', 'xid_to_int4';
158 SET default_tablespace = '';
160 SET default_with_oids = false;
163 -- Name: acls; Type: TABLE; Schema: public; Owner: -
166 CREATE TABLE public.acls (
169 k character varying NOT NULL,
171 domain character varying
176 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
179 CREATE SEQUENCE public.acls_id_seq
188 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
191 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
195 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
198 CREATE TABLE public.ar_internal_metadata (
199 key character varying NOT NULL,
200 value character varying,
201 created_at timestamp without time zone NOT NULL,
202 updated_at timestamp without time zone NOT NULL
207 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
210 CREATE TABLE public.changeset_comments (
212 changeset_id bigint NOT NULL,
213 author_id bigint NOT NULL,
215 created_at timestamp without time zone NOT NULL,
216 visible boolean NOT NULL
221 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
224 CREATE SEQUENCE public.changeset_comments_id_seq
233 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
236 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
240 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
243 CREATE TABLE public.changeset_tags (
244 changeset_id bigint NOT NULL,
245 k character varying DEFAULT ''::character varying NOT NULL,
246 v character varying DEFAULT ''::character varying NOT NULL
251 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
254 CREATE TABLE public.changesets (
256 user_id bigint NOT NULL,
257 created_at timestamp without time zone NOT NULL,
262 closed_at timestamp without time zone NOT NULL,
263 num_changes integer DEFAULT 0 NOT NULL
268 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
271 CREATE SEQUENCE public.changesets_id_seq
280 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
283 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
287 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
290 CREATE TABLE public.changesets_subscribers (
291 subscriber_id bigint NOT NULL,
292 changeset_id bigint NOT NULL
297 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
300 CREATE TABLE public.client_applications (
302 name character varying,
303 url character varying,
304 support_url character varying,
305 callback_url character varying,
306 key character varying(50),
307 secret character varying(50),
309 created_at timestamp without time zone,
310 updated_at timestamp without time zone,
311 allow_read_prefs boolean DEFAULT false NOT NULL,
312 allow_write_prefs boolean DEFAULT false NOT NULL,
313 allow_write_diary boolean DEFAULT false NOT NULL,
314 allow_write_api boolean DEFAULT false NOT NULL,
315 allow_read_gpx boolean DEFAULT false NOT NULL,
316 allow_write_gpx boolean DEFAULT false NOT NULL,
317 allow_write_notes boolean DEFAULT false NOT NULL
322 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
325 CREATE SEQUENCE public.client_applications_id_seq
334 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
337 ALTER SEQUENCE public.client_applications_id_seq OWNED BY public.client_applications.id;
341 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
344 CREATE TABLE public.current_node_tags (
345 node_id bigint NOT NULL,
346 k character varying DEFAULT ''::character varying NOT NULL,
347 v character varying DEFAULT ''::character varying NOT NULL
352 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
355 CREATE TABLE public.current_nodes (
357 latitude integer NOT NULL,
358 longitude integer NOT NULL,
359 changeset_id bigint NOT NULL,
360 visible boolean NOT NULL,
361 "timestamp" timestamp without time zone NOT NULL,
362 tile bigint NOT NULL,
363 version bigint NOT NULL
368 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
371 CREATE SEQUENCE public.current_nodes_id_seq
380 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
383 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
387 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
390 CREATE TABLE public.current_relation_members (
391 relation_id bigint NOT NULL,
392 member_type public.nwr_enum NOT NULL,
393 member_id bigint NOT NULL,
394 member_role character varying NOT NULL,
395 sequence_id integer DEFAULT 0 NOT NULL
400 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
403 CREATE TABLE public.current_relation_tags (
404 relation_id bigint NOT NULL,
405 k character varying DEFAULT ''::character varying NOT NULL,
406 v character varying DEFAULT ''::character varying NOT NULL
411 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
414 CREATE TABLE public.current_relations (
416 changeset_id bigint NOT NULL,
417 "timestamp" timestamp without time zone NOT NULL,
418 visible boolean NOT NULL,
419 version bigint NOT NULL
424 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
427 CREATE SEQUENCE public.current_relations_id_seq
436 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
439 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
443 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
446 CREATE TABLE public.current_way_nodes (
447 way_id bigint NOT NULL,
448 node_id bigint NOT NULL,
449 sequence_id bigint NOT NULL
454 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
457 CREATE TABLE public.current_way_tags (
458 way_id bigint NOT NULL,
459 k character varying DEFAULT ''::character varying NOT NULL,
460 v character varying DEFAULT ''::character varying NOT NULL
465 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
468 CREATE TABLE public.current_ways (
470 changeset_id bigint NOT NULL,
471 "timestamp" timestamp without time zone NOT NULL,
472 visible boolean NOT NULL,
473 version bigint NOT NULL
478 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
481 CREATE SEQUENCE public.current_ways_id_seq
490 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
493 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
497 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
500 CREATE TABLE public.delayed_jobs (
502 priority integer DEFAULT 0 NOT NULL,
503 attempts integer DEFAULT 0 NOT NULL,
504 handler text NOT NULL,
506 run_at timestamp without time zone,
507 locked_at timestamp without time zone,
508 failed_at timestamp without time zone,
509 locked_by character varying,
510 queue character varying,
511 created_at timestamp without time zone,
512 updated_at timestamp without time zone
517 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
520 CREATE SEQUENCE public.delayed_jobs_id_seq
529 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
532 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
536 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
539 CREATE TABLE public.diary_comments (
541 diary_entry_id bigint NOT NULL,
542 user_id bigint NOT NULL,
544 created_at timestamp without time zone NOT NULL,
545 updated_at timestamp without time zone NOT NULL,
546 visible boolean DEFAULT true NOT NULL,
547 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
552 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
555 CREATE SEQUENCE public.diary_comments_id_seq
564 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
567 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
571 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
574 CREATE TABLE public.diary_entries (
576 user_id bigint NOT NULL,
577 title character varying NOT NULL,
579 created_at timestamp without time zone NOT NULL,
580 updated_at timestamp without time zone NOT NULL,
581 latitude double precision,
582 longitude double precision,
583 language_code character varying DEFAULT 'en'::character varying NOT NULL,
584 visible boolean DEFAULT true NOT NULL,
585 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
590 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
593 CREATE SEQUENCE public.diary_entries_id_seq
602 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
605 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
609 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
612 CREATE TABLE public.diary_entry_subscriptions (
613 user_id bigint NOT NULL,
614 diary_entry_id bigint NOT NULL
619 -- Name: friends; Type: TABLE; Schema: public; Owner: -
622 CREATE TABLE public.friends (
624 user_id bigint NOT NULL,
625 friend_user_id bigint NOT NULL
630 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
633 CREATE SEQUENCE public.friends_id_seq
642 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
645 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
649 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
652 CREATE TABLE public.gps_points (
653 altitude double precision,
654 trackid integer NOT NULL,
655 latitude integer NOT NULL,
656 longitude integer NOT NULL,
657 gpx_id bigint NOT NULL,
658 "timestamp" timestamp without time zone,
664 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
667 CREATE TABLE public.gpx_file_tags (
668 gpx_id bigint DEFAULT 0 NOT NULL,
669 tag character varying NOT NULL,
675 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
678 CREATE SEQUENCE public.gpx_file_tags_id_seq
687 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
690 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
694 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
697 CREATE TABLE public.gpx_files (
699 user_id bigint NOT NULL,
700 visible boolean DEFAULT true NOT NULL,
701 name character varying DEFAULT ''::character varying NOT NULL,
703 latitude double precision,
704 longitude double precision,
705 "timestamp" timestamp without time zone NOT NULL,
706 description character varying DEFAULT ''::character varying NOT NULL,
707 inserted boolean NOT NULL,
708 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
713 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
716 CREATE SEQUENCE public.gpx_files_id_seq
725 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
728 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
732 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
735 CREATE TABLE public.issue_comments (
737 issue_id integer NOT NULL,
738 user_id integer NOT NULL,
740 created_at timestamp without time zone NOT NULL,
741 updated_at timestamp without time zone NOT NULL
746 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
749 CREATE SEQUENCE public.issue_comments_id_seq
758 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
761 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
765 -- Name: issues; Type: TABLE; Schema: public; Owner: -
768 CREATE TABLE public.issues (
770 reportable_type character varying NOT NULL,
771 reportable_id integer NOT NULL,
772 reported_user_id integer,
773 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
774 assigned_role public.user_role_enum NOT NULL,
775 resolved_at timestamp without time zone,
778 reports_count integer DEFAULT 0,
779 created_at timestamp without time zone NOT NULL,
780 updated_at timestamp without time zone NOT NULL
785 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
788 CREATE SEQUENCE public.issues_id_seq
797 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
800 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
804 -- Name: languages; Type: TABLE; Schema: public; Owner: -
807 CREATE TABLE public.languages (
808 code character varying NOT NULL,
809 english_name character varying NOT NULL,
810 native_name character varying
815 -- Name: messages; Type: TABLE; Schema: public; Owner: -
818 CREATE TABLE public.messages (
820 from_user_id bigint NOT NULL,
821 title character varying NOT NULL,
823 sent_on timestamp without time zone NOT NULL,
824 message_read boolean DEFAULT false NOT NULL,
825 to_user_id bigint NOT NULL,
826 to_user_visible boolean DEFAULT true NOT NULL,
827 from_user_visible boolean DEFAULT true NOT NULL,
828 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
833 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
836 CREATE SEQUENCE public.messages_id_seq
845 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
848 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
852 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
855 CREATE TABLE public.node_tags (
856 node_id bigint NOT NULL,
857 version bigint NOT NULL,
858 k character varying DEFAULT ''::character varying NOT NULL,
859 v character varying DEFAULT ''::character varying NOT NULL
864 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
867 CREATE TABLE public.nodes (
868 node_id bigint NOT NULL,
869 latitude integer NOT NULL,
870 longitude integer NOT NULL,
871 changeset_id bigint NOT NULL,
872 visible boolean NOT NULL,
873 "timestamp" timestamp without time zone NOT NULL,
874 tile bigint NOT NULL,
875 version bigint NOT NULL,
881 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
884 CREATE TABLE public.note_comments (
886 note_id bigint NOT NULL,
887 visible boolean NOT NULL,
888 created_at timestamp without time zone NOT NULL,
892 event public.note_event_enum
897 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
900 CREATE SEQUENCE public.note_comments_id_seq
909 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
912 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
916 -- Name: notes; Type: TABLE; Schema: public; Owner: -
919 CREATE TABLE public.notes (
921 latitude integer NOT NULL,
922 longitude integer NOT NULL,
923 tile bigint NOT NULL,
924 updated_at timestamp without time zone NOT NULL,
925 created_at timestamp without time zone NOT NULL,
926 status public.note_status_enum NOT NULL,
927 closed_at timestamp without time zone
932 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
935 CREATE SEQUENCE public.notes_id_seq
944 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
947 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
951 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
954 CREATE TABLE public.oauth_nonces (
956 nonce character varying,
958 created_at timestamp without time zone,
959 updated_at timestamp without time zone
964 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
967 CREATE SEQUENCE public.oauth_nonces_id_seq
976 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
979 ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id;
983 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
986 CREATE TABLE public.oauth_tokens (
989 type character varying(20),
990 client_application_id integer,
991 token character varying(50),
992 secret character varying(50),
993 authorized_at timestamp without time zone,
994 invalidated_at timestamp without time zone,
995 created_at timestamp without time zone,
996 updated_at timestamp without time zone,
997 allow_read_prefs boolean DEFAULT false NOT NULL,
998 allow_write_prefs boolean DEFAULT false NOT NULL,
999 allow_write_diary boolean DEFAULT false NOT NULL,
1000 allow_write_api boolean DEFAULT false NOT NULL,
1001 allow_read_gpx boolean DEFAULT false NOT NULL,
1002 allow_write_gpx boolean DEFAULT false NOT NULL,
1003 callback_url character varying,
1004 verifier character varying(20),
1005 scope character varying,
1006 valid_to timestamp without time zone,
1007 allow_write_notes boolean DEFAULT false NOT NULL
1012 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1015 CREATE SEQUENCE public.oauth_tokens_id_seq
1024 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1027 ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
1031 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1034 CREATE TABLE public.redactions (
1035 id integer NOT NULL,
1036 title character varying,
1038 created_at timestamp without time zone,
1039 updated_at timestamp without time zone,
1040 user_id bigint NOT NULL,
1041 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1046 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1049 CREATE SEQUENCE public.redactions_id_seq
1058 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1061 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1065 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1068 CREATE TABLE public.relation_members (
1069 relation_id bigint DEFAULT 0 NOT NULL,
1070 member_type public.nwr_enum NOT NULL,
1071 member_id bigint NOT NULL,
1072 member_role character varying NOT NULL,
1073 version bigint DEFAULT 0 NOT NULL,
1074 sequence_id integer DEFAULT 0 NOT NULL
1079 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1082 CREATE TABLE public.relation_tags (
1083 relation_id bigint DEFAULT 0 NOT NULL,
1084 k character varying DEFAULT ''::character varying NOT NULL,
1085 v character varying DEFAULT ''::character varying NOT NULL,
1086 version bigint NOT NULL
1091 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1094 CREATE TABLE public.relations (
1095 relation_id bigint DEFAULT 0 NOT NULL,
1096 changeset_id bigint NOT NULL,
1097 "timestamp" timestamp without time zone NOT NULL,
1098 version bigint NOT NULL,
1099 visible boolean DEFAULT true NOT NULL,
1100 redaction_id integer
1105 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1108 CREATE TABLE public.reports (
1109 id integer NOT NULL,
1110 issue_id integer NOT NULL,
1111 user_id integer NOT NULL,
1112 details text NOT NULL,
1113 category character varying NOT NULL,
1114 created_at timestamp without time zone NOT NULL,
1115 updated_at timestamp without time zone NOT NULL
1120 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1123 CREATE SEQUENCE public.reports_id_seq
1132 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1135 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1139 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1142 CREATE TABLE public.schema_migrations (
1143 version character varying NOT NULL
1148 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1151 CREATE TABLE public.user_blocks (
1152 id integer NOT NULL,
1153 user_id bigint NOT NULL,
1154 creator_id bigint NOT NULL,
1155 reason text NOT NULL,
1156 ends_at timestamp without time zone NOT NULL,
1157 needs_view boolean DEFAULT false NOT NULL,
1159 created_at timestamp without time zone,
1160 updated_at timestamp without time zone,
1161 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1166 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1169 CREATE SEQUENCE public.user_blocks_id_seq
1178 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1181 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1185 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1188 CREATE TABLE public.user_preferences (
1189 user_id bigint NOT NULL,
1190 k character varying NOT NULL,
1191 v character varying NOT NULL
1196 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1199 CREATE TABLE public.user_roles (
1200 id integer NOT NULL,
1201 user_id bigint NOT NULL,
1202 role public.user_role_enum NOT NULL,
1203 created_at timestamp without time zone,
1204 updated_at timestamp without time zone,
1205 granter_id bigint NOT NULL
1210 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1213 CREATE SEQUENCE public.user_roles_id_seq
1222 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1225 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1229 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1232 CREATE TABLE public.user_tokens (
1234 user_id bigint NOT NULL,
1235 token character varying NOT NULL,
1236 expiry timestamp without time zone NOT NULL,
1242 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1245 CREATE SEQUENCE public.user_tokens_id_seq
1254 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1257 ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id;
1261 -- Name: users; Type: TABLE; Schema: public; Owner: -
1264 CREATE TABLE public.users (
1265 email character varying NOT NULL,
1267 pass_crypt character varying NOT NULL,
1268 creation_time timestamp without time zone NOT NULL,
1269 display_name character varying DEFAULT ''::character varying NOT NULL,
1270 data_public boolean DEFAULT false NOT NULL,
1271 description text DEFAULT ''::text NOT NULL,
1272 home_lat double precision,
1273 home_lon double precision,
1274 home_zoom smallint DEFAULT 3,
1275 nearby integer DEFAULT 50,
1276 pass_salt character varying,
1277 image_file_name text,
1278 email_valid boolean DEFAULT false NOT NULL,
1279 new_email character varying,
1280 creation_ip character varying,
1281 languages character varying,
1282 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1283 terms_agreed timestamp without time zone,
1284 consider_pd boolean DEFAULT false NOT NULL,
1285 auth_uid character varying,
1286 preferred_editor character varying,
1287 terms_seen boolean DEFAULT false NOT NULL,
1288 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1289 image_fingerprint character varying,
1290 changesets_count integer DEFAULT 0 NOT NULL,
1291 traces_count integer DEFAULT 0 NOT NULL,
1292 diary_entries_count integer DEFAULT 0 NOT NULL,
1293 image_use_gravatar boolean DEFAULT false NOT NULL,
1294 image_content_type character varying,
1295 auth_provider character varying,
1297 tou_agreed timestamp without time zone
1302 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1305 CREATE SEQUENCE public.users_id_seq
1314 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1317 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1321 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1324 CREATE TABLE public.way_nodes (
1325 way_id bigint NOT NULL,
1326 node_id bigint NOT NULL,
1327 version bigint NOT NULL,
1328 sequence_id bigint NOT NULL
1333 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1336 CREATE TABLE public.way_tags (
1337 way_id bigint DEFAULT 0 NOT NULL,
1338 k character varying NOT NULL,
1339 v character varying NOT NULL,
1340 version bigint NOT NULL
1345 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1348 CREATE TABLE public.ways (
1349 way_id bigint DEFAULT 0 NOT NULL,
1350 changeset_id bigint NOT NULL,
1351 "timestamp" timestamp without time zone NOT NULL,
1352 version bigint NOT NULL,
1353 visible boolean DEFAULT true NOT NULL,
1354 redaction_id integer
1359 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1362 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1366 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1369 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1373 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1376 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1380 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1383 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1387 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1390 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1394 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1397 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1401 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1404 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1408 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1411 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1415 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1418 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1422 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1425 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1429 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1432 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1436 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1439 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1443 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1446 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1450 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1453 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1457 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1460 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1464 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1467 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1471 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1474 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1478 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1481 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1485 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1488 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1492 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1495 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1499 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1502 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1506 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1509 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1513 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1516 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1520 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1523 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1527 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1530 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1534 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1537 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1541 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1544 ALTER TABLE ONLY public.acls
1545 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1549 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1552 ALTER TABLE ONLY public.ar_internal_metadata
1553 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1557 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1560 ALTER TABLE ONLY public.changeset_comments
1561 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1565 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1568 ALTER TABLE ONLY public.changesets
1569 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1573 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1576 ALTER TABLE ONLY public.client_applications
1577 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1581 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1584 ALTER TABLE ONLY public.current_node_tags
1585 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1589 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1592 ALTER TABLE ONLY public.current_nodes
1593 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1597 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1600 ALTER TABLE ONLY public.current_relation_members
1601 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1605 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1608 ALTER TABLE ONLY public.current_relation_tags
1609 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1613 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1616 ALTER TABLE ONLY public.current_relations
1617 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1621 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1624 ALTER TABLE ONLY public.current_way_nodes
1625 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1629 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1632 ALTER TABLE ONLY public.current_way_tags
1633 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1637 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1640 ALTER TABLE ONLY public.current_ways
1641 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1645 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1648 ALTER TABLE ONLY public.delayed_jobs
1649 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1653 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1656 ALTER TABLE ONLY public.diary_comments
1657 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1661 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1664 ALTER TABLE ONLY public.diary_entries
1665 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1669 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1672 ALTER TABLE ONLY public.diary_entry_subscriptions
1673 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1677 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1680 ALTER TABLE ONLY public.friends
1681 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1685 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1688 ALTER TABLE ONLY public.gpx_file_tags
1689 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1693 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1696 ALTER TABLE ONLY public.gpx_files
1697 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1701 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1704 ALTER TABLE ONLY public.issue_comments
1705 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1709 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1712 ALTER TABLE ONLY public.issues
1713 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
1717 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1720 ALTER TABLE ONLY public.languages
1721 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1725 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1728 ALTER TABLE ONLY public.messages
1729 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1733 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1736 ALTER TABLE ONLY public.node_tags
1737 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1741 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1744 ALTER TABLE ONLY public.nodes
1745 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1749 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1752 ALTER TABLE ONLY public.note_comments
1753 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1757 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1760 ALTER TABLE ONLY public.notes
1761 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1765 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1768 ALTER TABLE ONLY public.oauth_nonces
1769 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1773 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1776 ALTER TABLE ONLY public.oauth_tokens
1777 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1781 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1784 ALTER TABLE ONLY public.redactions
1785 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1789 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1792 ALTER TABLE ONLY public.relation_members
1793 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1797 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1800 ALTER TABLE ONLY public.relation_tags
1801 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1805 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1808 ALTER TABLE ONLY public.relations
1809 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1813 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1816 ALTER TABLE ONLY public.reports
1817 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
1821 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1824 ALTER TABLE ONLY public.schema_migrations
1825 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
1829 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1832 ALTER TABLE ONLY public.user_blocks
1833 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1837 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1840 ALTER TABLE ONLY public.user_preferences
1841 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1845 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1848 ALTER TABLE ONLY public.user_roles
1849 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1853 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1856 ALTER TABLE ONLY public.user_tokens
1857 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
1861 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1864 ALTER TABLE ONLY public.users
1865 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
1869 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1872 ALTER TABLE ONLY public.way_nodes
1873 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
1877 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1880 ALTER TABLE ONLY public.way_tags
1881 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
1885 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1888 ALTER TABLE ONLY public.ways
1889 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
1893 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
1896 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
1900 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
1903 CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id);
1907 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
1910 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
1914 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
1917 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
1921 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
1924 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
1928 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
1931 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
1935 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
1938 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
1942 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
1945 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
1949 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1952 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
1956 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
1959 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
1963 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1966 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
1970 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
1973 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
1977 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1980 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
1984 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
1987 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
1991 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
1994 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
1998 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2001 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2005 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2008 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2012 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2015 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2019 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2022 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2026 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -
2029 CREATE INDEX friends_user_id_idx ON public.friends USING btree (user_id);
2033 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2036 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2040 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2043 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2047 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2050 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2054 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2057 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2061 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2064 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2068 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2071 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2075 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2078 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2082 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2085 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2089 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2092 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2096 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2099 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2103 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2106 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2110 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2113 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2117 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2120 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2124 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2127 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2131 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2134 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2138 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2141 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2145 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2148 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2152 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2155 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2159 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2162 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2166 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2169 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2173 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2176 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2180 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2183 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2187 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2190 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2194 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2197 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2201 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2204 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2208 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2211 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2215 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2218 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2222 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2225 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2229 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2232 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2236 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2239 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2243 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2246 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2250 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2253 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2257 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2260 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2264 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2267 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2271 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2274 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2278 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2281 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2285 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2288 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2292 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2295 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2299 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2302 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2306 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2309 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2313 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2316 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2320 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2323 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2327 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2330 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2334 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2337 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2341 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2344 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2348 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2351 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2355 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2358 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2362 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2365 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2369 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2372 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2376 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2379 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2383 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2386 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2390 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2393 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2397 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2400 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2404 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2407 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2411 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2414 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2418 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2421 ALTER TABLE ONLY public.changeset_comments
2422 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2426 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2429 ALTER TABLE ONLY public.changeset_comments
2430 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2434 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2437 ALTER TABLE ONLY public.changeset_tags
2438 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2442 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2445 ALTER TABLE ONLY public.changesets_subscribers
2446 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2450 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2453 ALTER TABLE ONLY public.changesets_subscribers
2454 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2458 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2461 ALTER TABLE ONLY public.changesets
2462 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2466 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2469 ALTER TABLE ONLY public.client_applications
2470 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2474 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2477 ALTER TABLE ONLY public.current_node_tags
2478 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2482 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2485 ALTER TABLE ONLY public.current_nodes
2486 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2490 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2493 ALTER TABLE ONLY public.current_relation_members
2494 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2498 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2501 ALTER TABLE ONLY public.current_relation_tags
2502 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2506 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2509 ALTER TABLE ONLY public.current_relations
2510 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2514 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2517 ALTER TABLE ONLY public.current_way_nodes
2518 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2522 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2525 ALTER TABLE ONLY public.current_way_nodes
2526 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2530 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2533 ALTER TABLE ONLY public.current_way_tags
2534 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2538 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2541 ALTER TABLE ONLY public.current_ways
2542 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2546 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2549 ALTER TABLE ONLY public.diary_comments
2550 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2554 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2557 ALTER TABLE ONLY public.diary_comments
2558 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2562 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2565 ALTER TABLE ONLY public.diary_entries
2566 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
2570 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2573 ALTER TABLE ONLY public.diary_entries
2574 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2578 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2581 ALTER TABLE ONLY public.diary_entry_subscriptions
2582 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2586 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2589 ALTER TABLE ONLY public.diary_entry_subscriptions
2590 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2594 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2597 ALTER TABLE ONLY public.friends
2598 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
2602 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2605 ALTER TABLE ONLY public.friends
2606 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2610 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2613 ALTER TABLE ONLY public.gps_points
2614 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2618 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2621 ALTER TABLE ONLY public.gpx_file_tags
2622 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2626 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2629 ALTER TABLE ONLY public.gpx_files
2630 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2634 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2637 ALTER TABLE ONLY public.issue_comments
2638 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2642 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2645 ALTER TABLE ONLY public.issue_comments
2646 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2650 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2653 ALTER TABLE ONLY public.issues
2654 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
2658 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2661 ALTER TABLE ONLY public.issues
2662 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
2666 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2669 ALTER TABLE ONLY public.issues
2670 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
2674 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2677 ALTER TABLE ONLY public.messages
2678 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
2682 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2685 ALTER TABLE ONLY public.messages
2686 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
2690 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2693 ALTER TABLE ONLY public.node_tags
2694 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
2698 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2701 ALTER TABLE ONLY public.nodes
2702 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2706 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2709 ALTER TABLE ONLY public.nodes
2710 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2714 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2717 ALTER TABLE ONLY public.note_comments
2718 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2722 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2725 ALTER TABLE ONLY public.note_comments
2726 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
2730 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2733 ALTER TABLE ONLY public.oauth_tokens
2734 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
2738 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2741 ALTER TABLE ONLY public.oauth_tokens
2742 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2746 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2749 ALTER TABLE ONLY public.redactions
2750 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2754 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2757 ALTER TABLE ONLY public.relation_members
2758 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2762 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2765 ALTER TABLE ONLY public.relation_tags
2766 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2770 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2773 ALTER TABLE ONLY public.relations
2774 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2778 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2781 ALTER TABLE ONLY public.relations
2782 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2786 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2789 ALTER TABLE ONLY public.reports
2790 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2794 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2797 ALTER TABLE ONLY public.reports
2798 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2802 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2805 ALTER TABLE ONLY public.user_blocks
2806 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
2810 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2813 ALTER TABLE ONLY public.user_blocks
2814 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
2818 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2821 ALTER TABLE ONLY public.user_blocks
2822 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2826 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2829 ALTER TABLE ONLY public.user_preferences
2830 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2834 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2837 ALTER TABLE ONLY public.user_roles
2838 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
2842 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2845 ALTER TABLE ONLY public.user_roles
2846 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2850 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2853 ALTER TABLE ONLY public.user_tokens
2854 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2858 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2861 ALTER TABLE ONLY public.way_nodes
2862 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
2866 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2869 ALTER TABLE ONLY public.way_tags
2870 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
2874 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2877 ALTER TABLE ONLY public.ways
2878 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2882 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2885 ALTER TABLE ONLY public.ways
2886 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2890 -- PostgreSQL database dump complete
2893 SET search_path TO "$user", public;
2895 INSERT INTO "schema_migrations" (version) VALUES