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: maptile_for_point(bigint, bigint, integer); Type: FUNCTION; Schema: public; Owner: -
135 CREATE FUNCTION public.maptile_for_point(scaled_lat bigint, scaled_lon bigint, zoom integer) RETURNS integer
136 LANGUAGE plpgsql IMMUTABLE
139 lat CONSTANT DOUBLE PRECISION := scaled_lat / 10000000.0;
140 lon CONSTANT DOUBLE PRECISION := scaled_lon / 10000000.0;
141 zscale CONSTANT DOUBLE PRECISION := 2.0 ^ zoom;
142 pi CONSTANT DOUBLE PRECISION := 3.141592653589793;
143 r_per_d CONSTANT DOUBLE PRECISION := pi / 180.0;
147 -- straight port of the C code. see db/functions/maptile.c
148 x := floor((lon + 180.0) * zscale / 360.0);
149 y := floor((1.0 - ln(tan(lat * r_per_d) + 1.0 / cos(lat * r_per_d)) / pi) * zscale / 2.0);
151 RETURN (x << zoom) | y;
157 -- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
160 CREATE FUNCTION public.tile_for_point(scaled_lat integer, scaled_lon integer) RETURNS bigint
161 LANGUAGE plpgsql IMMUTABLE
164 x int8; -- quantized x from lon,
165 y int8; -- quantized y from lat,
167 x := round(((scaled_lon / 10000000.0) + 180.0) * 65535.0 / 360.0);
168 y := round(((scaled_lat / 10000000.0) + 90.0) * 65535.0 / 180.0);
170 -- these bit-masks are special numbers used in the bit interleaving algorithm.
171 -- see https://graphics.stanford.edu/~seander/bithacks.html#InterleaveBMN
172 -- for the original algorithm and more details.
173 x := (x | (x << 8)) & 16711935; -- 0x00FF00FF
174 x := (x | (x << 4)) & 252645135; -- 0x0F0F0F0F
175 x := (x | (x << 2)) & 858993459; -- 0x33333333
176 x := (x | (x << 1)) & 1431655765; -- 0x55555555
178 y := (y | (y << 8)) & 16711935; -- 0x00FF00FF
179 y := (y | (y << 4)) & 252645135; -- 0x0F0F0F0F
180 y := (y | (y << 2)) & 858993459; -- 0x33333333
181 y := (y | (y << 1)) & 1431655765; -- 0x55555555
189 -- Name: xid_to_int4(xid); Type: FUNCTION; Schema: public; Owner: -
192 CREATE FUNCTION public.xid_to_int4(t xid) RETURNS integer
193 LANGUAGE plpgsql STRICT
201 IF tl >= 2147483648 THEN
202 tl := tl - 4294967296;
212 SET default_tablespace = '';
214 SET default_with_oids = false;
217 -- Name: acls; Type: TABLE; Schema: public; Owner: -
220 CREATE TABLE public.acls (
223 k character varying NOT NULL,
225 domain character varying,
231 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
234 CREATE SEQUENCE public.acls_id_seq
243 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
246 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
250 -- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
253 CREATE TABLE public.active_storage_attachments (
255 name character varying NOT NULL,
256 record_type character varying NOT NULL,
257 record_id bigint NOT NULL,
258 blob_id bigint NOT NULL,
259 created_at timestamp without time zone NOT NULL
264 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
267 CREATE SEQUENCE public.active_storage_attachments_id_seq
276 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
279 ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
283 -- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
286 CREATE TABLE public.active_storage_blobs (
288 key character varying NOT NULL,
289 filename character varying NOT NULL,
290 content_type character varying,
292 byte_size bigint NOT NULL,
293 checksum character varying NOT NULL,
294 created_at timestamp without time zone NOT NULL
299 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
302 CREATE SEQUENCE public.active_storage_blobs_id_seq
311 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
314 ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
318 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
321 CREATE TABLE public.ar_internal_metadata (
322 key character varying NOT NULL,
323 value character varying,
324 created_at timestamp(6) without time zone NOT NULL,
325 updated_at timestamp(6) without time zone NOT NULL
330 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
333 CREATE TABLE public.changeset_comments (
335 changeset_id bigint NOT NULL,
336 author_id bigint NOT NULL,
338 created_at timestamp without time zone NOT NULL,
339 visible boolean NOT NULL
344 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
347 CREATE SEQUENCE public.changeset_comments_id_seq
356 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
359 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
363 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
366 CREATE TABLE public.changeset_tags (
367 changeset_id bigint NOT NULL,
368 k character varying DEFAULT ''::character varying NOT NULL,
369 v character varying DEFAULT ''::character varying NOT NULL
374 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
377 CREATE TABLE public.changesets (
379 user_id bigint NOT NULL,
380 created_at timestamp without time zone NOT NULL,
385 closed_at timestamp without time zone NOT NULL,
386 num_changes integer DEFAULT 0 NOT NULL
391 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
394 CREATE SEQUENCE public.changesets_id_seq
403 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
406 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
410 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
413 CREATE TABLE public.changesets_subscribers (
414 subscriber_id bigint NOT NULL,
415 changeset_id bigint NOT NULL
420 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
423 CREATE TABLE public.client_applications (
425 name character varying,
426 url character varying,
427 support_url character varying,
428 callback_url character varying,
429 key character varying(50),
430 secret character varying(50),
432 created_at timestamp without time zone,
433 updated_at timestamp without time zone,
434 allow_read_prefs boolean DEFAULT false NOT NULL,
435 allow_write_prefs boolean DEFAULT false NOT NULL,
436 allow_write_diary boolean DEFAULT false NOT NULL,
437 allow_write_api boolean DEFAULT false NOT NULL,
438 allow_read_gpx boolean DEFAULT false NOT NULL,
439 allow_write_gpx boolean DEFAULT false NOT NULL,
440 allow_write_notes boolean DEFAULT false NOT NULL
445 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
448 CREATE SEQUENCE public.client_applications_id_seq
457 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
460 ALTER SEQUENCE public.client_applications_id_seq OWNED BY public.client_applications.id;
464 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
467 CREATE TABLE public.current_node_tags (
468 node_id bigint NOT NULL,
469 k character varying DEFAULT ''::character varying NOT NULL,
470 v character varying DEFAULT ''::character varying NOT NULL
475 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
478 CREATE TABLE public.current_nodes (
480 latitude integer NOT NULL,
481 longitude integer NOT NULL,
482 changeset_id bigint NOT NULL,
483 visible boolean NOT NULL,
484 "timestamp" timestamp without time zone NOT NULL,
485 tile bigint NOT NULL,
486 version bigint NOT NULL
491 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
494 CREATE SEQUENCE public.current_nodes_id_seq
503 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
506 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
510 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
513 CREATE TABLE public.current_relation_members (
514 relation_id bigint NOT NULL,
515 member_type public.nwr_enum NOT NULL,
516 member_id bigint NOT NULL,
517 member_role character varying NOT NULL,
518 sequence_id integer DEFAULT 0 NOT NULL
523 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
526 CREATE TABLE public.current_relation_tags (
527 relation_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_relations; Type: TABLE; Schema: public; Owner: -
537 CREATE TABLE public.current_relations (
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_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
550 CREATE SEQUENCE public.current_relations_id_seq
559 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
562 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
566 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
569 CREATE TABLE public.current_way_nodes (
570 way_id bigint NOT NULL,
571 node_id bigint NOT NULL,
572 sequence_id bigint NOT NULL
577 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
580 CREATE TABLE public.current_way_tags (
581 way_id bigint NOT NULL,
582 k character varying DEFAULT ''::character varying NOT NULL,
583 v character varying DEFAULT ''::character varying NOT NULL
588 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
591 CREATE TABLE public.current_ways (
593 changeset_id bigint NOT NULL,
594 "timestamp" timestamp without time zone NOT NULL,
595 visible boolean NOT NULL,
596 version bigint NOT NULL
601 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
604 CREATE SEQUENCE public.current_ways_id_seq
613 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
616 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
620 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
623 CREATE TABLE public.delayed_jobs (
625 priority integer DEFAULT 0 NOT NULL,
626 attempts integer DEFAULT 0 NOT NULL,
627 handler text NOT NULL,
629 run_at timestamp without time zone,
630 locked_at timestamp without time zone,
631 failed_at timestamp without time zone,
632 locked_by character varying,
633 queue character varying,
634 created_at timestamp without time zone,
635 updated_at timestamp without time zone
640 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
643 CREATE SEQUENCE public.delayed_jobs_id_seq
652 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
655 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
659 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
662 CREATE TABLE public.diary_comments (
664 diary_entry_id bigint NOT NULL,
665 user_id bigint NOT NULL,
667 created_at timestamp without time zone NOT NULL,
668 updated_at timestamp without time zone NOT NULL,
669 visible boolean DEFAULT true NOT NULL,
670 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
675 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
678 CREATE SEQUENCE public.diary_comments_id_seq
687 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
690 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
694 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
697 CREATE TABLE public.diary_entries (
699 user_id bigint NOT NULL,
700 title character varying NOT NULL,
702 created_at timestamp without time zone NOT NULL,
703 updated_at timestamp without time zone NOT NULL,
704 latitude double precision,
705 longitude double precision,
706 language_code character varying DEFAULT 'en'::character varying NOT NULL,
707 visible boolean DEFAULT true NOT NULL,
708 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
713 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
716 CREATE SEQUENCE public.diary_entries_id_seq
725 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
728 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
732 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
735 CREATE TABLE public.diary_entry_subscriptions (
736 user_id bigint NOT NULL,
737 diary_entry_id bigint NOT NULL
742 -- Name: friends; Type: TABLE; Schema: public; Owner: -
745 CREATE TABLE public.friends (
747 user_id bigint NOT NULL,
748 friend_user_id bigint NOT NULL
753 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
756 CREATE SEQUENCE public.friends_id_seq
765 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
768 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
772 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
775 CREATE TABLE public.gps_points (
776 altitude double precision,
777 trackid integer NOT NULL,
778 latitude integer NOT NULL,
779 longitude integer NOT NULL,
780 gpx_id bigint NOT NULL,
781 "timestamp" timestamp without time zone,
787 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
790 CREATE TABLE public.gpx_file_tags (
791 gpx_id bigint DEFAULT 0 NOT NULL,
792 tag character varying NOT NULL,
798 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
801 CREATE SEQUENCE public.gpx_file_tags_id_seq
810 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
813 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
817 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
820 CREATE TABLE public.gpx_files (
822 user_id bigint NOT NULL,
823 visible boolean DEFAULT true NOT NULL,
824 name character varying DEFAULT ''::character varying NOT NULL,
826 latitude double precision,
827 longitude double precision,
828 "timestamp" timestamp without time zone NOT NULL,
829 description character varying DEFAULT ''::character varying NOT NULL,
830 inserted boolean NOT NULL,
831 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
836 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
839 CREATE SEQUENCE public.gpx_files_id_seq
848 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
851 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
855 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
858 CREATE TABLE public.issue_comments (
860 issue_id integer NOT NULL,
861 user_id integer NOT NULL,
863 created_at timestamp without time zone NOT NULL,
864 updated_at timestamp without time zone NOT NULL
869 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
872 CREATE SEQUENCE public.issue_comments_id_seq
881 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
884 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
888 -- Name: issues; Type: TABLE; Schema: public; Owner: -
891 CREATE TABLE public.issues (
893 reportable_type character varying NOT NULL,
894 reportable_id integer NOT NULL,
895 reported_user_id integer,
896 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
897 assigned_role public.user_role_enum NOT NULL,
898 resolved_at timestamp without time zone,
901 reports_count integer DEFAULT 0,
902 created_at timestamp without time zone NOT NULL,
903 updated_at timestamp without time zone NOT NULL
908 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
911 CREATE SEQUENCE public.issues_id_seq
920 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
923 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
927 -- Name: languages; Type: TABLE; Schema: public; Owner: -
930 CREATE TABLE public.languages (
931 code character varying NOT NULL,
932 english_name character varying NOT NULL,
933 native_name character varying
938 -- Name: messages; Type: TABLE; Schema: public; Owner: -
941 CREATE TABLE public.messages (
943 from_user_id bigint NOT NULL,
944 title character varying NOT NULL,
946 sent_on timestamp without time zone NOT NULL,
947 message_read boolean DEFAULT false NOT NULL,
948 to_user_id bigint NOT NULL,
949 to_user_visible boolean DEFAULT true NOT NULL,
950 from_user_visible boolean DEFAULT true NOT NULL,
951 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
956 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
959 CREATE SEQUENCE public.messages_id_seq
968 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
971 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
975 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
978 CREATE TABLE public.node_tags (
979 node_id bigint NOT NULL,
980 version bigint NOT NULL,
981 k character varying DEFAULT ''::character varying NOT NULL,
982 v character varying DEFAULT ''::character varying NOT NULL
987 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
990 CREATE TABLE public.nodes (
991 node_id bigint NOT NULL,
992 latitude integer NOT NULL,
993 longitude integer NOT NULL,
994 changeset_id bigint NOT NULL,
995 visible boolean NOT NULL,
996 "timestamp" timestamp without time zone NOT NULL,
997 tile bigint NOT NULL,
998 version bigint NOT NULL,
1004 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
1007 CREATE TABLE public.note_comments (
1009 note_id bigint NOT NULL,
1010 visible boolean NOT NULL,
1011 created_at timestamp without time zone NOT NULL,
1015 event public.note_event_enum
1020 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1023 CREATE SEQUENCE public.note_comments_id_seq
1032 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1035 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
1039 -- Name: notes; Type: TABLE; Schema: public; Owner: -
1042 CREATE TABLE public.notes (
1044 latitude integer NOT NULL,
1045 longitude integer NOT NULL,
1046 tile bigint NOT NULL,
1047 updated_at timestamp without time zone NOT NULL,
1048 created_at timestamp without time zone NOT NULL,
1049 status public.note_status_enum NOT NULL,
1050 closed_at timestamp without time zone
1055 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1058 CREATE SEQUENCE public.notes_id_seq
1067 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1070 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
1074 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
1077 CREATE TABLE public.oauth_nonces (
1078 id integer NOT NULL,
1079 nonce character varying,
1080 "timestamp" integer,
1081 created_at timestamp without time zone,
1082 updated_at timestamp without time zone
1087 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1090 CREATE SEQUENCE public.oauth_nonces_id_seq
1099 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1102 ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id;
1106 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
1109 CREATE TABLE public.oauth_tokens (
1110 id integer NOT NULL,
1112 type character varying(20),
1113 client_application_id integer,
1114 token character varying(50),
1115 secret character varying(50),
1116 authorized_at timestamp without time zone,
1117 invalidated_at timestamp without time zone,
1118 created_at timestamp without time zone,
1119 updated_at timestamp without time zone,
1120 allow_read_prefs boolean DEFAULT false NOT NULL,
1121 allow_write_prefs boolean DEFAULT false NOT NULL,
1122 allow_write_diary boolean DEFAULT false NOT NULL,
1123 allow_write_api boolean DEFAULT false NOT NULL,
1124 allow_read_gpx boolean DEFAULT false NOT NULL,
1125 allow_write_gpx boolean DEFAULT false NOT NULL,
1126 callback_url character varying,
1127 verifier character varying(20),
1128 scope character varying,
1129 valid_to timestamp without time zone,
1130 allow_write_notes boolean DEFAULT false NOT NULL
1135 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1138 CREATE SEQUENCE public.oauth_tokens_id_seq
1147 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1150 ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
1154 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1157 CREATE TABLE public.redactions (
1158 id integer NOT NULL,
1159 title character varying,
1161 created_at timestamp without time zone,
1162 updated_at timestamp without time zone,
1163 user_id bigint NOT NULL,
1164 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1169 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1172 CREATE SEQUENCE public.redactions_id_seq
1181 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1184 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1188 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1191 CREATE TABLE public.relation_members (
1192 relation_id bigint DEFAULT 0 NOT NULL,
1193 member_type public.nwr_enum NOT NULL,
1194 member_id bigint NOT NULL,
1195 member_role character varying NOT NULL,
1196 version bigint DEFAULT 0 NOT NULL,
1197 sequence_id integer DEFAULT 0 NOT NULL
1202 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1205 CREATE TABLE public.relation_tags (
1206 relation_id bigint DEFAULT 0 NOT NULL,
1207 k character varying DEFAULT ''::character varying NOT NULL,
1208 v character varying DEFAULT ''::character varying NOT NULL,
1209 version bigint NOT NULL
1214 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1217 CREATE TABLE public.relations (
1218 relation_id bigint DEFAULT 0 NOT NULL,
1219 changeset_id bigint NOT NULL,
1220 "timestamp" timestamp without time zone NOT NULL,
1221 version bigint NOT NULL,
1222 visible boolean DEFAULT true NOT NULL,
1223 redaction_id integer
1228 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1231 CREATE TABLE public.reports (
1232 id integer NOT NULL,
1233 issue_id integer NOT NULL,
1234 user_id integer NOT NULL,
1235 details text NOT NULL,
1236 category character varying NOT NULL,
1237 created_at timestamp without time zone NOT NULL,
1238 updated_at timestamp without time zone NOT NULL
1243 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1246 CREATE SEQUENCE public.reports_id_seq
1255 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1258 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1262 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1265 CREATE TABLE public.schema_migrations (
1266 version character varying NOT NULL
1271 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1274 CREATE TABLE public.user_blocks (
1275 id integer NOT NULL,
1276 user_id bigint NOT NULL,
1277 creator_id bigint NOT NULL,
1278 reason text NOT NULL,
1279 ends_at timestamp without time zone NOT NULL,
1280 needs_view boolean DEFAULT false NOT NULL,
1282 created_at timestamp without time zone,
1283 updated_at timestamp without time zone,
1284 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1289 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1292 CREATE SEQUENCE public.user_blocks_id_seq
1301 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1304 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1308 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1311 CREATE TABLE public.user_preferences (
1312 user_id bigint NOT NULL,
1313 k character varying NOT NULL,
1314 v character varying NOT NULL
1319 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1322 CREATE TABLE public.user_roles (
1323 id integer NOT NULL,
1324 user_id bigint NOT NULL,
1325 role public.user_role_enum NOT NULL,
1326 created_at timestamp without time zone,
1327 updated_at timestamp without time zone,
1328 granter_id bigint NOT NULL
1333 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1336 CREATE SEQUENCE public.user_roles_id_seq
1345 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1348 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1352 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1355 CREATE TABLE public.user_tokens (
1357 user_id bigint NOT NULL,
1358 token character varying NOT NULL,
1359 expiry timestamp without time zone NOT NULL,
1365 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1368 CREATE SEQUENCE public.user_tokens_id_seq
1377 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1380 ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id;
1384 -- Name: users; Type: TABLE; Schema: public; Owner: -
1387 CREATE TABLE public.users (
1388 email character varying NOT NULL,
1390 pass_crypt character varying NOT NULL,
1391 creation_time timestamp without time zone NOT NULL,
1392 display_name character varying DEFAULT ''::character varying NOT NULL,
1393 data_public boolean DEFAULT false NOT NULL,
1394 description text DEFAULT ''::text NOT NULL,
1395 home_lat double precision,
1396 home_lon double precision,
1397 home_zoom smallint DEFAULT 3,
1398 pass_salt character varying,
1399 email_valid boolean DEFAULT false NOT NULL,
1400 new_email character varying,
1401 creation_ip character varying,
1402 languages character varying,
1403 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1404 terms_agreed timestamp without time zone,
1405 consider_pd boolean DEFAULT false NOT NULL,
1406 auth_uid character varying,
1407 preferred_editor character varying,
1408 terms_seen boolean DEFAULT false NOT NULL,
1409 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1410 changesets_count integer DEFAULT 0 NOT NULL,
1411 traces_count integer DEFAULT 0 NOT NULL,
1412 diary_entries_count integer DEFAULT 0 NOT NULL,
1413 image_use_gravatar boolean DEFAULT false NOT NULL,
1414 auth_provider character varying,
1416 tou_agreed timestamp without time zone
1421 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1424 CREATE SEQUENCE public.users_id_seq
1433 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1436 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1440 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1443 CREATE TABLE public.way_nodes (
1444 way_id bigint NOT NULL,
1445 node_id bigint NOT NULL,
1446 version bigint NOT NULL,
1447 sequence_id bigint NOT NULL
1452 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1455 CREATE TABLE public.way_tags (
1456 way_id bigint DEFAULT 0 NOT NULL,
1457 k character varying NOT NULL,
1458 v character varying NOT NULL,
1459 version bigint NOT NULL
1464 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1467 CREATE TABLE public.ways (
1468 way_id bigint DEFAULT 0 NOT NULL,
1469 changeset_id bigint NOT NULL,
1470 "timestamp" timestamp without time zone NOT NULL,
1471 version bigint NOT NULL,
1472 visible boolean DEFAULT true NOT NULL,
1473 redaction_id integer
1478 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1481 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1485 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1488 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1492 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1495 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1499 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1502 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1506 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1509 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1513 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1516 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1520 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1523 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1527 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1530 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1534 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1537 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1541 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1544 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1548 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1551 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1555 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1558 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1562 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1565 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1569 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1572 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1576 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1579 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1583 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1586 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1590 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1593 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1597 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1600 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1604 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1607 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1611 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1614 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1618 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1621 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1625 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1628 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1632 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1635 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1639 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1642 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1646 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1649 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1653 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1656 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1660 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1663 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1667 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1670 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1674 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1677 ALTER TABLE ONLY public.acls
1678 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1682 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1685 ALTER TABLE ONLY public.active_storage_attachments
1686 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1690 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1693 ALTER TABLE ONLY public.active_storage_blobs
1694 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1698 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1701 ALTER TABLE ONLY public.ar_internal_metadata
1702 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1706 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1709 ALTER TABLE ONLY public.changeset_comments
1710 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1714 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1717 ALTER TABLE ONLY public.changesets
1718 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1722 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1725 ALTER TABLE ONLY public.client_applications
1726 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1730 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1733 ALTER TABLE ONLY public.current_node_tags
1734 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1738 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1741 ALTER TABLE ONLY public.current_nodes
1742 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1746 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1749 ALTER TABLE ONLY public.current_relation_members
1750 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1754 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1757 ALTER TABLE ONLY public.current_relation_tags
1758 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1762 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1765 ALTER TABLE ONLY public.current_relations
1766 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1770 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1773 ALTER TABLE ONLY public.current_way_nodes
1774 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1778 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1781 ALTER TABLE ONLY public.current_way_tags
1782 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1786 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1789 ALTER TABLE ONLY public.current_ways
1790 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1794 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1797 ALTER TABLE ONLY public.delayed_jobs
1798 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1802 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1805 ALTER TABLE ONLY public.diary_comments
1806 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1810 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1813 ALTER TABLE ONLY public.diary_entries
1814 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1818 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1821 ALTER TABLE ONLY public.diary_entry_subscriptions
1822 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1826 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1829 ALTER TABLE ONLY public.friends
1830 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1834 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1837 ALTER TABLE ONLY public.gpx_file_tags
1838 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1842 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1845 ALTER TABLE ONLY public.gpx_files
1846 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1850 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1853 ALTER TABLE ONLY public.issue_comments
1854 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1858 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1861 ALTER TABLE ONLY public.issues
1862 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
1866 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1869 ALTER TABLE ONLY public.languages
1870 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1874 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1877 ALTER TABLE ONLY public.messages
1878 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1882 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1885 ALTER TABLE ONLY public.node_tags
1886 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1890 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1893 ALTER TABLE ONLY public.nodes
1894 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1898 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1901 ALTER TABLE ONLY public.note_comments
1902 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1906 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1909 ALTER TABLE ONLY public.notes
1910 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1914 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1917 ALTER TABLE ONLY public.oauth_nonces
1918 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1922 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1925 ALTER TABLE ONLY public.oauth_tokens
1926 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1930 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1933 ALTER TABLE ONLY public.redactions
1934 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1938 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1941 ALTER TABLE ONLY public.relation_members
1942 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1946 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1949 ALTER TABLE ONLY public.relation_tags
1950 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1954 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1957 ALTER TABLE ONLY public.relations
1958 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1962 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1965 ALTER TABLE ONLY public.reports
1966 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
1970 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1973 ALTER TABLE ONLY public.schema_migrations
1974 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
1978 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1981 ALTER TABLE ONLY public.user_blocks
1982 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1986 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1989 ALTER TABLE ONLY public.user_preferences
1990 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1994 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1997 ALTER TABLE ONLY public.user_roles
1998 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
2002 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2005 ALTER TABLE ONLY public.user_tokens
2006 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
2010 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2013 ALTER TABLE ONLY public.users
2014 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2018 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2021 ALTER TABLE ONLY public.way_nodes
2022 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2026 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2029 ALTER TABLE ONLY public.way_tags
2030 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2034 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2037 ALTER TABLE ONLY public.ways
2038 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2042 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2045 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2049 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
2052 CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id);
2056 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2059 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2063 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2066 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2070 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2073 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2077 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2080 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2084 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2087 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2091 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2094 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2098 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2101 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2105 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2108 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2112 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2115 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2119 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2122 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2126 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2129 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2133 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2136 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2140 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2143 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2147 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2150 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2154 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2157 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2161 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2164 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2168 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2171 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2175 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -
2178 CREATE INDEX friends_user_id_idx ON public.friends USING btree (user_id);
2182 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2185 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2189 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2192 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2196 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2199 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2203 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2206 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2210 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2213 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2217 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2220 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2224 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2227 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2231 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2234 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2238 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2241 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2245 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2248 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2252 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2255 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2259 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2262 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2266 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2269 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2273 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2276 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2280 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2283 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2287 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2290 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2294 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2297 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2301 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2304 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2308 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2311 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2315 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2318 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2322 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2325 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2329 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2332 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2336 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2339 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2343 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2346 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2350 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2353 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2357 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2360 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2364 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2367 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2371 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2374 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2378 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2381 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2385 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2388 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2392 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2395 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2399 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2402 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2406 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2409 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2413 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2416 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2420 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2423 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2427 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2430 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2434 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2437 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2441 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2444 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2448 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2451 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2455 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2458 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2462 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2465 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2469 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2472 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2476 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2479 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2483 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2486 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2490 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2493 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2497 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2500 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2504 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2507 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2511 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2514 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2518 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2521 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2525 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2528 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2532 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2535 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2539 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2542 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2546 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2549 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2553 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2556 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2560 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2563 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2567 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2570 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2574 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2577 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2581 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2584 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2588 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2591 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2595 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2598 ALTER TABLE ONLY public.changeset_comments
2599 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2603 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2606 ALTER TABLE ONLY public.changeset_comments
2607 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2611 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2614 ALTER TABLE ONLY public.changeset_tags
2615 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2619 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2622 ALTER TABLE ONLY public.changesets_subscribers
2623 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2627 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2630 ALTER TABLE ONLY public.changesets_subscribers
2631 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2635 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2638 ALTER TABLE ONLY public.changesets
2639 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2643 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2646 ALTER TABLE ONLY public.client_applications
2647 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2651 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2654 ALTER TABLE ONLY public.current_node_tags
2655 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2659 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2662 ALTER TABLE ONLY public.current_nodes
2663 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2667 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2670 ALTER TABLE ONLY public.current_relation_members
2671 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2675 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2678 ALTER TABLE ONLY public.current_relation_tags
2679 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2683 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2686 ALTER TABLE ONLY public.current_relations
2687 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2691 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2694 ALTER TABLE ONLY public.current_way_nodes
2695 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2699 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2702 ALTER TABLE ONLY public.current_way_nodes
2703 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2707 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2710 ALTER TABLE ONLY public.current_way_tags
2711 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2715 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2718 ALTER TABLE ONLY public.current_ways
2719 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2723 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2726 ALTER TABLE ONLY public.diary_comments
2727 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2731 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2734 ALTER TABLE ONLY public.diary_comments
2735 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2739 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2742 ALTER TABLE ONLY public.diary_entries
2743 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
2747 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2750 ALTER TABLE ONLY public.diary_entries
2751 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2755 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2758 ALTER TABLE ONLY public.diary_entry_subscriptions
2759 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2763 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2766 ALTER TABLE ONLY public.diary_entry_subscriptions
2767 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2771 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
2774 ALTER TABLE ONLY public.active_storage_attachments
2775 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
2779 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2782 ALTER TABLE ONLY public.friends
2783 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
2787 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2790 ALTER TABLE ONLY public.friends
2791 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2795 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2798 ALTER TABLE ONLY public.gps_points
2799 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2803 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2806 ALTER TABLE ONLY public.gpx_file_tags
2807 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2811 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2814 ALTER TABLE ONLY public.gpx_files
2815 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2819 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2822 ALTER TABLE ONLY public.issue_comments
2823 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2827 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2830 ALTER TABLE ONLY public.issue_comments
2831 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2835 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2838 ALTER TABLE ONLY public.issues
2839 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
2843 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2846 ALTER TABLE ONLY public.issues
2847 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
2851 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2854 ALTER TABLE ONLY public.issues
2855 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
2859 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2862 ALTER TABLE ONLY public.messages
2863 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
2867 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2870 ALTER TABLE ONLY public.messages
2871 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
2875 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2878 ALTER TABLE ONLY public.node_tags
2879 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
2883 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2886 ALTER TABLE ONLY public.nodes
2887 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2891 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2894 ALTER TABLE ONLY public.nodes
2895 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2899 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2902 ALTER TABLE ONLY public.note_comments
2903 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2907 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2910 ALTER TABLE ONLY public.note_comments
2911 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
2915 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2918 ALTER TABLE ONLY public.oauth_tokens
2919 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
2923 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2926 ALTER TABLE ONLY public.oauth_tokens
2927 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2931 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2934 ALTER TABLE ONLY public.redactions
2935 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2939 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2942 ALTER TABLE ONLY public.relation_members
2943 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2947 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2950 ALTER TABLE ONLY public.relation_tags
2951 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2955 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2958 ALTER TABLE ONLY public.relations
2959 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2963 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2966 ALTER TABLE ONLY public.relations
2967 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2971 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2974 ALTER TABLE ONLY public.reports
2975 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2979 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2982 ALTER TABLE ONLY public.reports
2983 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2987 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2990 ALTER TABLE ONLY public.user_blocks
2991 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
2995 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2998 ALTER TABLE ONLY public.user_blocks
2999 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
3003 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3006 ALTER TABLE ONLY public.user_blocks
3007 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3011 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3014 ALTER TABLE ONLY public.user_preferences
3015 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3019 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3022 ALTER TABLE ONLY public.user_roles
3023 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3027 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3030 ALTER TABLE ONLY public.user_roles
3031 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3035 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3038 ALTER TABLE ONLY public.user_tokens
3039 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3043 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3046 ALTER TABLE ONLY public.way_nodes
3047 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3051 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3054 ALTER TABLE ONLY public.way_tags
3055 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3059 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3062 ALTER TABLE ONLY public.ways
3063 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3067 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3070 ALTER TABLE ONLY public.ways
3071 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3075 -- PostgreSQL database dump complete
3078 SET search_path TO "$user", public;
3080 INSERT INTO "schema_migrations" (version) VALUES