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,
177 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
180 CREATE SEQUENCE public.acls_id_seq
189 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
192 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
196 -- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
199 CREATE TABLE public.active_storage_attachments (
201 name character varying NOT NULL,
202 record_type character varying NOT NULL,
203 record_id bigint NOT NULL,
204 blob_id bigint NOT NULL,
205 created_at timestamp without time zone NOT NULL
210 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
213 CREATE SEQUENCE public.active_storage_attachments_id_seq
222 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
225 ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
229 -- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
232 CREATE TABLE public.active_storage_blobs (
234 key character varying NOT NULL,
235 filename character varying NOT NULL,
236 content_type character varying,
238 byte_size bigint NOT NULL,
239 checksum character varying NOT NULL,
240 created_at timestamp without time zone NOT NULL
245 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
248 CREATE SEQUENCE public.active_storage_blobs_id_seq
257 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
260 ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
264 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
267 CREATE TABLE public.ar_internal_metadata (
268 key character varying NOT NULL,
269 value character varying,
270 created_at timestamp without time zone NOT NULL,
271 updated_at timestamp without time zone NOT NULL
276 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
279 CREATE TABLE public.changeset_comments (
281 changeset_id bigint NOT NULL,
282 author_id bigint NOT NULL,
284 created_at timestamp without time zone NOT NULL,
285 visible boolean NOT NULL
290 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
293 CREATE SEQUENCE public.changeset_comments_id_seq
302 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
305 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
309 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
312 CREATE TABLE public.changeset_tags (
313 changeset_id bigint NOT NULL,
314 k character varying DEFAULT ''::character varying NOT NULL,
315 v character varying DEFAULT ''::character varying NOT NULL
320 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
323 CREATE TABLE public.changesets (
325 user_id bigint NOT NULL,
326 created_at timestamp without time zone NOT NULL,
331 closed_at timestamp without time zone NOT NULL,
332 num_changes integer DEFAULT 0 NOT NULL
337 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
340 CREATE SEQUENCE public.changesets_id_seq
349 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
352 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
356 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
359 CREATE TABLE public.changesets_subscribers (
360 subscriber_id bigint NOT NULL,
361 changeset_id bigint NOT NULL
366 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
369 CREATE TABLE public.client_applications (
371 name character varying,
372 url character varying,
373 support_url character varying,
374 callback_url character varying,
375 key character varying(50),
376 secret character varying(50),
378 created_at timestamp without time zone,
379 updated_at timestamp without time zone,
380 allow_read_prefs boolean DEFAULT false NOT NULL,
381 allow_write_prefs boolean DEFAULT false NOT NULL,
382 allow_write_diary boolean DEFAULT false NOT NULL,
383 allow_write_api boolean DEFAULT false NOT NULL,
384 allow_read_gpx boolean DEFAULT false NOT NULL,
385 allow_write_gpx boolean DEFAULT false NOT NULL,
386 allow_write_notes boolean DEFAULT false NOT NULL
391 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
394 CREATE SEQUENCE public.client_applications_id_seq
403 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
406 ALTER SEQUENCE public.client_applications_id_seq OWNED BY public.client_applications.id;
410 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
413 CREATE TABLE public.current_node_tags (
414 node_id bigint NOT NULL,
415 k character varying DEFAULT ''::character varying NOT NULL,
416 v character varying DEFAULT ''::character varying NOT NULL
421 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
424 CREATE TABLE public.current_nodes (
426 latitude integer NOT NULL,
427 longitude integer NOT NULL,
428 changeset_id bigint NOT NULL,
429 visible boolean NOT NULL,
430 "timestamp" timestamp without time zone NOT NULL,
431 tile bigint NOT NULL,
432 version bigint NOT NULL
437 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
440 CREATE SEQUENCE public.current_nodes_id_seq
449 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
452 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
456 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
459 CREATE TABLE public.current_relation_members (
460 relation_id bigint NOT NULL,
461 member_type public.nwr_enum NOT NULL,
462 member_id bigint NOT NULL,
463 member_role character varying NOT NULL,
464 sequence_id integer DEFAULT 0 NOT NULL
469 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
472 CREATE TABLE public.current_relation_tags (
473 relation_id bigint NOT NULL,
474 k character varying DEFAULT ''::character varying NOT NULL,
475 v character varying DEFAULT ''::character varying NOT NULL
480 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
483 CREATE TABLE public.current_relations (
485 changeset_id bigint NOT NULL,
486 "timestamp" timestamp without time zone NOT NULL,
487 visible boolean NOT NULL,
488 version bigint NOT NULL
493 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
496 CREATE SEQUENCE public.current_relations_id_seq
505 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
508 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
512 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
515 CREATE TABLE public.current_way_nodes (
516 way_id bigint NOT NULL,
517 node_id bigint NOT NULL,
518 sequence_id bigint NOT NULL
523 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
526 CREATE TABLE public.current_way_tags (
527 way_id bigint NOT NULL,
528 k character varying DEFAULT ''::character varying NOT NULL,
529 v character varying DEFAULT ''::character varying NOT NULL
534 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
537 CREATE TABLE public.current_ways (
539 changeset_id bigint NOT NULL,
540 "timestamp" timestamp without time zone NOT NULL,
541 visible boolean NOT NULL,
542 version bigint NOT NULL
547 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
550 CREATE SEQUENCE public.current_ways_id_seq
559 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
562 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
566 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
569 CREATE TABLE public.delayed_jobs (
571 priority integer DEFAULT 0 NOT NULL,
572 attempts integer DEFAULT 0 NOT NULL,
573 handler text NOT NULL,
575 run_at timestamp without time zone,
576 locked_at timestamp without time zone,
577 failed_at timestamp without time zone,
578 locked_by character varying,
579 queue character varying,
580 created_at timestamp without time zone,
581 updated_at timestamp without time zone
586 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
589 CREATE SEQUENCE public.delayed_jobs_id_seq
598 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
601 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
605 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
608 CREATE TABLE public.diary_comments (
610 diary_entry_id bigint NOT NULL,
611 user_id bigint NOT NULL,
613 created_at timestamp without time zone NOT NULL,
614 updated_at timestamp without time zone NOT NULL,
615 visible boolean DEFAULT true NOT NULL,
616 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
621 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
624 CREATE SEQUENCE public.diary_comments_id_seq
633 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
636 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
640 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
643 CREATE TABLE public.diary_entries (
645 user_id bigint NOT NULL,
646 title character varying NOT NULL,
648 created_at timestamp without time zone NOT NULL,
649 updated_at timestamp without time zone NOT NULL,
650 latitude double precision,
651 longitude double precision,
652 language_code character varying DEFAULT 'en'::character varying NOT NULL,
653 visible boolean DEFAULT true NOT NULL,
654 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
659 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
662 CREATE SEQUENCE public.diary_entries_id_seq
671 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
674 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
678 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
681 CREATE TABLE public.diary_entry_subscriptions (
682 user_id bigint NOT NULL,
683 diary_entry_id bigint NOT NULL
688 -- Name: friends; Type: TABLE; Schema: public; Owner: -
691 CREATE TABLE public.friends (
693 user_id bigint NOT NULL,
694 friend_user_id bigint NOT NULL
699 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
702 CREATE SEQUENCE public.friends_id_seq
711 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
714 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
718 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
721 CREATE TABLE public.gps_points (
722 altitude double precision,
723 trackid integer NOT NULL,
724 latitude integer NOT NULL,
725 longitude integer NOT NULL,
726 gpx_id bigint NOT NULL,
727 "timestamp" timestamp without time zone,
733 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
736 CREATE TABLE public.gpx_file_tags (
737 gpx_id bigint DEFAULT 0 NOT NULL,
738 tag character varying NOT NULL,
744 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
747 CREATE SEQUENCE public.gpx_file_tags_id_seq
756 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
759 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
763 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
766 CREATE TABLE public.gpx_files (
768 user_id bigint NOT NULL,
769 visible boolean DEFAULT true NOT NULL,
770 name character varying DEFAULT ''::character varying NOT NULL,
772 latitude double precision,
773 longitude double precision,
774 "timestamp" timestamp without time zone NOT NULL,
775 description character varying DEFAULT ''::character varying NOT NULL,
776 inserted boolean NOT NULL,
777 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
782 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
785 CREATE SEQUENCE public.gpx_files_id_seq
794 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
797 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
801 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
804 CREATE TABLE public.issue_comments (
806 issue_id integer NOT NULL,
807 user_id integer NOT NULL,
809 created_at timestamp without time zone NOT NULL,
810 updated_at timestamp without time zone NOT NULL
815 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
818 CREATE SEQUENCE public.issue_comments_id_seq
827 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
830 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
834 -- Name: issues; Type: TABLE; Schema: public; Owner: -
837 CREATE TABLE public.issues (
839 reportable_type character varying NOT NULL,
840 reportable_id integer NOT NULL,
841 reported_user_id integer,
842 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
843 assigned_role public.user_role_enum NOT NULL,
844 resolved_at timestamp without time zone,
847 reports_count integer DEFAULT 0,
848 created_at timestamp without time zone NOT NULL,
849 updated_at timestamp without time zone NOT NULL
854 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
857 CREATE SEQUENCE public.issues_id_seq
866 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
869 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
873 -- Name: languages; Type: TABLE; Schema: public; Owner: -
876 CREATE TABLE public.languages (
877 code character varying NOT NULL,
878 english_name character varying NOT NULL,
879 native_name character varying
884 -- Name: messages; Type: TABLE; Schema: public; Owner: -
887 CREATE TABLE public.messages (
889 from_user_id bigint NOT NULL,
890 title character varying NOT NULL,
892 sent_on timestamp without time zone NOT NULL,
893 message_read boolean DEFAULT false NOT NULL,
894 to_user_id bigint NOT NULL,
895 to_user_visible boolean DEFAULT true NOT NULL,
896 from_user_visible boolean DEFAULT true NOT NULL,
897 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
902 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
905 CREATE SEQUENCE public.messages_id_seq
914 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
917 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
921 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
924 CREATE TABLE public.node_tags (
925 node_id bigint NOT NULL,
926 version bigint NOT NULL,
927 k character varying DEFAULT ''::character varying NOT NULL,
928 v character varying DEFAULT ''::character varying NOT NULL
933 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
936 CREATE TABLE public.nodes (
937 node_id bigint NOT NULL,
938 latitude integer NOT NULL,
939 longitude integer NOT NULL,
940 changeset_id bigint NOT NULL,
941 visible boolean NOT NULL,
942 "timestamp" timestamp without time zone NOT NULL,
943 tile bigint NOT NULL,
944 version bigint NOT NULL,
950 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
953 CREATE TABLE public.note_comments (
955 note_id bigint NOT NULL,
956 visible boolean NOT NULL,
957 created_at timestamp without time zone NOT NULL,
961 event public.note_event_enum
966 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
969 CREATE SEQUENCE public.note_comments_id_seq
978 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
981 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
985 -- Name: notes; Type: TABLE; Schema: public; Owner: -
988 CREATE TABLE public.notes (
990 latitude integer NOT NULL,
991 longitude integer NOT NULL,
992 tile bigint NOT NULL,
993 updated_at timestamp without time zone NOT NULL,
994 created_at timestamp without time zone NOT NULL,
995 status public.note_status_enum NOT NULL,
996 closed_at timestamp without time zone
1001 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1004 CREATE SEQUENCE public.notes_id_seq
1013 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1016 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
1020 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
1023 CREATE TABLE public.oauth_nonces (
1024 id integer NOT NULL,
1025 nonce character varying,
1026 "timestamp" integer,
1027 created_at timestamp without time zone,
1028 updated_at timestamp without time zone
1033 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1036 CREATE SEQUENCE public.oauth_nonces_id_seq
1045 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1048 ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id;
1052 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
1055 CREATE TABLE public.oauth_tokens (
1056 id integer NOT NULL,
1058 type character varying(20),
1059 client_application_id integer,
1060 token character varying(50),
1061 secret character varying(50),
1062 authorized_at timestamp without time zone,
1063 invalidated_at timestamp without time zone,
1064 created_at timestamp without time zone,
1065 updated_at timestamp without time zone,
1066 allow_read_prefs boolean DEFAULT false NOT NULL,
1067 allow_write_prefs boolean DEFAULT false NOT NULL,
1068 allow_write_diary boolean DEFAULT false NOT NULL,
1069 allow_write_api boolean DEFAULT false NOT NULL,
1070 allow_read_gpx boolean DEFAULT false NOT NULL,
1071 allow_write_gpx boolean DEFAULT false NOT NULL,
1072 callback_url character varying,
1073 verifier character varying(20),
1074 scope character varying,
1075 valid_to timestamp without time zone,
1076 allow_write_notes boolean DEFAULT false NOT NULL
1081 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1084 CREATE SEQUENCE public.oauth_tokens_id_seq
1093 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1096 ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
1100 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1103 CREATE TABLE public.redactions (
1104 id integer NOT NULL,
1105 title character varying,
1107 created_at timestamp without time zone,
1108 updated_at timestamp without time zone,
1109 user_id bigint NOT NULL,
1110 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1115 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1118 CREATE SEQUENCE public.redactions_id_seq
1127 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1130 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1134 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1137 CREATE TABLE public.relation_members (
1138 relation_id bigint DEFAULT 0 NOT NULL,
1139 member_type public.nwr_enum NOT NULL,
1140 member_id bigint NOT NULL,
1141 member_role character varying NOT NULL,
1142 version bigint DEFAULT 0 NOT NULL,
1143 sequence_id integer DEFAULT 0 NOT NULL
1148 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1151 CREATE TABLE public.relation_tags (
1152 relation_id bigint DEFAULT 0 NOT NULL,
1153 k character varying DEFAULT ''::character varying NOT NULL,
1154 v character varying DEFAULT ''::character varying NOT NULL,
1155 version bigint NOT NULL
1160 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1163 CREATE TABLE public.relations (
1164 relation_id bigint DEFAULT 0 NOT NULL,
1165 changeset_id bigint NOT NULL,
1166 "timestamp" timestamp without time zone NOT NULL,
1167 version bigint NOT NULL,
1168 visible boolean DEFAULT true NOT NULL,
1169 redaction_id integer
1174 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1177 CREATE TABLE public.reports (
1178 id integer NOT NULL,
1179 issue_id integer NOT NULL,
1180 user_id integer NOT NULL,
1181 details text NOT NULL,
1182 category character varying NOT NULL,
1183 created_at timestamp without time zone NOT NULL,
1184 updated_at timestamp without time zone NOT NULL
1189 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1192 CREATE SEQUENCE public.reports_id_seq
1201 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1204 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1208 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1211 CREATE TABLE public.schema_migrations (
1212 version character varying NOT NULL
1217 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1220 CREATE TABLE public.user_blocks (
1221 id integer NOT NULL,
1222 user_id bigint NOT NULL,
1223 creator_id bigint NOT NULL,
1224 reason text NOT NULL,
1225 ends_at timestamp without time zone NOT NULL,
1226 needs_view boolean DEFAULT false NOT NULL,
1228 created_at timestamp without time zone,
1229 updated_at timestamp without time zone,
1230 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1235 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1238 CREATE SEQUENCE public.user_blocks_id_seq
1247 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1250 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1254 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1257 CREATE TABLE public.user_preferences (
1258 user_id bigint NOT NULL,
1259 k character varying NOT NULL,
1260 v character varying NOT NULL
1265 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1268 CREATE TABLE public.user_roles (
1269 id integer NOT NULL,
1270 user_id bigint NOT NULL,
1271 role public.user_role_enum NOT NULL,
1272 created_at timestamp without time zone,
1273 updated_at timestamp without time zone,
1274 granter_id bigint NOT NULL
1279 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1282 CREATE SEQUENCE public.user_roles_id_seq
1291 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1294 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1298 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1301 CREATE TABLE public.user_tokens (
1303 user_id bigint NOT NULL,
1304 token character varying NOT NULL,
1305 expiry timestamp without time zone NOT NULL,
1311 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1314 CREATE SEQUENCE public.user_tokens_id_seq
1323 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1326 ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id;
1330 -- Name: users; Type: TABLE; Schema: public; Owner: -
1333 CREATE TABLE public.users (
1334 email character varying NOT NULL,
1336 pass_crypt character varying NOT NULL,
1337 creation_time timestamp without time zone NOT NULL,
1338 display_name character varying DEFAULT ''::character varying NOT NULL,
1339 data_public boolean DEFAULT false NOT NULL,
1340 description text DEFAULT ''::text NOT NULL,
1341 home_lat double precision,
1342 home_lon double precision,
1343 home_zoom smallint DEFAULT 3,
1344 nearby integer DEFAULT 50,
1345 pass_salt character varying,
1346 image_file_name text,
1347 email_valid boolean DEFAULT false NOT NULL,
1348 new_email character varying,
1349 creation_ip character varying,
1350 languages character varying,
1351 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1352 terms_agreed timestamp without time zone,
1353 consider_pd boolean DEFAULT false NOT NULL,
1354 auth_uid character varying,
1355 preferred_editor character varying,
1356 terms_seen boolean DEFAULT false NOT NULL,
1357 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1358 image_fingerprint character varying,
1359 changesets_count integer DEFAULT 0 NOT NULL,
1360 traces_count integer DEFAULT 0 NOT NULL,
1361 diary_entries_count integer DEFAULT 0 NOT NULL,
1362 image_use_gravatar boolean DEFAULT false NOT NULL,
1363 image_content_type character varying,
1364 auth_provider character varying,
1366 tou_agreed timestamp without time zone
1371 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1374 CREATE SEQUENCE public.users_id_seq
1383 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1386 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1390 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1393 CREATE TABLE public.way_nodes (
1394 way_id bigint NOT NULL,
1395 node_id bigint NOT NULL,
1396 version bigint NOT NULL,
1397 sequence_id bigint NOT NULL
1402 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1405 CREATE TABLE public.way_tags (
1406 way_id bigint DEFAULT 0 NOT NULL,
1407 k character varying NOT NULL,
1408 v character varying NOT NULL,
1409 version bigint NOT NULL
1414 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1417 CREATE TABLE public.ways (
1418 way_id bigint DEFAULT 0 NOT NULL,
1419 changeset_id bigint NOT NULL,
1420 "timestamp" timestamp without time zone NOT NULL,
1421 version bigint NOT NULL,
1422 visible boolean DEFAULT true NOT NULL,
1423 redaction_id integer
1428 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1431 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1435 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1438 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1442 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1445 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1449 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1452 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1456 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1459 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1463 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1466 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1470 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1473 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1477 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1480 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1484 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1487 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1491 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1494 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1498 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1501 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1505 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1508 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1512 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1515 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1519 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1522 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1526 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1529 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1533 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1536 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1540 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1543 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1547 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1550 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1554 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1557 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1561 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1564 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1568 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1571 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1575 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1578 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1582 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1585 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1589 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1592 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1596 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1599 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1603 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1606 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1610 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1613 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1617 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1620 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1624 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1627 ALTER TABLE ONLY public.acls
1628 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1632 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1635 ALTER TABLE ONLY public.active_storage_attachments
1636 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1640 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1643 ALTER TABLE ONLY public.active_storage_blobs
1644 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1648 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1651 ALTER TABLE ONLY public.ar_internal_metadata
1652 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1656 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1659 ALTER TABLE ONLY public.changeset_comments
1660 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1664 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1667 ALTER TABLE ONLY public.changesets
1668 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1672 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1675 ALTER TABLE ONLY public.client_applications
1676 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1680 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1683 ALTER TABLE ONLY public.current_node_tags
1684 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1688 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1691 ALTER TABLE ONLY public.current_nodes
1692 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1696 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1699 ALTER TABLE ONLY public.current_relation_members
1700 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1704 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1707 ALTER TABLE ONLY public.current_relation_tags
1708 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1712 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1715 ALTER TABLE ONLY public.current_relations
1716 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1720 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1723 ALTER TABLE ONLY public.current_way_nodes
1724 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1728 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1731 ALTER TABLE ONLY public.current_way_tags
1732 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1736 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1739 ALTER TABLE ONLY public.current_ways
1740 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1744 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1747 ALTER TABLE ONLY public.delayed_jobs
1748 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1752 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1755 ALTER TABLE ONLY public.diary_comments
1756 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1760 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1763 ALTER TABLE ONLY public.diary_entries
1764 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1768 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1771 ALTER TABLE ONLY public.diary_entry_subscriptions
1772 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1776 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1779 ALTER TABLE ONLY public.friends
1780 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1784 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1787 ALTER TABLE ONLY public.gpx_file_tags
1788 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1792 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1795 ALTER TABLE ONLY public.gpx_files
1796 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1800 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1803 ALTER TABLE ONLY public.issue_comments
1804 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1808 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1811 ALTER TABLE ONLY public.issues
1812 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
1816 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1819 ALTER TABLE ONLY public.languages
1820 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1824 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1827 ALTER TABLE ONLY public.messages
1828 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1832 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1835 ALTER TABLE ONLY public.node_tags
1836 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1840 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1843 ALTER TABLE ONLY public.nodes
1844 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1848 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1851 ALTER TABLE ONLY public.note_comments
1852 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1856 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1859 ALTER TABLE ONLY public.notes
1860 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1864 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1867 ALTER TABLE ONLY public.oauth_nonces
1868 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1872 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1875 ALTER TABLE ONLY public.oauth_tokens
1876 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1880 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1883 ALTER TABLE ONLY public.redactions
1884 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1888 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1891 ALTER TABLE ONLY public.relation_members
1892 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1896 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1899 ALTER TABLE ONLY public.relation_tags
1900 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1904 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1907 ALTER TABLE ONLY public.relations
1908 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1912 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1915 ALTER TABLE ONLY public.reports
1916 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
1920 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1923 ALTER TABLE ONLY public.schema_migrations
1924 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
1928 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1931 ALTER TABLE ONLY public.user_blocks
1932 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1936 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1939 ALTER TABLE ONLY public.user_preferences
1940 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1944 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1947 ALTER TABLE ONLY public.user_roles
1948 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1952 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1955 ALTER TABLE ONLY public.user_tokens
1956 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
1960 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1963 ALTER TABLE ONLY public.users
1964 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
1968 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1971 ALTER TABLE ONLY public.way_nodes
1972 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
1976 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1979 ALTER TABLE ONLY public.way_tags
1980 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
1984 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1987 ALTER TABLE ONLY public.ways
1988 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
1992 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
1995 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
1999 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
2002 CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id);
2006 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2009 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2013 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2016 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2020 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2023 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2027 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2030 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2034 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2037 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2041 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2044 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2048 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2051 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2055 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2058 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2062 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2065 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2069 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2072 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2076 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2079 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2083 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2086 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2090 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2093 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2097 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2100 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2104 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2107 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2111 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2114 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2118 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2121 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2125 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -
2128 CREATE INDEX friends_user_id_idx ON public.friends USING btree (user_id);
2132 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2135 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2139 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2142 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2146 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2149 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2153 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2156 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2160 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2163 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2167 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2170 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2174 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2177 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2181 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2184 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2188 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2191 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2195 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2198 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2202 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2205 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2209 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2212 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2216 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2219 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2223 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2226 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2230 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2233 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2237 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2240 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2244 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2247 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2251 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2254 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2258 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2261 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2265 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2268 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2272 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2275 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2279 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2282 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2286 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2289 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2293 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2296 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2300 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2303 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2307 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2310 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2314 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2317 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2321 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2324 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2328 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2331 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2335 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2338 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2342 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2345 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2349 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2352 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2356 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2359 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2363 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2366 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2370 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2373 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2377 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2380 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2384 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2387 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2391 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2394 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2398 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2401 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2405 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2408 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2412 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2415 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2419 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2422 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2426 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2429 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2433 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2436 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2440 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2443 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2447 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2450 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2454 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2457 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2461 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2464 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2468 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2471 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2475 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2478 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2482 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2485 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2489 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2492 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2496 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2499 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2503 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2506 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2510 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2513 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2517 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2520 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2524 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2527 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2531 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2534 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2538 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2541 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2545 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2548 ALTER TABLE ONLY public.changeset_comments
2549 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2553 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2556 ALTER TABLE ONLY public.changeset_comments
2557 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2561 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2564 ALTER TABLE ONLY public.changeset_tags
2565 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2569 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2572 ALTER TABLE ONLY public.changesets_subscribers
2573 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2577 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2580 ALTER TABLE ONLY public.changesets_subscribers
2581 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2585 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2588 ALTER TABLE ONLY public.changesets
2589 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2593 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2596 ALTER TABLE ONLY public.client_applications
2597 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2601 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2604 ALTER TABLE ONLY public.current_node_tags
2605 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2609 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2612 ALTER TABLE ONLY public.current_nodes
2613 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2617 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2620 ALTER TABLE ONLY public.current_relation_members
2621 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2625 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2628 ALTER TABLE ONLY public.current_relation_tags
2629 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2633 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2636 ALTER TABLE ONLY public.current_relations
2637 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2641 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2644 ALTER TABLE ONLY public.current_way_nodes
2645 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2649 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2652 ALTER TABLE ONLY public.current_way_nodes
2653 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2657 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2660 ALTER TABLE ONLY public.current_way_tags
2661 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2665 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2668 ALTER TABLE ONLY public.current_ways
2669 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2673 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2676 ALTER TABLE ONLY public.diary_comments
2677 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2681 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2684 ALTER TABLE ONLY public.diary_comments
2685 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2689 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2692 ALTER TABLE ONLY public.diary_entries
2693 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
2697 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2700 ALTER TABLE ONLY public.diary_entries
2701 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2705 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2708 ALTER TABLE ONLY public.diary_entry_subscriptions
2709 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2713 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2716 ALTER TABLE ONLY public.diary_entry_subscriptions
2717 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2721 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
2724 ALTER TABLE ONLY public.active_storage_attachments
2725 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
2729 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2732 ALTER TABLE ONLY public.friends
2733 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
2737 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2740 ALTER TABLE ONLY public.friends
2741 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2745 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2748 ALTER TABLE ONLY public.gps_points
2749 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2753 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2756 ALTER TABLE ONLY public.gpx_file_tags
2757 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2761 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2764 ALTER TABLE ONLY public.gpx_files
2765 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2769 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2772 ALTER TABLE ONLY public.issue_comments
2773 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2777 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2780 ALTER TABLE ONLY public.issue_comments
2781 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2785 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2788 ALTER TABLE ONLY public.issues
2789 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
2793 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2796 ALTER TABLE ONLY public.issues
2797 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
2801 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2804 ALTER TABLE ONLY public.issues
2805 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
2809 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2812 ALTER TABLE ONLY public.messages
2813 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
2817 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2820 ALTER TABLE ONLY public.messages
2821 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
2825 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2828 ALTER TABLE ONLY public.node_tags
2829 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
2833 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2836 ALTER TABLE ONLY public.nodes
2837 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2841 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2844 ALTER TABLE ONLY public.nodes
2845 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2849 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2852 ALTER TABLE ONLY public.note_comments
2853 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2857 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2860 ALTER TABLE ONLY public.note_comments
2861 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
2865 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2868 ALTER TABLE ONLY public.oauth_tokens
2869 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
2873 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2876 ALTER TABLE ONLY public.oauth_tokens
2877 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2881 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2884 ALTER TABLE ONLY public.redactions
2885 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2889 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2892 ALTER TABLE ONLY public.relation_members
2893 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2897 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2900 ALTER TABLE ONLY public.relation_tags
2901 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2905 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2908 ALTER TABLE ONLY public.relations
2909 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2913 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2916 ALTER TABLE ONLY public.relations
2917 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2921 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2924 ALTER TABLE ONLY public.reports
2925 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2929 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2932 ALTER TABLE ONLY public.reports
2933 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2937 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2940 ALTER TABLE ONLY public.user_blocks
2941 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
2945 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2948 ALTER TABLE ONLY public.user_blocks
2949 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
2953 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2956 ALTER TABLE ONLY public.user_blocks
2957 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2961 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2964 ALTER TABLE ONLY public.user_preferences
2965 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2969 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2972 ALTER TABLE ONLY public.user_roles
2973 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
2977 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2980 ALTER TABLE ONLY public.user_roles
2981 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2985 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2988 ALTER TABLE ONLY public.user_tokens
2989 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2993 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2996 ALTER TABLE ONLY public.way_nodes
2997 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3001 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3004 ALTER TABLE ONLY public.way_tags
3005 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3009 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3012 ALTER TABLE ONLY public.ways
3013 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3017 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3020 ALTER TABLE ONLY public.ways
3021 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3025 -- PostgreSQL database dump complete
3028 SET search_path TO "$user", public;
3030 INSERT INTO "schema_migrations" (version) VALUES