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 email_valid boolean DEFAULT false NOT NULL,
1347 new_email character varying,
1348 creation_ip character varying,
1349 languages character varying,
1350 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1351 terms_agreed timestamp without time zone,
1352 consider_pd boolean DEFAULT false NOT NULL,
1353 auth_uid character varying,
1354 preferred_editor character varying,
1355 terms_seen boolean DEFAULT false NOT NULL,
1356 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1357 changesets_count integer DEFAULT 0 NOT NULL,
1358 traces_count integer DEFAULT 0 NOT NULL,
1359 diary_entries_count integer DEFAULT 0 NOT NULL,
1360 image_use_gravatar boolean DEFAULT false NOT NULL,
1361 auth_provider character varying,
1363 tou_agreed timestamp without time zone
1368 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1371 CREATE SEQUENCE public.users_id_seq
1380 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1383 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1387 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1390 CREATE TABLE public.way_nodes (
1391 way_id bigint NOT NULL,
1392 node_id bigint NOT NULL,
1393 version bigint NOT NULL,
1394 sequence_id bigint NOT NULL
1399 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1402 CREATE TABLE public.way_tags (
1403 way_id bigint DEFAULT 0 NOT NULL,
1404 k character varying NOT NULL,
1405 v character varying NOT NULL,
1406 version bigint NOT NULL
1411 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1414 CREATE TABLE public.ways (
1415 way_id bigint DEFAULT 0 NOT NULL,
1416 changeset_id bigint NOT NULL,
1417 "timestamp" timestamp without time zone NOT NULL,
1418 version bigint NOT NULL,
1419 visible boolean DEFAULT true NOT NULL,
1420 redaction_id integer
1425 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1428 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1432 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1435 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1439 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1442 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1446 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1449 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1453 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1456 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1460 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1463 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1467 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1470 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1474 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1477 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1481 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1484 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1488 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1491 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1495 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1498 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1502 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1505 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1509 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1512 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1516 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1519 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1523 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1526 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1530 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1533 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1537 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1540 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1544 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1547 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1551 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1554 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1558 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1561 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1565 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1568 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1572 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1575 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1579 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1582 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1586 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1589 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1593 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1596 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1600 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1603 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1607 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1610 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1614 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1617 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1621 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1624 ALTER TABLE ONLY public.acls
1625 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1629 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1632 ALTER TABLE ONLY public.active_storage_attachments
1633 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1637 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1640 ALTER TABLE ONLY public.active_storage_blobs
1641 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1645 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1648 ALTER TABLE ONLY public.ar_internal_metadata
1649 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1653 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1656 ALTER TABLE ONLY public.changeset_comments
1657 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1661 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1664 ALTER TABLE ONLY public.changesets
1665 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1669 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1672 ALTER TABLE ONLY public.client_applications
1673 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1677 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1680 ALTER TABLE ONLY public.current_node_tags
1681 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1685 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1688 ALTER TABLE ONLY public.current_nodes
1689 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1693 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1696 ALTER TABLE ONLY public.current_relation_members
1697 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1701 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1704 ALTER TABLE ONLY public.current_relation_tags
1705 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1709 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1712 ALTER TABLE ONLY public.current_relations
1713 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1717 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1720 ALTER TABLE ONLY public.current_way_nodes
1721 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1725 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1728 ALTER TABLE ONLY public.current_way_tags
1729 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1733 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1736 ALTER TABLE ONLY public.current_ways
1737 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1741 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1744 ALTER TABLE ONLY public.delayed_jobs
1745 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1749 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1752 ALTER TABLE ONLY public.diary_comments
1753 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1757 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1760 ALTER TABLE ONLY public.diary_entries
1761 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1765 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1768 ALTER TABLE ONLY public.diary_entry_subscriptions
1769 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1773 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1776 ALTER TABLE ONLY public.friends
1777 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1781 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1784 ALTER TABLE ONLY public.gpx_file_tags
1785 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1789 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1792 ALTER TABLE ONLY public.gpx_files
1793 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1797 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1800 ALTER TABLE ONLY public.issue_comments
1801 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1805 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1808 ALTER TABLE ONLY public.issues
1809 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
1813 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1816 ALTER TABLE ONLY public.languages
1817 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1821 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1824 ALTER TABLE ONLY public.messages
1825 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1829 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1832 ALTER TABLE ONLY public.node_tags
1833 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1837 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1840 ALTER TABLE ONLY public.nodes
1841 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1845 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1848 ALTER TABLE ONLY public.note_comments
1849 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1853 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1856 ALTER TABLE ONLY public.notes
1857 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1861 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1864 ALTER TABLE ONLY public.oauth_nonces
1865 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1869 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1872 ALTER TABLE ONLY public.oauth_tokens
1873 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1877 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1880 ALTER TABLE ONLY public.redactions
1881 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1885 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1888 ALTER TABLE ONLY public.relation_members
1889 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1893 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1896 ALTER TABLE ONLY public.relation_tags
1897 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1901 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1904 ALTER TABLE ONLY public.relations
1905 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1909 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1912 ALTER TABLE ONLY public.reports
1913 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
1917 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1920 ALTER TABLE ONLY public.schema_migrations
1921 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
1925 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1928 ALTER TABLE ONLY public.user_blocks
1929 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1933 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1936 ALTER TABLE ONLY public.user_preferences
1937 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1941 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1944 ALTER TABLE ONLY public.user_roles
1945 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1949 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1952 ALTER TABLE ONLY public.user_tokens
1953 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
1957 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1960 ALTER TABLE ONLY public.users
1961 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
1965 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1968 ALTER TABLE ONLY public.way_nodes
1969 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
1973 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1976 ALTER TABLE ONLY public.way_tags
1977 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
1981 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1984 ALTER TABLE ONLY public.ways
1985 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
1989 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
1992 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
1996 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
1999 CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id);
2003 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2006 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2010 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2013 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2017 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2020 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2024 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2027 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2031 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2034 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2038 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2041 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2045 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2048 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2052 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2055 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2059 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2062 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2066 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2069 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2073 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2076 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2080 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2083 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2087 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2090 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2094 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2097 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2101 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2104 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2108 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2111 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2115 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2118 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2122 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -
2125 CREATE INDEX friends_user_id_idx ON public.friends USING btree (user_id);
2129 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2132 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2136 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2139 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2143 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2146 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2150 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2153 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2157 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2160 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2164 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2167 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2171 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2174 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2178 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2181 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2185 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2188 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2192 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2195 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2199 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2202 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2206 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2209 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2213 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2216 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2220 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2223 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2227 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2230 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2234 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2237 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2241 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2244 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2248 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2251 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2255 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2258 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2262 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2265 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2269 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2272 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2276 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2279 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2283 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2286 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2290 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2293 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2297 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2300 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2304 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2307 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2311 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2314 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2318 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2321 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2325 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2328 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2332 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2335 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2339 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2342 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2346 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2349 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2353 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2356 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2360 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2363 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2367 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2370 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2374 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2377 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2381 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2384 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2388 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2391 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2395 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2398 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2402 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2405 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2409 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2412 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2416 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2419 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2423 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2426 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2430 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2433 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2437 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2440 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2444 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2447 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2451 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2454 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2458 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2461 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2465 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2468 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2472 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2475 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2479 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2482 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2486 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2489 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2493 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2496 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2500 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2503 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2507 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2510 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2514 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2517 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2521 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2524 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2528 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2531 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2535 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2538 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2542 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2545 ALTER TABLE ONLY public.changeset_comments
2546 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2550 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2553 ALTER TABLE ONLY public.changeset_comments
2554 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2558 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2561 ALTER TABLE ONLY public.changeset_tags
2562 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2566 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2569 ALTER TABLE ONLY public.changesets_subscribers
2570 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2574 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2577 ALTER TABLE ONLY public.changesets_subscribers
2578 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2582 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2585 ALTER TABLE ONLY public.changesets
2586 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2590 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2593 ALTER TABLE ONLY public.client_applications
2594 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2598 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2601 ALTER TABLE ONLY public.current_node_tags
2602 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2606 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2609 ALTER TABLE ONLY public.current_nodes
2610 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2614 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2617 ALTER TABLE ONLY public.current_relation_members
2618 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2622 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2625 ALTER TABLE ONLY public.current_relation_tags
2626 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2630 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2633 ALTER TABLE ONLY public.current_relations
2634 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2638 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2641 ALTER TABLE ONLY public.current_way_nodes
2642 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2646 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2649 ALTER TABLE ONLY public.current_way_nodes
2650 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2654 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2657 ALTER TABLE ONLY public.current_way_tags
2658 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2662 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2665 ALTER TABLE ONLY public.current_ways
2666 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2670 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2673 ALTER TABLE ONLY public.diary_comments
2674 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2678 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2681 ALTER TABLE ONLY public.diary_comments
2682 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2686 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2689 ALTER TABLE ONLY public.diary_entries
2690 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
2694 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2697 ALTER TABLE ONLY public.diary_entries
2698 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2702 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2705 ALTER TABLE ONLY public.diary_entry_subscriptions
2706 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2710 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2713 ALTER TABLE ONLY public.diary_entry_subscriptions
2714 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2718 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
2721 ALTER TABLE ONLY public.active_storage_attachments
2722 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
2726 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2729 ALTER TABLE ONLY public.friends
2730 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
2734 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2737 ALTER TABLE ONLY public.friends
2738 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2742 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2745 ALTER TABLE ONLY public.gps_points
2746 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2750 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2753 ALTER TABLE ONLY public.gpx_file_tags
2754 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2758 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2761 ALTER TABLE ONLY public.gpx_files
2762 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2766 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2769 ALTER TABLE ONLY public.issue_comments
2770 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2774 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2777 ALTER TABLE ONLY public.issue_comments
2778 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2782 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2785 ALTER TABLE ONLY public.issues
2786 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
2790 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2793 ALTER TABLE ONLY public.issues
2794 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
2798 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2801 ALTER TABLE ONLY public.issues
2802 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
2806 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2809 ALTER TABLE ONLY public.messages
2810 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
2814 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2817 ALTER TABLE ONLY public.messages
2818 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
2822 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2825 ALTER TABLE ONLY public.node_tags
2826 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
2830 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2833 ALTER TABLE ONLY public.nodes
2834 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2838 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2841 ALTER TABLE ONLY public.nodes
2842 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2846 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2849 ALTER TABLE ONLY public.note_comments
2850 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2854 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2857 ALTER TABLE ONLY public.note_comments
2858 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
2862 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2865 ALTER TABLE ONLY public.oauth_tokens
2866 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
2870 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2873 ALTER TABLE ONLY public.oauth_tokens
2874 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2878 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2881 ALTER TABLE ONLY public.redactions
2882 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2886 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2889 ALTER TABLE ONLY public.relation_members
2890 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2894 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2897 ALTER TABLE ONLY public.relation_tags
2898 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2902 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2905 ALTER TABLE ONLY public.relations
2906 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2910 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2913 ALTER TABLE ONLY public.relations
2914 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2918 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2921 ALTER TABLE ONLY public.reports
2922 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2926 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2929 ALTER TABLE ONLY public.reports
2930 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2934 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2937 ALTER TABLE ONLY public.user_blocks
2938 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
2942 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2945 ALTER TABLE ONLY public.user_blocks
2946 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
2950 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2953 ALTER TABLE ONLY public.user_blocks
2954 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2958 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2961 ALTER TABLE ONLY public.user_preferences
2962 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2966 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2969 ALTER TABLE ONLY public.user_roles
2970 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
2974 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2977 ALTER TABLE ONLY public.user_roles
2978 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2982 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2985 ALTER TABLE ONLY public.user_tokens
2986 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2990 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2993 ALTER TABLE ONLY public.way_nodes
2994 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
2998 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3001 ALTER TABLE ONLY public.way_tags
3002 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3006 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3009 ALTER TABLE ONLY public.ways
3010 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3014 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3017 ALTER TABLE ONLY public.ways
3018 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3022 -- PostgreSQL database dump complete
3025 SET search_path TO "$user", public;
3027 INSERT INTO "schema_migrations" (version) VALUES