1 SET statement_timeout = 0;
3 SET client_encoding = 'UTF8';
4 SET standard_conforming_strings = on;
5 SELECT pg_catalog.set_config('search_path', '', false);
6 SET check_function_bodies = false;
7 SET xmloption = content;
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: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
135 CREATE FUNCTION public.tile_for_point(scaled_lat integer, scaled_lon integer) RETURNS bigint
136 LANGUAGE plpgsql IMMUTABLE
139 x int8; -- quantized x from lon,
140 y int8; -- quantized y from lat,
142 x := round(((scaled_lon / 10000000.0) + 180.0) * 65535.0 / 360.0);
143 y := round(((scaled_lat / 10000000.0) + 90.0) * 65535.0 / 180.0);
145 -- these bit-masks are special numbers used in the bit interleaving algorithm.
146 -- see https://graphics.stanford.edu/~seander/bithacks.html#InterleaveBMN
147 -- for the original algorithm and more details.
148 x := (x | (x << 8)) & 16711935; -- 0x00FF00FF
149 x := (x | (x << 4)) & 252645135; -- 0x0F0F0F0F
150 x := (x | (x << 2)) & 858993459; -- 0x33333333
151 x := (x | (x << 1)) & 1431655765; -- 0x55555555
153 y := (y | (y << 8)) & 16711935; -- 0x00FF00FF
154 y := (y | (y << 4)) & 252645135; -- 0x0F0F0F0F
155 y := (y | (y << 2)) & 858993459; -- 0x33333333
156 y := (y | (y << 1)) & 1431655765; -- 0x55555555
164 -- Name: xid_to_int4(xid); Type: FUNCTION; Schema: public; Owner: -
167 CREATE FUNCTION public.xid_to_int4(t xid) RETURNS integer
168 LANGUAGE plpgsql STRICT
176 IF tl >= 2147483648 THEN
177 tl := tl - 4294967296;
187 SET default_tablespace = '';
189 SET default_with_oids = false;
192 -- Name: acls; Type: TABLE; Schema: public; Owner: -
195 CREATE TABLE public.acls (
198 k character varying NOT NULL,
200 domain character varying,
206 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
209 CREATE SEQUENCE public.acls_id_seq
218 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
221 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
225 -- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
228 CREATE TABLE public.active_storage_attachments (
230 name character varying NOT NULL,
231 record_type character varying NOT NULL,
232 record_id bigint NOT NULL,
233 blob_id bigint NOT NULL,
234 created_at timestamp without time zone NOT NULL
239 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
242 CREATE SEQUENCE public.active_storage_attachments_id_seq
251 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
254 ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
258 -- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
261 CREATE TABLE public.active_storage_blobs (
263 key character varying NOT NULL,
264 filename character varying NOT NULL,
265 content_type character varying,
267 byte_size bigint NOT NULL,
268 checksum character varying NOT NULL,
269 created_at timestamp without time zone NOT NULL
274 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
277 CREATE SEQUENCE public.active_storage_blobs_id_seq
286 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
289 ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
293 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
296 CREATE TABLE public.ar_internal_metadata (
297 key character varying NOT NULL,
298 value character varying,
299 created_at timestamp(6) without time zone NOT NULL,
300 updated_at timestamp(6) without time zone NOT NULL
305 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
308 CREATE TABLE public.changeset_comments (
310 changeset_id bigint NOT NULL,
311 author_id bigint NOT NULL,
313 created_at timestamp without time zone NOT NULL,
314 visible boolean NOT NULL
319 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
322 CREATE SEQUENCE public.changeset_comments_id_seq
331 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
334 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
338 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
341 CREATE TABLE public.changeset_tags (
342 changeset_id bigint NOT NULL,
343 k character varying DEFAULT ''::character varying NOT NULL,
344 v character varying DEFAULT ''::character varying NOT NULL
349 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
352 CREATE TABLE public.changesets (
354 user_id bigint NOT NULL,
355 created_at timestamp without time zone NOT NULL,
360 closed_at timestamp without time zone NOT NULL,
361 num_changes integer DEFAULT 0 NOT NULL
366 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
369 CREATE SEQUENCE public.changesets_id_seq
378 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
381 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
385 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
388 CREATE TABLE public.changesets_subscribers (
389 subscriber_id bigint NOT NULL,
390 changeset_id bigint NOT NULL
395 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
398 CREATE TABLE public.client_applications (
400 name character varying,
401 url character varying,
402 support_url character varying,
403 callback_url character varying,
404 key character varying(50),
405 secret character varying(50),
407 created_at timestamp without time zone,
408 updated_at timestamp without time zone,
409 allow_read_prefs boolean DEFAULT false NOT NULL,
410 allow_write_prefs boolean DEFAULT false NOT NULL,
411 allow_write_diary boolean DEFAULT false NOT NULL,
412 allow_write_api boolean DEFAULT false NOT NULL,
413 allow_read_gpx boolean DEFAULT false NOT NULL,
414 allow_write_gpx boolean DEFAULT false NOT NULL,
415 allow_write_notes boolean DEFAULT false NOT NULL
420 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
423 CREATE SEQUENCE public.client_applications_id_seq
432 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
435 ALTER SEQUENCE public.client_applications_id_seq OWNED BY public.client_applications.id;
439 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
442 CREATE TABLE public.current_node_tags (
443 node_id bigint NOT NULL,
444 k character varying DEFAULT ''::character varying NOT NULL,
445 v character varying DEFAULT ''::character varying NOT NULL
450 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
453 CREATE TABLE public.current_nodes (
455 latitude integer NOT NULL,
456 longitude integer NOT NULL,
457 changeset_id bigint NOT NULL,
458 visible boolean NOT NULL,
459 "timestamp" timestamp without time zone NOT NULL,
460 tile bigint NOT NULL,
461 version bigint NOT NULL
466 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
469 CREATE SEQUENCE public.current_nodes_id_seq
478 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
481 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
485 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
488 CREATE TABLE public.current_relation_members (
489 relation_id bigint NOT NULL,
490 member_type public.nwr_enum NOT NULL,
491 member_id bigint NOT NULL,
492 member_role character varying NOT NULL,
493 sequence_id integer DEFAULT 0 NOT NULL
498 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
501 CREATE TABLE public.current_relation_tags (
502 relation_id bigint NOT NULL,
503 k character varying DEFAULT ''::character varying NOT NULL,
504 v character varying DEFAULT ''::character varying NOT NULL
509 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
512 CREATE TABLE public.current_relations (
514 changeset_id bigint NOT NULL,
515 "timestamp" timestamp without time zone NOT NULL,
516 visible boolean NOT NULL,
517 version bigint NOT NULL
522 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
525 CREATE SEQUENCE public.current_relations_id_seq
534 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
537 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
541 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
544 CREATE TABLE public.current_way_nodes (
545 way_id bigint NOT NULL,
546 node_id bigint NOT NULL,
547 sequence_id bigint NOT NULL
552 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
555 CREATE TABLE public.current_way_tags (
556 way_id bigint NOT NULL,
557 k character varying DEFAULT ''::character varying NOT NULL,
558 v character varying DEFAULT ''::character varying NOT NULL
563 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
566 CREATE TABLE public.current_ways (
568 changeset_id bigint NOT NULL,
569 "timestamp" timestamp without time zone NOT NULL,
570 visible boolean NOT NULL,
571 version bigint NOT NULL
576 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
579 CREATE SEQUENCE public.current_ways_id_seq
588 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
591 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
595 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
598 CREATE TABLE public.delayed_jobs (
600 priority integer DEFAULT 0 NOT NULL,
601 attempts integer DEFAULT 0 NOT NULL,
602 handler text NOT NULL,
604 run_at timestamp without time zone,
605 locked_at timestamp without time zone,
606 failed_at timestamp without time zone,
607 locked_by character varying,
608 queue character varying,
609 created_at timestamp without time zone,
610 updated_at timestamp without time zone
615 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
618 CREATE SEQUENCE public.delayed_jobs_id_seq
627 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
630 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
634 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
637 CREATE TABLE public.diary_comments (
639 diary_entry_id bigint NOT NULL,
640 user_id bigint NOT NULL,
642 created_at timestamp without time zone NOT NULL,
643 updated_at timestamp without time zone NOT NULL,
644 visible boolean DEFAULT true NOT NULL,
645 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
650 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
653 CREATE SEQUENCE public.diary_comments_id_seq
662 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
665 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
669 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
672 CREATE TABLE public.diary_entries (
674 user_id bigint NOT NULL,
675 title character varying NOT NULL,
677 created_at timestamp without time zone NOT NULL,
678 updated_at timestamp without time zone NOT NULL,
679 latitude double precision,
680 longitude double precision,
681 language_code character varying DEFAULT 'en'::character varying NOT NULL,
682 visible boolean DEFAULT true NOT NULL,
683 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
688 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
691 CREATE SEQUENCE public.diary_entries_id_seq
700 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
703 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
707 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
710 CREATE TABLE public.diary_entry_subscriptions (
711 user_id bigint NOT NULL,
712 diary_entry_id bigint NOT NULL
717 -- Name: friends; Type: TABLE; Schema: public; Owner: -
720 CREATE TABLE public.friends (
722 user_id bigint NOT NULL,
723 friend_user_id bigint NOT NULL
728 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
731 CREATE SEQUENCE public.friends_id_seq
740 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
743 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
747 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
750 CREATE TABLE public.gps_points (
751 altitude double precision,
752 trackid integer NOT NULL,
753 latitude integer NOT NULL,
754 longitude integer NOT NULL,
755 gpx_id bigint NOT NULL,
756 "timestamp" timestamp without time zone,
762 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
765 CREATE TABLE public.gpx_file_tags (
766 gpx_id bigint DEFAULT 0 NOT NULL,
767 tag character varying NOT NULL,
773 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
776 CREATE SEQUENCE public.gpx_file_tags_id_seq
785 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
788 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
792 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
795 CREATE TABLE public.gpx_files (
797 user_id bigint NOT NULL,
798 visible boolean DEFAULT true NOT NULL,
799 name character varying DEFAULT ''::character varying NOT NULL,
801 latitude double precision,
802 longitude double precision,
803 "timestamp" timestamp without time zone NOT NULL,
804 description character varying DEFAULT ''::character varying NOT NULL,
805 inserted boolean NOT NULL,
806 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
811 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
814 CREATE SEQUENCE public.gpx_files_id_seq
823 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
826 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
830 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
833 CREATE TABLE public.issue_comments (
835 issue_id integer NOT NULL,
836 user_id integer NOT NULL,
838 created_at timestamp without time zone NOT NULL,
839 updated_at timestamp without time zone NOT NULL
844 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
847 CREATE SEQUENCE public.issue_comments_id_seq
856 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
859 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
863 -- Name: issues; Type: TABLE; Schema: public; Owner: -
866 CREATE TABLE public.issues (
868 reportable_type character varying NOT NULL,
869 reportable_id integer NOT NULL,
870 reported_user_id integer,
871 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
872 assigned_role public.user_role_enum NOT NULL,
873 resolved_at timestamp without time zone,
876 reports_count integer DEFAULT 0,
877 created_at timestamp without time zone NOT NULL,
878 updated_at timestamp without time zone NOT NULL
883 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
886 CREATE SEQUENCE public.issues_id_seq
895 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
898 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
902 -- Name: languages; Type: TABLE; Schema: public; Owner: -
905 CREATE TABLE public.languages (
906 code character varying NOT NULL,
907 english_name character varying NOT NULL,
908 native_name character varying
913 -- Name: messages; Type: TABLE; Schema: public; Owner: -
916 CREATE TABLE public.messages (
918 from_user_id bigint NOT NULL,
919 title character varying NOT NULL,
921 sent_on timestamp without time zone NOT NULL,
922 message_read boolean DEFAULT false NOT NULL,
923 to_user_id bigint NOT NULL,
924 to_user_visible boolean DEFAULT true NOT NULL,
925 from_user_visible boolean DEFAULT true NOT NULL,
926 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
931 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
934 CREATE SEQUENCE public.messages_id_seq
943 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
946 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
950 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
953 CREATE TABLE public.node_tags (
954 node_id bigint NOT NULL,
955 version bigint NOT NULL,
956 k character varying DEFAULT ''::character varying NOT NULL,
957 v character varying DEFAULT ''::character varying NOT NULL
962 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
965 CREATE TABLE public.nodes (
966 node_id bigint NOT NULL,
967 latitude integer NOT NULL,
968 longitude integer NOT NULL,
969 changeset_id bigint NOT NULL,
970 visible boolean NOT NULL,
971 "timestamp" timestamp without time zone NOT NULL,
972 tile bigint NOT NULL,
973 version bigint NOT NULL,
979 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
982 CREATE TABLE public.note_comments (
984 note_id bigint NOT NULL,
985 visible boolean NOT NULL,
986 created_at timestamp without time zone NOT NULL,
990 event public.note_event_enum
995 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
998 CREATE SEQUENCE public.note_comments_id_seq
1007 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1010 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
1014 -- Name: notes; Type: TABLE; Schema: public; Owner: -
1017 CREATE TABLE public.notes (
1019 latitude integer NOT NULL,
1020 longitude integer NOT NULL,
1021 tile bigint NOT NULL,
1022 updated_at timestamp without time zone NOT NULL,
1023 created_at timestamp without time zone NOT NULL,
1024 status public.note_status_enum NOT NULL,
1025 closed_at timestamp without time zone
1030 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1033 CREATE SEQUENCE public.notes_id_seq
1042 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1045 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
1049 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
1052 CREATE TABLE public.oauth_nonces (
1054 nonce character varying,
1055 "timestamp" integer,
1056 created_at timestamp without time zone,
1057 updated_at timestamp without time zone
1062 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1065 CREATE SEQUENCE public.oauth_nonces_id_seq
1074 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1077 ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id;
1081 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
1084 CREATE TABLE public.oauth_tokens (
1085 id integer NOT NULL,
1087 type character varying(20),
1088 client_application_id integer,
1089 token character varying(50),
1090 secret character varying(50),
1091 authorized_at timestamp without time zone,
1092 invalidated_at timestamp without time zone,
1093 created_at timestamp without time zone,
1094 updated_at timestamp without time zone,
1095 allow_read_prefs boolean DEFAULT false NOT NULL,
1096 allow_write_prefs boolean DEFAULT false NOT NULL,
1097 allow_write_diary boolean DEFAULT false NOT NULL,
1098 allow_write_api boolean DEFAULT false NOT NULL,
1099 allow_read_gpx boolean DEFAULT false NOT NULL,
1100 allow_write_gpx boolean DEFAULT false NOT NULL,
1101 callback_url character varying,
1102 verifier character varying(20),
1103 scope character varying,
1104 valid_to timestamp without time zone,
1105 allow_write_notes boolean DEFAULT false NOT NULL
1110 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1113 CREATE SEQUENCE public.oauth_tokens_id_seq
1122 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1125 ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
1129 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1132 CREATE TABLE public.redactions (
1133 id integer NOT NULL,
1134 title character varying,
1136 created_at timestamp without time zone,
1137 updated_at timestamp without time zone,
1138 user_id bigint NOT NULL,
1139 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1144 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1147 CREATE SEQUENCE public.redactions_id_seq
1156 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1159 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1163 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1166 CREATE TABLE public.relation_members (
1167 relation_id bigint DEFAULT 0 NOT NULL,
1168 member_type public.nwr_enum NOT NULL,
1169 member_id bigint NOT NULL,
1170 member_role character varying NOT NULL,
1171 version bigint DEFAULT 0 NOT NULL,
1172 sequence_id integer DEFAULT 0 NOT NULL
1177 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1180 CREATE TABLE public.relation_tags (
1181 relation_id bigint DEFAULT 0 NOT NULL,
1182 k character varying DEFAULT ''::character varying NOT NULL,
1183 v character varying DEFAULT ''::character varying NOT NULL,
1184 version bigint NOT NULL
1189 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1192 CREATE TABLE public.relations (
1193 relation_id bigint DEFAULT 0 NOT NULL,
1194 changeset_id bigint NOT NULL,
1195 "timestamp" timestamp without time zone NOT NULL,
1196 version bigint NOT NULL,
1197 visible boolean DEFAULT true NOT NULL,
1198 redaction_id integer
1203 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1206 CREATE TABLE public.reports (
1207 id integer NOT NULL,
1208 issue_id integer NOT NULL,
1209 user_id integer NOT NULL,
1210 details text NOT NULL,
1211 category character varying NOT NULL,
1212 created_at timestamp without time zone NOT NULL,
1213 updated_at timestamp without time zone NOT NULL
1218 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1221 CREATE SEQUENCE public.reports_id_seq
1230 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1233 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1237 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1240 CREATE TABLE public.schema_migrations (
1241 version character varying NOT NULL
1246 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1249 CREATE TABLE public.user_blocks (
1250 id integer NOT NULL,
1251 user_id bigint NOT NULL,
1252 creator_id bigint NOT NULL,
1253 reason text NOT NULL,
1254 ends_at timestamp without time zone NOT NULL,
1255 needs_view boolean DEFAULT false NOT NULL,
1257 created_at timestamp without time zone,
1258 updated_at timestamp without time zone,
1259 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1264 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1267 CREATE SEQUENCE public.user_blocks_id_seq
1276 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1279 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1283 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1286 CREATE TABLE public.user_preferences (
1287 user_id bigint NOT NULL,
1288 k character varying NOT NULL,
1289 v character varying NOT NULL
1294 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1297 CREATE TABLE public.user_roles (
1298 id integer NOT NULL,
1299 user_id bigint NOT NULL,
1300 role public.user_role_enum NOT NULL,
1301 created_at timestamp without time zone,
1302 updated_at timestamp without time zone,
1303 granter_id bigint NOT NULL
1308 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1311 CREATE SEQUENCE public.user_roles_id_seq
1320 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1323 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1327 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1330 CREATE TABLE public.user_tokens (
1332 user_id bigint NOT NULL,
1333 token character varying NOT NULL,
1334 expiry timestamp without time zone NOT NULL,
1340 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1343 CREATE SEQUENCE public.user_tokens_id_seq
1352 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1355 ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id;
1359 -- Name: users; Type: TABLE; Schema: public; Owner: -
1362 CREATE TABLE public.users (
1363 email character varying NOT NULL,
1365 pass_crypt character varying NOT NULL,
1366 creation_time timestamp without time zone NOT NULL,
1367 display_name character varying DEFAULT ''::character varying NOT NULL,
1368 data_public boolean DEFAULT false NOT NULL,
1369 description text DEFAULT ''::text NOT NULL,
1370 home_lat double precision,
1371 home_lon double precision,
1372 home_zoom smallint DEFAULT 3,
1373 pass_salt character varying,
1374 email_valid boolean DEFAULT false NOT NULL,
1375 new_email character varying,
1376 creation_ip character varying,
1377 languages character varying,
1378 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1379 terms_agreed timestamp without time zone,
1380 consider_pd boolean DEFAULT false NOT NULL,
1381 auth_uid character varying,
1382 preferred_editor character varying,
1383 terms_seen boolean DEFAULT false NOT NULL,
1384 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1385 changesets_count integer DEFAULT 0 NOT NULL,
1386 traces_count integer DEFAULT 0 NOT NULL,
1387 diary_entries_count integer DEFAULT 0 NOT NULL,
1388 image_use_gravatar boolean DEFAULT false NOT NULL,
1389 auth_provider character varying,
1391 tou_agreed timestamp without time zone
1396 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1399 CREATE SEQUENCE public.users_id_seq
1408 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1411 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1415 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1418 CREATE TABLE public.way_nodes (
1419 way_id bigint NOT NULL,
1420 node_id bigint NOT NULL,
1421 version bigint NOT NULL,
1422 sequence_id bigint NOT NULL
1427 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1430 CREATE TABLE public.way_tags (
1431 way_id bigint DEFAULT 0 NOT NULL,
1432 k character varying NOT NULL,
1433 v character varying NOT NULL,
1434 version bigint NOT NULL
1439 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1442 CREATE TABLE public.ways (
1443 way_id bigint DEFAULT 0 NOT NULL,
1444 changeset_id bigint NOT NULL,
1445 "timestamp" timestamp without time zone NOT NULL,
1446 version bigint NOT NULL,
1447 visible boolean DEFAULT true NOT NULL,
1448 redaction_id integer
1453 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1456 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1460 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1463 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1467 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1470 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1474 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1477 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1481 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1484 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1488 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1491 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1495 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1498 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1502 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1505 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1509 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1512 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1516 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1519 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1523 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1526 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1530 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1533 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1537 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1540 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1544 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1547 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1551 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1554 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1558 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1561 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1565 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1568 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1572 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1575 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1579 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1582 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1586 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1589 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1593 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1596 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1600 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1603 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1607 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1610 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1614 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1617 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1621 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1624 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1628 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1631 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1635 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1638 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1642 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1645 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1649 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1652 ALTER TABLE ONLY public.acls
1653 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1657 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1660 ALTER TABLE ONLY public.active_storage_attachments
1661 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1665 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1668 ALTER TABLE ONLY public.active_storage_blobs
1669 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1673 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1676 ALTER TABLE ONLY public.ar_internal_metadata
1677 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1681 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1684 ALTER TABLE ONLY public.changeset_comments
1685 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1689 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1692 ALTER TABLE ONLY public.changesets
1693 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1697 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1700 ALTER TABLE ONLY public.client_applications
1701 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1705 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1708 ALTER TABLE ONLY public.current_node_tags
1709 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1713 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1716 ALTER TABLE ONLY public.current_nodes
1717 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1721 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1724 ALTER TABLE ONLY public.current_relation_members
1725 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1729 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1732 ALTER TABLE ONLY public.current_relation_tags
1733 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1737 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1740 ALTER TABLE ONLY public.current_relations
1741 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1745 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1748 ALTER TABLE ONLY public.current_way_nodes
1749 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1753 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1756 ALTER TABLE ONLY public.current_way_tags
1757 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1761 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1764 ALTER TABLE ONLY public.current_ways
1765 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1769 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1772 ALTER TABLE ONLY public.delayed_jobs
1773 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1777 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1780 ALTER TABLE ONLY public.diary_comments
1781 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1785 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1788 ALTER TABLE ONLY public.diary_entries
1789 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1793 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1796 ALTER TABLE ONLY public.diary_entry_subscriptions
1797 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1801 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1804 ALTER TABLE ONLY public.friends
1805 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1809 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1812 ALTER TABLE ONLY public.gpx_file_tags
1813 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1817 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1820 ALTER TABLE ONLY public.gpx_files
1821 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1825 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1828 ALTER TABLE ONLY public.issue_comments
1829 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1833 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1836 ALTER TABLE ONLY public.issues
1837 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
1841 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1844 ALTER TABLE ONLY public.languages
1845 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1849 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1852 ALTER TABLE ONLY public.messages
1853 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1857 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1860 ALTER TABLE ONLY public.node_tags
1861 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1865 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1868 ALTER TABLE ONLY public.nodes
1869 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1873 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1876 ALTER TABLE ONLY public.note_comments
1877 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1881 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1884 ALTER TABLE ONLY public.notes
1885 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1889 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1892 ALTER TABLE ONLY public.oauth_nonces
1893 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1897 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1900 ALTER TABLE ONLY public.oauth_tokens
1901 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1905 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1908 ALTER TABLE ONLY public.redactions
1909 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1913 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1916 ALTER TABLE ONLY public.relation_members
1917 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1921 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1924 ALTER TABLE ONLY public.relation_tags
1925 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1929 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1932 ALTER TABLE ONLY public.relations
1933 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1937 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1940 ALTER TABLE ONLY public.reports
1941 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
1945 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1948 ALTER TABLE ONLY public.schema_migrations
1949 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
1953 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1956 ALTER TABLE ONLY public.user_blocks
1957 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1961 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1964 ALTER TABLE ONLY public.user_preferences
1965 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1969 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1972 ALTER TABLE ONLY public.user_roles
1973 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1977 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1980 ALTER TABLE ONLY public.user_tokens
1981 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
1985 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1988 ALTER TABLE ONLY public.users
1989 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
1993 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1996 ALTER TABLE ONLY public.way_nodes
1997 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2001 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2004 ALTER TABLE ONLY public.way_tags
2005 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2009 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2012 ALTER TABLE ONLY public.ways
2013 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2017 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2020 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2024 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
2027 CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id);
2031 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2034 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2038 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2041 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2045 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2048 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2052 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2055 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2059 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2062 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2066 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2069 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2073 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2076 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2080 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2083 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2087 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2090 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2094 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2097 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2101 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2104 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2108 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2111 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2115 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2118 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2122 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2125 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2129 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2132 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2136 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2139 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2143 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2146 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2150 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -
2153 CREATE INDEX friends_user_id_idx ON public.friends USING btree (user_id);
2157 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2160 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2164 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2167 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2171 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2174 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2178 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2181 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2185 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2188 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2192 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2195 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2199 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2202 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2206 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2209 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2213 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2216 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2220 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2223 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2227 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2230 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2234 -- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2237 CREATE INDEX index_changeset_comments_on_changeset_id_and_created_at ON public.changeset_comments USING btree (changeset_id, created_at);
2241 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2244 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2248 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2251 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2255 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2258 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2262 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2265 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2269 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2272 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2276 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2279 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2283 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2286 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2290 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2293 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2297 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2300 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2304 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2307 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2311 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2314 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2318 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2321 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2325 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2328 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2332 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2335 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2339 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2342 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2346 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2349 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2353 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2356 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2360 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2363 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2367 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2370 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2374 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2377 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2381 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2384 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2388 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2391 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2395 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2398 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2402 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2405 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2409 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2412 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2416 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2419 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2423 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2426 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2430 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2433 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2437 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2440 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2444 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2447 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2451 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2454 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2458 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2461 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2465 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2468 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2472 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2475 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2479 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2482 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2486 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2489 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2493 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2496 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2500 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2503 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2507 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2510 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2514 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2517 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2521 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2524 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2528 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2531 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2535 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2538 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2542 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2545 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2549 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2552 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2556 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2559 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2563 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2566 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2570 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2573 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2577 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2580 ALTER TABLE ONLY public.changeset_comments
2581 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2585 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2588 ALTER TABLE ONLY public.changeset_comments
2589 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2593 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2596 ALTER TABLE ONLY public.changeset_tags
2597 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2601 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2604 ALTER TABLE ONLY public.changesets_subscribers
2605 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2609 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2612 ALTER TABLE ONLY public.changesets_subscribers
2613 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2617 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2620 ALTER TABLE ONLY public.changesets
2621 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2625 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2628 ALTER TABLE ONLY public.client_applications
2629 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2633 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2636 ALTER TABLE ONLY public.current_node_tags
2637 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2641 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2644 ALTER TABLE ONLY public.current_nodes
2645 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2649 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2652 ALTER TABLE ONLY public.current_relation_members
2653 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2657 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2660 ALTER TABLE ONLY public.current_relation_tags
2661 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2665 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2668 ALTER TABLE ONLY public.current_relations
2669 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2673 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2676 ALTER TABLE ONLY public.current_way_nodes
2677 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2681 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2684 ALTER TABLE ONLY public.current_way_nodes
2685 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2689 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2692 ALTER TABLE ONLY public.current_way_tags
2693 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2697 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2700 ALTER TABLE ONLY public.current_ways
2701 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2705 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2708 ALTER TABLE ONLY public.diary_comments
2709 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2713 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2716 ALTER TABLE ONLY public.diary_comments
2717 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2721 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2724 ALTER TABLE ONLY public.diary_entries
2725 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
2729 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2732 ALTER TABLE ONLY public.diary_entries
2733 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2737 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2740 ALTER TABLE ONLY public.diary_entry_subscriptions
2741 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2745 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2748 ALTER TABLE ONLY public.diary_entry_subscriptions
2749 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2753 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
2756 ALTER TABLE ONLY public.active_storage_attachments
2757 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
2761 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2764 ALTER TABLE ONLY public.friends
2765 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
2769 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2772 ALTER TABLE ONLY public.friends
2773 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2777 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2780 ALTER TABLE ONLY public.gps_points
2781 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2785 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2788 ALTER TABLE ONLY public.gpx_file_tags
2789 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2793 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2796 ALTER TABLE ONLY public.gpx_files
2797 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2801 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2804 ALTER TABLE ONLY public.issue_comments
2805 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2809 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2812 ALTER TABLE ONLY public.issue_comments
2813 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2817 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2820 ALTER TABLE ONLY public.issues
2821 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
2825 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2828 ALTER TABLE ONLY public.issues
2829 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
2833 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2836 ALTER TABLE ONLY public.issues
2837 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
2841 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2844 ALTER TABLE ONLY public.messages
2845 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
2849 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2852 ALTER TABLE ONLY public.messages
2853 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
2857 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2860 ALTER TABLE ONLY public.node_tags
2861 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
2865 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2868 ALTER TABLE ONLY public.nodes
2869 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2873 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2876 ALTER TABLE ONLY public.nodes
2877 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2881 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2884 ALTER TABLE ONLY public.note_comments
2885 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2889 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2892 ALTER TABLE ONLY public.note_comments
2893 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
2897 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2900 ALTER TABLE ONLY public.oauth_tokens
2901 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
2905 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2908 ALTER TABLE ONLY public.oauth_tokens
2909 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2913 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2916 ALTER TABLE ONLY public.redactions
2917 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2921 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2924 ALTER TABLE ONLY public.relation_members
2925 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2929 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2932 ALTER TABLE ONLY public.relation_tags
2933 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2937 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2940 ALTER TABLE ONLY public.relations
2941 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2945 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2948 ALTER TABLE ONLY public.relations
2949 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2953 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2956 ALTER TABLE ONLY public.reports
2957 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2961 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2964 ALTER TABLE ONLY public.reports
2965 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2969 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2972 ALTER TABLE ONLY public.user_blocks
2973 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
2977 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2980 ALTER TABLE ONLY public.user_blocks
2981 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
2985 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2988 ALTER TABLE ONLY public.user_blocks
2989 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2993 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2996 ALTER TABLE ONLY public.user_preferences
2997 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3001 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3004 ALTER TABLE ONLY public.user_roles
3005 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3009 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3012 ALTER TABLE ONLY public.user_roles
3013 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3017 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3020 ALTER TABLE ONLY public.user_tokens
3021 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3025 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3028 ALTER TABLE ONLY public.way_nodes
3029 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3033 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3036 ALTER TABLE ONLY public.way_tags
3037 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3041 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3044 ALTER TABLE ONLY public.ways
3045 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3049 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3052 ALTER TABLE ONLY public.ways
3053 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3057 -- PostgreSQL database dump complete
3060 SET search_path TO "$user", public;
3062 INSERT INTO "schema_migrations" (version) VALUES