1 SET statement_timeout = 0;
3 SET idle_in_transaction_session_timeout = 0;
4 SET client_encoding = 'UTF8';
5 SET standard_conforming_strings = on;
6 SELECT pg_catalog.set_config('search_path', '', false);
7 SET check_function_bodies = false;
8 SET xmloption = content;
9 SET client_min_messages = warning;
10 SET row_security = off;
13 -- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: -
16 CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public;
20 -- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: -
23 COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST';
27 -- Name: format_enum; Type: TYPE; Schema: public; Owner: -
30 CREATE TYPE public.format_enum AS ENUM (
38 -- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: -
41 CREATE TYPE public.gpx_visibility_enum AS ENUM (
50 -- Name: issue_status_enum; Type: TYPE; Schema: public; Owner: -
53 CREATE TYPE public.issue_status_enum AS ENUM (
61 -- Name: note_event_enum; Type: TYPE; Schema: public; Owner: -
64 CREATE TYPE public.note_event_enum AS ENUM (
74 -- Name: note_status_enum; Type: TYPE; Schema: public; Owner: -
77 CREATE TYPE public.note_status_enum AS ENUM (
85 -- Name: nwr_enum; Type: TYPE; Schema: public; Owner: -
88 CREATE TYPE public.nwr_enum AS ENUM (
96 -- Name: user_role_enum; Type: TYPE; Schema: public; Owner: -
99 CREATE TYPE public.user_role_enum AS ENUM (
106 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
109 CREATE TYPE public.user_status_enum AS ENUM (
119 -- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
122 CREATE FUNCTION public.tile_for_point(scaled_lat integer, scaled_lon integer) RETURNS bigint
123 LANGUAGE plpgsql IMMUTABLE
126 x int8; -- quantized x from lon,
127 y int8; -- quantized y from lat,
129 x := round(((scaled_lon / 10000000.0) + 180.0) * 65535.0 / 360.0);
130 y := round(((scaled_lat / 10000000.0) + 90.0) * 65535.0 / 180.0);
132 -- these bit-masks are special numbers used in the bit interleaving algorithm.
133 -- see https://graphics.stanford.edu/~seander/bithacks.html#InterleaveBMN
134 -- for the original algorithm and more details.
135 x := (x | (x << 8)) & 16711935; -- 0x00FF00FF
136 x := (x | (x << 4)) & 252645135; -- 0x0F0F0F0F
137 x := (x | (x << 2)) & 858993459; -- 0x33333333
138 x := (x | (x << 1)) & 1431655765; -- 0x55555555
140 y := (y | (y << 8)) & 16711935; -- 0x00FF00FF
141 y := (y | (y << 4)) & 252645135; -- 0x0F0F0F0F
142 y := (y | (y << 2)) & 858993459; -- 0x33333333
143 y := (y | (y << 1)) & 1431655765; -- 0x55555555
151 -- Name: xid_to_int4(xid); Type: FUNCTION; Schema: public; Owner: -
154 CREATE FUNCTION public.xid_to_int4(t xid) RETURNS integer
155 LANGUAGE plpgsql IMMUTABLE STRICT
163 IF tl >= 2147483648 THEN
164 tl := tl - 4294967296;
174 SET default_tablespace = '';
176 SET default_table_access_method = heap;
179 -- Name: acls; Type: TABLE; Schema: public; Owner: -
182 CREATE TABLE public.acls (
185 k character varying NOT NULL,
187 domain character varying,
193 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
196 CREATE SEQUENCE public.acls_id_seq
205 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
208 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
212 -- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
215 CREATE TABLE public.active_storage_attachments (
217 name character varying NOT NULL,
218 record_type character varying NOT NULL,
219 record_id bigint NOT NULL,
220 blob_id bigint NOT NULL,
221 created_at timestamp without time zone NOT NULL
226 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
229 CREATE SEQUENCE public.active_storage_attachments_id_seq
238 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
241 ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
245 -- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
248 CREATE TABLE public.active_storage_blobs (
250 key character varying NOT NULL,
251 filename character varying NOT NULL,
252 content_type character varying,
254 byte_size bigint NOT NULL,
255 checksum character varying NOT NULL,
256 created_at timestamp without time zone NOT NULL,
257 service_name character varying NOT NULL
262 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
265 CREATE SEQUENCE public.active_storage_blobs_id_seq
274 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
277 ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
281 -- Name: active_storage_variant_records; Type: TABLE; Schema: public; Owner: -
284 CREATE TABLE public.active_storage_variant_records (
286 blob_id bigint NOT NULL,
287 variation_digest character varying NOT NULL
292 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE; Schema: public; Owner: -
295 CREATE SEQUENCE public.active_storage_variant_records_id_seq
304 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
307 ALTER SEQUENCE public.active_storage_variant_records_id_seq OWNED BY public.active_storage_variant_records.id;
311 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
314 CREATE TABLE public.ar_internal_metadata (
315 key character varying NOT NULL,
316 value character varying,
317 created_at timestamp(6) without time zone NOT NULL,
318 updated_at timestamp(6) without time zone NOT NULL
323 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
326 CREATE TABLE public.changeset_comments (
328 changeset_id bigint NOT NULL,
329 author_id bigint NOT NULL,
331 created_at timestamp without time zone NOT NULL,
332 visible boolean NOT NULL
337 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
340 CREATE SEQUENCE public.changeset_comments_id_seq
350 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
353 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
357 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
360 CREATE TABLE public.changeset_tags (
361 changeset_id bigint NOT NULL,
362 k character varying DEFAULT ''::character varying NOT NULL,
363 v character varying DEFAULT ''::character varying NOT NULL
368 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
371 CREATE TABLE public.changesets (
373 user_id bigint NOT NULL,
374 created_at timestamp without time zone NOT NULL,
379 closed_at timestamp without time zone NOT NULL,
380 num_changes integer DEFAULT 0 NOT NULL
385 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
388 CREATE SEQUENCE public.changesets_id_seq
397 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
400 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
404 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
407 CREATE TABLE public.changesets_subscribers (
408 subscriber_id bigint NOT NULL,
409 changeset_id bigint NOT NULL
414 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
417 CREATE TABLE public.client_applications (
419 name character varying,
420 url character varying,
421 support_url character varying,
422 callback_url character varying,
423 key character varying(50),
424 secret character varying(50),
426 created_at timestamp without time zone,
427 updated_at timestamp without time zone,
428 allow_read_prefs boolean DEFAULT false NOT NULL,
429 allow_write_prefs boolean DEFAULT false NOT NULL,
430 allow_write_diary boolean DEFAULT false NOT NULL,
431 allow_write_api boolean DEFAULT false NOT NULL,
432 allow_read_gpx boolean DEFAULT false NOT NULL,
433 allow_write_gpx boolean DEFAULT false NOT NULL,
434 allow_write_notes boolean DEFAULT false NOT NULL
439 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
442 CREATE SEQUENCE public.client_applications_id_seq
452 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
455 ALTER SEQUENCE public.client_applications_id_seq OWNED BY public.client_applications.id;
459 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
462 CREATE TABLE public.current_node_tags (
463 node_id bigint NOT NULL,
464 k character varying DEFAULT ''::character varying NOT NULL,
465 v character varying DEFAULT ''::character varying NOT NULL
470 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
473 CREATE TABLE public.current_nodes (
475 latitude integer NOT NULL,
476 longitude integer NOT NULL,
477 changeset_id bigint NOT NULL,
478 visible boolean NOT NULL,
479 "timestamp" timestamp without time zone NOT NULL,
480 tile bigint NOT NULL,
481 version bigint NOT NULL
486 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
489 CREATE SEQUENCE public.current_nodes_id_seq
498 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
501 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
505 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
508 CREATE TABLE public.current_relation_members (
509 relation_id bigint NOT NULL,
510 member_type public.nwr_enum NOT NULL,
511 member_id bigint NOT NULL,
512 member_role character varying NOT NULL,
513 sequence_id integer DEFAULT 0 NOT NULL
518 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
521 CREATE TABLE public.current_relation_tags (
522 relation_id bigint NOT NULL,
523 k character varying DEFAULT ''::character varying NOT NULL,
524 v character varying DEFAULT ''::character varying NOT NULL
529 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
532 CREATE TABLE public.current_relations (
534 changeset_id bigint NOT NULL,
535 "timestamp" timestamp without time zone NOT NULL,
536 visible boolean NOT NULL,
537 version bigint NOT NULL
542 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
545 CREATE SEQUENCE public.current_relations_id_seq
554 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
557 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
561 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
564 CREATE TABLE public.current_way_nodes (
565 way_id bigint NOT NULL,
566 node_id bigint NOT NULL,
567 sequence_id bigint NOT NULL
572 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
575 CREATE TABLE public.current_way_tags (
576 way_id bigint NOT NULL,
577 k character varying DEFAULT ''::character varying NOT NULL,
578 v character varying DEFAULT ''::character varying NOT NULL
583 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
586 CREATE TABLE public.current_ways (
588 changeset_id bigint NOT NULL,
589 "timestamp" timestamp without time zone NOT NULL,
590 visible boolean NOT NULL,
591 version bigint NOT NULL
596 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
599 CREATE SEQUENCE public.current_ways_id_seq
608 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
611 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
615 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
618 CREATE TABLE public.delayed_jobs (
620 priority integer DEFAULT 0 NOT NULL,
621 attempts integer DEFAULT 0 NOT NULL,
622 handler text NOT NULL,
624 run_at timestamp without time zone,
625 locked_at timestamp without time zone,
626 failed_at timestamp without time zone,
627 locked_by character varying,
628 queue character varying,
629 created_at timestamp without time zone,
630 updated_at timestamp without time zone
635 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
638 CREATE SEQUENCE public.delayed_jobs_id_seq
647 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
650 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
654 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
657 CREATE TABLE public.diary_comments (
659 diary_entry_id bigint NOT NULL,
660 user_id bigint NOT NULL,
662 created_at timestamp without time zone NOT NULL,
663 updated_at timestamp without time zone NOT NULL,
664 visible boolean DEFAULT true NOT NULL,
665 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
670 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
673 CREATE SEQUENCE public.diary_comments_id_seq
682 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
685 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
689 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
692 CREATE TABLE public.diary_entries (
694 user_id bigint NOT NULL,
695 title character varying NOT NULL,
697 created_at timestamp without time zone NOT NULL,
698 updated_at timestamp without time zone NOT NULL,
699 latitude double precision,
700 longitude double precision,
701 language_code character varying DEFAULT 'en'::character varying NOT NULL,
702 visible boolean DEFAULT true NOT NULL,
703 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
708 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
711 CREATE SEQUENCE public.diary_entries_id_seq
720 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
723 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
727 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
730 CREATE TABLE public.diary_entry_subscriptions (
731 user_id bigint NOT NULL,
732 diary_entry_id bigint NOT NULL
737 -- Name: friends; Type: TABLE; Schema: public; Owner: -
740 CREATE TABLE public.friends (
742 user_id bigint NOT NULL,
743 friend_user_id bigint NOT NULL,
744 created_at timestamp without time zone
749 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
752 CREATE SEQUENCE public.friends_id_seq
761 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
764 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
768 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
771 CREATE TABLE public.gps_points (
772 altitude double precision,
773 trackid integer NOT NULL,
774 latitude integer NOT NULL,
775 longitude integer NOT NULL,
776 gpx_id bigint NOT NULL,
777 "timestamp" timestamp without time zone,
783 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
786 CREATE TABLE public.gpx_file_tags (
787 gpx_id bigint DEFAULT 0 NOT NULL,
788 tag character varying NOT NULL,
794 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
797 CREATE SEQUENCE public.gpx_file_tags_id_seq
806 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
809 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
813 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
816 CREATE TABLE public.gpx_files (
818 user_id bigint NOT NULL,
819 visible boolean DEFAULT true NOT NULL,
820 name character varying DEFAULT ''::character varying NOT NULL,
822 latitude double precision,
823 longitude double precision,
824 "timestamp" timestamp without time zone NOT NULL,
825 description character varying DEFAULT ''::character varying NOT NULL,
826 inserted boolean NOT NULL,
827 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
832 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
835 CREATE SEQUENCE public.gpx_files_id_seq
844 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
847 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
851 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
854 CREATE TABLE public.issue_comments (
856 issue_id integer NOT NULL,
857 user_id integer NOT NULL,
859 created_at timestamp without time zone NOT NULL,
860 updated_at timestamp without time zone NOT NULL
865 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
868 CREATE SEQUENCE public.issue_comments_id_seq
878 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
881 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
885 -- Name: issues; Type: TABLE; Schema: public; Owner: -
888 CREATE TABLE public.issues (
890 reportable_type character varying NOT NULL,
891 reportable_id integer NOT NULL,
892 reported_user_id integer,
893 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
894 assigned_role public.user_role_enum NOT NULL,
895 resolved_at timestamp without time zone,
898 reports_count integer DEFAULT 0,
899 created_at timestamp without time zone NOT NULL,
900 updated_at timestamp without time zone NOT NULL
905 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
908 CREATE SEQUENCE public.issues_id_seq
918 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
921 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
925 -- Name: languages; Type: TABLE; Schema: public; Owner: -
928 CREATE TABLE public.languages (
929 code character varying NOT NULL,
930 english_name character varying NOT NULL,
931 native_name character varying
936 -- Name: messages; Type: TABLE; Schema: public; Owner: -
939 CREATE TABLE public.messages (
941 from_user_id bigint NOT NULL,
942 title character varying NOT NULL,
944 sent_on timestamp without time zone NOT NULL,
945 message_read boolean DEFAULT false NOT NULL,
946 to_user_id bigint NOT NULL,
947 to_user_visible boolean DEFAULT true NOT NULL,
948 from_user_visible boolean DEFAULT true NOT NULL,
949 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
954 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
957 CREATE SEQUENCE public.messages_id_seq
966 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
969 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
973 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
976 CREATE TABLE public.node_tags (
977 node_id bigint NOT NULL,
978 version bigint NOT NULL,
979 k character varying DEFAULT ''::character varying NOT NULL,
980 v character varying DEFAULT ''::character varying NOT NULL
985 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
988 CREATE TABLE public.nodes (
989 node_id bigint NOT NULL,
990 latitude integer NOT NULL,
991 longitude integer NOT NULL,
992 changeset_id bigint NOT NULL,
993 visible boolean NOT NULL,
994 "timestamp" timestamp without time zone NOT NULL,
995 tile bigint NOT NULL,
996 version bigint NOT NULL,
1002 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
1005 CREATE TABLE public.note_comments (
1007 note_id bigint NOT NULL,
1008 visible boolean NOT NULL,
1009 created_at timestamp without time zone NOT NULL,
1013 event public.note_event_enum
1018 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1021 CREATE SEQUENCE public.note_comments_id_seq
1031 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1034 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
1038 -- Name: notes; Type: TABLE; Schema: public; Owner: -
1041 CREATE TABLE public.notes (
1043 latitude integer NOT NULL,
1044 longitude integer NOT NULL,
1045 tile bigint NOT NULL,
1046 updated_at timestamp without time zone NOT NULL,
1047 created_at timestamp without time zone NOT NULL,
1048 status public.note_status_enum NOT NULL,
1049 closed_at timestamp without time zone
1054 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1057 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 (
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
1100 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1103 ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id;
1107 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
1110 CREATE TABLE public.oauth_tokens (
1111 id integer NOT NULL,
1113 type character varying(20),
1114 client_application_id integer,
1115 token character varying(50),
1116 secret character varying(50),
1117 authorized_at timestamp without time zone,
1118 invalidated_at timestamp without time zone,
1119 created_at timestamp without time zone,
1120 updated_at timestamp without time zone,
1121 allow_read_prefs boolean DEFAULT false NOT NULL,
1122 allow_write_prefs boolean DEFAULT false NOT NULL,
1123 allow_write_diary boolean DEFAULT false NOT NULL,
1124 allow_write_api boolean DEFAULT false NOT NULL,
1125 allow_read_gpx boolean DEFAULT false NOT NULL,
1126 allow_write_gpx boolean DEFAULT false NOT NULL,
1127 callback_url character varying,
1128 verifier character varying(20),
1129 scope character varying,
1130 valid_to timestamp without time zone,
1131 allow_write_notes boolean DEFAULT false NOT NULL
1136 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1139 CREATE SEQUENCE public.oauth_tokens_id_seq
1149 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1152 ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
1156 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1159 CREATE TABLE public.redactions (
1160 id integer NOT NULL,
1161 title character varying,
1163 created_at timestamp without time zone,
1164 updated_at timestamp without time zone,
1165 user_id bigint NOT NULL,
1166 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1171 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1174 CREATE SEQUENCE public.redactions_id_seq
1184 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1187 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1191 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1194 CREATE TABLE public.relation_members (
1195 relation_id bigint DEFAULT 0 NOT NULL,
1196 member_type public.nwr_enum NOT NULL,
1197 member_id bigint NOT NULL,
1198 member_role character varying NOT NULL,
1199 version bigint DEFAULT 0 NOT NULL,
1200 sequence_id integer DEFAULT 0 NOT NULL
1205 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1208 CREATE TABLE public.relation_tags (
1209 relation_id bigint DEFAULT 0 NOT NULL,
1210 k character varying DEFAULT ''::character varying NOT NULL,
1211 v character varying DEFAULT ''::character varying NOT NULL,
1212 version bigint NOT NULL
1217 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1220 CREATE TABLE public.relations (
1221 relation_id bigint DEFAULT 0 NOT NULL,
1222 changeset_id bigint NOT NULL,
1223 "timestamp" timestamp without time zone NOT NULL,
1224 version bigint NOT NULL,
1225 visible boolean DEFAULT true NOT NULL,
1226 redaction_id integer
1231 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1234 CREATE TABLE public.reports (
1235 id integer NOT NULL,
1236 issue_id integer NOT NULL,
1237 user_id integer NOT NULL,
1238 details text NOT NULL,
1239 category character varying NOT NULL,
1240 created_at timestamp without time zone NOT NULL,
1241 updated_at timestamp without time zone NOT NULL
1246 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1249 CREATE SEQUENCE public.reports_id_seq
1259 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1262 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1266 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1269 CREATE TABLE public.schema_migrations (
1270 version character varying NOT NULL
1275 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1278 CREATE TABLE public.user_blocks (
1279 id integer NOT NULL,
1280 user_id bigint NOT NULL,
1281 creator_id bigint NOT NULL,
1282 reason text NOT NULL,
1283 ends_at timestamp without time zone NOT NULL,
1284 needs_view boolean DEFAULT false NOT NULL,
1286 created_at timestamp without time zone,
1287 updated_at timestamp without time zone,
1288 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1293 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1296 CREATE SEQUENCE public.user_blocks_id_seq
1306 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1309 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1313 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1316 CREATE TABLE public.user_preferences (
1317 user_id bigint NOT NULL,
1318 k character varying NOT NULL,
1319 v character varying NOT NULL
1324 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1327 CREATE TABLE public.user_roles (
1328 id integer NOT NULL,
1329 user_id bigint NOT NULL,
1330 role public.user_role_enum NOT NULL,
1331 created_at timestamp without time zone,
1332 updated_at timestamp without time zone,
1333 granter_id bigint NOT NULL
1338 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1341 CREATE SEQUENCE public.user_roles_id_seq
1351 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1354 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1358 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1361 CREATE TABLE public.user_tokens (
1363 user_id bigint NOT NULL,
1364 token character varying NOT NULL,
1365 expiry timestamp without time zone NOT NULL,
1371 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1374 CREATE SEQUENCE public.user_tokens_id_seq
1383 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1386 ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id;
1390 -- Name: users; Type: TABLE; Schema: public; Owner: -
1393 CREATE TABLE public.users (
1394 email character varying NOT NULL,
1396 pass_crypt character varying NOT NULL,
1397 creation_time timestamp without time zone NOT NULL,
1398 display_name character varying DEFAULT ''::character varying NOT NULL,
1399 data_public boolean DEFAULT false NOT NULL,
1400 description text DEFAULT ''::text NOT NULL,
1401 home_lat double precision,
1402 home_lon double precision,
1403 home_zoom smallint DEFAULT 3,
1404 pass_salt character varying,
1405 email_valid boolean DEFAULT false NOT NULL,
1406 new_email character varying,
1407 creation_ip character varying,
1408 languages character varying,
1409 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1410 terms_agreed timestamp without time zone,
1411 consider_pd boolean DEFAULT false NOT NULL,
1412 auth_uid character varying,
1413 preferred_editor character varying,
1414 terms_seen boolean DEFAULT false NOT NULL,
1415 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1416 changesets_count integer DEFAULT 0 NOT NULL,
1417 traces_count integer DEFAULT 0 NOT NULL,
1418 diary_entries_count integer DEFAULT 0 NOT NULL,
1419 image_use_gravatar boolean DEFAULT false NOT NULL,
1420 auth_provider character varying,
1422 tou_agreed timestamp without time zone
1427 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1430 CREATE SEQUENCE public.users_id_seq
1439 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1442 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1446 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1449 CREATE TABLE public.way_nodes (
1450 way_id bigint NOT NULL,
1451 node_id bigint NOT NULL,
1452 version bigint NOT NULL,
1453 sequence_id bigint NOT NULL
1458 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1461 CREATE TABLE public.way_tags (
1462 way_id bigint DEFAULT 0 NOT NULL,
1463 k character varying NOT NULL,
1464 v character varying NOT NULL,
1465 version bigint NOT NULL
1470 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1473 CREATE TABLE public.ways (
1474 way_id bigint DEFAULT 0 NOT NULL,
1475 changeset_id bigint NOT NULL,
1476 "timestamp" timestamp without time zone NOT NULL,
1477 version bigint NOT NULL,
1478 visible boolean DEFAULT true NOT NULL,
1479 redaction_id integer
1484 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1487 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1491 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1494 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1498 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1501 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1505 -- Name: active_storage_variant_records id; Type: DEFAULT; Schema: public; Owner: -
1508 ALTER TABLE ONLY public.active_storage_variant_records ALTER COLUMN id SET DEFAULT nextval('public.active_storage_variant_records_id_seq'::regclass);
1512 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1515 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1519 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1522 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1526 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1529 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1533 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1536 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1540 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1543 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1547 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1550 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1554 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1557 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1561 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1564 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1568 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1571 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1575 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1578 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1582 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1585 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1589 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1592 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1596 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1599 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1603 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1606 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1610 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1613 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1617 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1620 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1624 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1627 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1631 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1634 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1638 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1641 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1645 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1648 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1652 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1655 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1659 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1662 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1666 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1669 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1673 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1676 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1680 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1683 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1687 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1690 ALTER TABLE ONLY public.acls
1691 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1695 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1698 ALTER TABLE ONLY public.active_storage_attachments
1699 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1703 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1706 ALTER TABLE ONLY public.active_storage_blobs
1707 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1711 -- Name: active_storage_variant_records active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1714 ALTER TABLE ONLY public.active_storage_variant_records
1715 ADD CONSTRAINT active_storage_variant_records_pkey PRIMARY KEY (id);
1719 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1722 ALTER TABLE ONLY public.ar_internal_metadata
1723 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1727 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1730 ALTER TABLE ONLY public.changeset_comments
1731 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1735 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1738 ALTER TABLE ONLY public.changesets
1739 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1743 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1746 ALTER TABLE ONLY public.client_applications
1747 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1751 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1754 ALTER TABLE ONLY public.current_node_tags
1755 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1759 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1762 ALTER TABLE ONLY public.current_nodes
1763 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1767 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1770 ALTER TABLE ONLY public.current_relation_members
1771 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1775 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1778 ALTER TABLE ONLY public.current_relation_tags
1779 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1783 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1786 ALTER TABLE ONLY public.current_relations
1787 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1791 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1794 ALTER TABLE ONLY public.current_way_nodes
1795 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1799 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1802 ALTER TABLE ONLY public.current_way_tags
1803 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1807 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1810 ALTER TABLE ONLY public.current_ways
1811 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1815 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1818 ALTER TABLE ONLY public.delayed_jobs
1819 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1823 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1826 ALTER TABLE ONLY public.diary_comments
1827 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1831 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1834 ALTER TABLE ONLY public.diary_entries
1835 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1839 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1842 ALTER TABLE ONLY public.diary_entry_subscriptions
1843 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1847 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1850 ALTER TABLE ONLY public.friends
1851 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1855 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1858 ALTER TABLE ONLY public.gpx_file_tags
1859 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1863 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1866 ALTER TABLE ONLY public.gpx_files
1867 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1871 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1874 ALTER TABLE ONLY public.issue_comments
1875 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1879 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1882 ALTER TABLE ONLY public.issues
1883 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
1887 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1890 ALTER TABLE ONLY public.languages
1891 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1895 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1898 ALTER TABLE ONLY public.messages
1899 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1903 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1906 ALTER TABLE ONLY public.node_tags
1907 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1911 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1914 ALTER TABLE ONLY public.nodes
1915 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1919 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1922 ALTER TABLE ONLY public.note_comments
1923 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1927 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1930 ALTER TABLE ONLY public.notes
1931 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1935 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1938 ALTER TABLE ONLY public.oauth_nonces
1939 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1943 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1946 ALTER TABLE ONLY public.oauth_tokens
1947 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1951 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1954 ALTER TABLE ONLY public.redactions
1955 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1959 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1962 ALTER TABLE ONLY public.relation_members
1963 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1967 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1970 ALTER TABLE ONLY public.relation_tags
1971 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1975 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1978 ALTER TABLE ONLY public.relations
1979 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1983 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1986 ALTER TABLE ONLY public.reports
1987 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
1991 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1994 ALTER TABLE ONLY public.schema_migrations
1995 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
1999 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2002 ALTER TABLE ONLY public.user_blocks
2003 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
2007 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2010 ALTER TABLE ONLY public.user_preferences
2011 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
2015 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2018 ALTER TABLE ONLY public.user_roles
2019 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
2023 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2026 ALTER TABLE ONLY public.user_tokens
2027 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
2031 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2034 ALTER TABLE ONLY public.users
2035 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2039 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2042 ALTER TABLE ONLY public.way_nodes
2043 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2047 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2050 ALTER TABLE ONLY public.way_tags
2051 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2055 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2058 ALTER TABLE ONLY public.ways
2059 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2063 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2066 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2070 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
2073 CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id);
2077 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2080 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2084 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2087 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2091 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2094 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2098 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2101 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2105 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2108 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2112 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2115 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2119 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2122 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2126 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2129 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2133 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2136 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2140 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2143 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2147 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2150 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2154 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2157 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2161 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2164 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2168 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2171 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2175 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2178 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2182 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2185 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2189 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2192 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2196 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2199 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2203 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2206 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2210 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2213 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2217 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2220 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2224 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2227 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2231 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2234 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2238 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2241 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2245 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2248 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2252 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2255 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2259 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2262 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2266 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2269 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2273 -- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
2276 CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest);
2280 -- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2283 CREATE INDEX index_changeset_comments_on_changeset_id_and_created_at ON public.changeset_comments USING btree (changeset_id, created_at);
2287 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2290 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2294 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2297 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2301 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2304 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2308 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2311 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2315 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2318 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2322 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2325 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2329 -- Name: index_friends_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2332 CREATE INDEX index_friends_on_user_id_and_created_at ON public.friends USING btree (user_id, created_at);
2336 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2339 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2343 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2346 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2350 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2353 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2357 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2360 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2364 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2367 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2371 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2374 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2378 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2381 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2385 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2388 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2392 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2395 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2399 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2402 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2406 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2409 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2413 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2416 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2420 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2423 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2427 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2430 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2434 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2437 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2441 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2444 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2448 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2451 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2455 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2458 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2462 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2465 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2469 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2472 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2476 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2479 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2483 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2486 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2490 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2493 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2497 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2500 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2504 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2507 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2511 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2514 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2518 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2521 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2525 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2528 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2532 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2535 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2539 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2542 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2546 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2549 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2553 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2556 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2560 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2563 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2567 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2570 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2574 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2577 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2581 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2584 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2588 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2591 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2595 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2598 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2602 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2605 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2609 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2612 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2616 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2619 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2623 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2626 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2630 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2633 ALTER TABLE ONLY public.changeset_comments
2634 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2638 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2641 ALTER TABLE ONLY public.changeset_comments
2642 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2646 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2649 ALTER TABLE ONLY public.changeset_tags
2650 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2654 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2657 ALTER TABLE ONLY public.changesets_subscribers
2658 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2662 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2665 ALTER TABLE ONLY public.changesets_subscribers
2666 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2670 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2673 ALTER TABLE ONLY public.changesets
2674 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2678 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2681 ALTER TABLE ONLY public.client_applications
2682 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2686 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2689 ALTER TABLE ONLY public.current_node_tags
2690 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2694 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2697 ALTER TABLE ONLY public.current_nodes
2698 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2702 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2705 ALTER TABLE ONLY public.current_relation_members
2706 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2710 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2713 ALTER TABLE ONLY public.current_relation_tags
2714 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2718 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2721 ALTER TABLE ONLY public.current_relations
2722 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2726 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2729 ALTER TABLE ONLY public.current_way_nodes
2730 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2734 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2737 ALTER TABLE ONLY public.current_way_nodes
2738 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2742 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2745 ALTER TABLE ONLY public.current_way_tags
2746 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2750 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2753 ALTER TABLE ONLY public.current_ways
2754 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2758 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2761 ALTER TABLE ONLY public.diary_comments
2762 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2766 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2769 ALTER TABLE ONLY public.diary_comments
2770 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2774 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2777 ALTER TABLE ONLY public.diary_entries
2778 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
2782 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2785 ALTER TABLE ONLY public.diary_entries
2786 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2790 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2793 ALTER TABLE ONLY public.diary_entry_subscriptions
2794 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2798 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2801 ALTER TABLE ONLY public.diary_entry_subscriptions
2802 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2806 -- Name: active_storage_variant_records fk_rails_993965df05; Type: FK CONSTRAINT; Schema: public; Owner: -
2809 ALTER TABLE ONLY public.active_storage_variant_records
2810 ADD CONSTRAINT fk_rails_993965df05 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
2814 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
2817 ALTER TABLE ONLY public.active_storage_attachments
2818 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
2822 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2825 ALTER TABLE ONLY public.friends
2826 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
2830 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2833 ALTER TABLE ONLY public.friends
2834 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2838 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2841 ALTER TABLE ONLY public.gps_points
2842 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2846 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2849 ALTER TABLE ONLY public.gpx_file_tags
2850 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2854 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2857 ALTER TABLE ONLY public.gpx_files
2858 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2862 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2865 ALTER TABLE ONLY public.issue_comments
2866 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2870 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2873 ALTER TABLE ONLY public.issue_comments
2874 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2878 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2881 ALTER TABLE ONLY public.issues
2882 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
2886 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2889 ALTER TABLE ONLY public.issues
2890 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
2894 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2897 ALTER TABLE ONLY public.issues
2898 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
2902 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2905 ALTER TABLE ONLY public.messages
2906 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
2910 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2913 ALTER TABLE ONLY public.messages
2914 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
2918 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2921 ALTER TABLE ONLY public.node_tags
2922 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
2926 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2929 ALTER TABLE ONLY public.nodes
2930 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2934 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2937 ALTER TABLE ONLY public.nodes
2938 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2942 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2945 ALTER TABLE ONLY public.note_comments
2946 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2950 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2953 ALTER TABLE ONLY public.note_comments
2954 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
2958 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2961 ALTER TABLE ONLY public.oauth_tokens
2962 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
2966 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2969 ALTER TABLE ONLY public.oauth_tokens
2970 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2974 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2977 ALTER TABLE ONLY public.redactions
2978 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2982 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2985 ALTER TABLE ONLY public.relation_members
2986 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2990 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2993 ALTER TABLE ONLY public.relation_tags
2994 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2998 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3001 ALTER TABLE ONLY public.relations
3002 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3006 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3009 ALTER TABLE ONLY public.relations
3010 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3014 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3017 ALTER TABLE ONLY public.reports
3018 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3022 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3025 ALTER TABLE ONLY public.reports
3026 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3030 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3033 ALTER TABLE ONLY public.user_blocks
3034 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
3038 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3041 ALTER TABLE ONLY public.user_blocks
3042 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
3046 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3049 ALTER TABLE ONLY public.user_blocks
3050 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3054 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3057 ALTER TABLE ONLY public.user_preferences
3058 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3062 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3065 ALTER TABLE ONLY public.user_roles
3066 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3070 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3073 ALTER TABLE ONLY public.user_roles
3074 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3078 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3081 ALTER TABLE ONLY public.user_tokens
3082 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3086 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3089 ALTER TABLE ONLY public.way_nodes
3090 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3094 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3097 ALTER TABLE ONLY public.way_tags
3098 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3102 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3105 ALTER TABLE ONLY public.ways
3106 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3110 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3113 ALTER TABLE ONLY public.ways
3114 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3118 -- PostgreSQL database dump complete
3121 SET search_path TO "$user", public;
3123 INSERT INTO "schema_migrations" (version) VALUES