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
150 SET default_tablespace = '';
152 SET default_table_access_method = heap;
155 -- Name: acls; Type: TABLE; Schema: public; Owner: -
158 CREATE TABLE public.acls (
161 k character varying NOT NULL,
163 domain character varying,
169 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
172 CREATE SEQUENCE public.acls_id_seq
181 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
184 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
188 -- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
191 CREATE TABLE public.active_storage_attachments (
193 name character varying NOT NULL,
194 record_type character varying NOT NULL,
195 record_id bigint NOT NULL,
196 blob_id bigint NOT NULL,
197 created_at timestamp without time zone NOT NULL
202 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
205 CREATE SEQUENCE public.active_storage_attachments_id_seq
214 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
217 ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
221 -- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
224 CREATE TABLE public.active_storage_blobs (
226 key character varying NOT NULL,
227 filename character varying NOT NULL,
228 content_type character varying,
230 byte_size bigint NOT NULL,
231 checksum character varying NOT NULL,
232 created_at timestamp without time zone NOT NULL,
233 service_name character varying NOT NULL
238 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
241 CREATE SEQUENCE public.active_storage_blobs_id_seq
250 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
253 ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
257 -- Name: active_storage_variant_records; Type: TABLE; Schema: public; Owner: -
260 CREATE TABLE public.active_storage_variant_records (
262 blob_id bigint NOT NULL,
263 variation_digest character varying NOT NULL
268 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE; Schema: public; Owner: -
271 CREATE SEQUENCE public.active_storage_variant_records_id_seq
280 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
283 ALTER SEQUENCE public.active_storage_variant_records_id_seq OWNED BY public.active_storage_variant_records.id;
287 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
290 CREATE TABLE public.ar_internal_metadata (
291 key character varying NOT NULL,
292 value character varying,
293 created_at timestamp(6) without time zone NOT NULL,
294 updated_at timestamp(6) without time zone NOT NULL
299 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
302 CREATE TABLE public.changeset_comments (
304 changeset_id bigint NOT NULL,
305 author_id bigint NOT NULL,
307 created_at timestamp without time zone NOT NULL,
308 visible boolean NOT NULL
313 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
316 CREATE SEQUENCE public.changeset_comments_id_seq
326 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
329 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
333 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
336 CREATE TABLE public.changeset_tags (
337 changeset_id bigint NOT NULL,
338 k character varying DEFAULT ''::character varying NOT NULL,
339 v character varying DEFAULT ''::character varying NOT NULL
344 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
347 CREATE TABLE public.changesets (
349 user_id bigint NOT NULL,
350 created_at timestamp without time zone NOT NULL,
355 closed_at timestamp without time zone NOT NULL,
356 num_changes integer DEFAULT 0 NOT NULL
361 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
364 CREATE SEQUENCE public.changesets_id_seq
373 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
376 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
380 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
383 CREATE TABLE public.changesets_subscribers (
384 subscriber_id bigint NOT NULL,
385 changeset_id bigint NOT NULL
390 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
393 CREATE TABLE public.client_applications (
395 name character varying,
396 url character varying,
397 support_url character varying,
398 callback_url character varying,
399 key character varying(50),
400 secret character varying(50),
402 created_at timestamp without time zone,
403 updated_at timestamp without time zone,
404 allow_read_prefs boolean DEFAULT false NOT NULL,
405 allow_write_prefs boolean DEFAULT false NOT NULL,
406 allow_write_diary boolean DEFAULT false NOT NULL,
407 allow_write_api boolean DEFAULT false NOT NULL,
408 allow_read_gpx boolean DEFAULT false NOT NULL,
409 allow_write_gpx boolean DEFAULT false NOT NULL,
410 allow_write_notes boolean DEFAULT false NOT NULL
415 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
418 CREATE SEQUENCE public.client_applications_id_seq
428 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
431 ALTER SEQUENCE public.client_applications_id_seq OWNED BY public.client_applications.id;
435 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
438 CREATE TABLE public.current_node_tags (
439 node_id bigint NOT NULL,
440 k character varying DEFAULT ''::character varying NOT NULL,
441 v character varying DEFAULT ''::character varying NOT NULL
446 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
449 CREATE TABLE public.current_nodes (
451 latitude integer NOT NULL,
452 longitude integer NOT NULL,
453 changeset_id bigint NOT NULL,
454 visible boolean NOT NULL,
455 "timestamp" timestamp without time zone NOT NULL,
456 tile bigint NOT NULL,
457 version bigint NOT NULL
462 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
465 CREATE SEQUENCE public.current_nodes_id_seq
474 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
477 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
481 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
484 CREATE TABLE public.current_relation_members (
485 relation_id bigint NOT NULL,
486 member_type public.nwr_enum NOT NULL,
487 member_id bigint NOT NULL,
488 member_role character varying NOT NULL,
489 sequence_id integer DEFAULT 0 NOT NULL
494 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
497 CREATE TABLE public.current_relation_tags (
498 relation_id bigint NOT NULL,
499 k character varying DEFAULT ''::character varying NOT NULL,
500 v character varying DEFAULT ''::character varying NOT NULL
505 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
508 CREATE TABLE public.current_relations (
510 changeset_id bigint NOT NULL,
511 "timestamp" timestamp without time zone NOT NULL,
512 visible boolean NOT NULL,
513 version bigint NOT NULL
518 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
521 CREATE SEQUENCE public.current_relations_id_seq
530 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
533 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
537 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
540 CREATE TABLE public.current_way_nodes (
541 way_id bigint NOT NULL,
542 node_id bigint NOT NULL,
543 sequence_id bigint NOT NULL
548 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
551 CREATE TABLE public.current_way_tags (
552 way_id bigint NOT NULL,
553 k character varying DEFAULT ''::character varying NOT NULL,
554 v character varying DEFAULT ''::character varying NOT NULL
559 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
562 CREATE TABLE public.current_ways (
564 changeset_id bigint NOT NULL,
565 "timestamp" timestamp without time zone NOT NULL,
566 visible boolean NOT NULL,
567 version bigint NOT NULL
572 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
575 CREATE SEQUENCE public.current_ways_id_seq
584 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
587 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
591 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
594 CREATE TABLE public.delayed_jobs (
596 priority integer DEFAULT 0 NOT NULL,
597 attempts integer DEFAULT 0 NOT NULL,
598 handler text NOT NULL,
600 run_at timestamp without time zone,
601 locked_at timestamp without time zone,
602 failed_at timestamp without time zone,
603 locked_by character varying,
604 queue character varying,
605 created_at timestamp without time zone,
606 updated_at timestamp without time zone
611 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
614 CREATE SEQUENCE public.delayed_jobs_id_seq
623 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
626 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
630 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
633 CREATE TABLE public.diary_comments (
635 diary_entry_id bigint NOT NULL,
636 user_id bigint NOT NULL,
638 created_at timestamp without time zone NOT NULL,
639 updated_at timestamp without time zone NOT NULL,
640 visible boolean DEFAULT true NOT NULL,
641 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
646 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
649 CREATE SEQUENCE public.diary_comments_id_seq
658 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
661 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
665 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
668 CREATE TABLE public.diary_entries (
670 user_id bigint NOT NULL,
671 title character varying NOT NULL,
673 created_at timestamp without time zone NOT NULL,
674 updated_at timestamp without time zone NOT NULL,
675 latitude double precision,
676 longitude double precision,
677 language_code character varying DEFAULT 'en'::character varying NOT NULL,
678 visible boolean DEFAULT true NOT NULL,
679 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
684 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
687 CREATE SEQUENCE public.diary_entries_id_seq
696 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
699 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
703 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
706 CREATE TABLE public.diary_entry_subscriptions (
707 user_id bigint NOT NULL,
708 diary_entry_id bigint NOT NULL
713 -- Name: friends; Type: TABLE; Schema: public; Owner: -
716 CREATE TABLE public.friends (
718 user_id bigint NOT NULL,
719 friend_user_id bigint NOT NULL,
720 created_at timestamp without time zone
725 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
728 CREATE SEQUENCE public.friends_id_seq
737 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
740 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
744 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
747 CREATE TABLE public.gps_points (
748 altitude double precision,
749 trackid integer NOT NULL,
750 latitude integer NOT NULL,
751 longitude integer NOT NULL,
752 gpx_id bigint NOT NULL,
753 "timestamp" timestamp without time zone,
759 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
762 CREATE TABLE public.gpx_file_tags (
763 gpx_id bigint DEFAULT 0 NOT NULL,
764 tag character varying NOT NULL,
770 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
773 CREATE SEQUENCE public.gpx_file_tags_id_seq
782 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
785 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
789 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
792 CREATE TABLE public.gpx_files (
794 user_id bigint NOT NULL,
795 visible boolean DEFAULT true NOT NULL,
796 name character varying DEFAULT ''::character varying NOT NULL,
798 latitude double precision,
799 longitude double precision,
800 "timestamp" timestamp without time zone NOT NULL,
801 description character varying DEFAULT ''::character varying NOT NULL,
802 inserted boolean NOT NULL,
803 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
808 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
811 CREATE SEQUENCE public.gpx_files_id_seq
820 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
823 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
827 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
830 CREATE TABLE public.issue_comments (
832 issue_id integer NOT NULL,
833 user_id integer NOT NULL,
835 created_at timestamp without time zone NOT NULL,
836 updated_at timestamp without time zone NOT NULL
841 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
844 CREATE SEQUENCE public.issue_comments_id_seq
854 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
857 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
861 -- Name: issues; Type: TABLE; Schema: public; Owner: -
864 CREATE TABLE public.issues (
866 reportable_type character varying NOT NULL,
867 reportable_id integer NOT NULL,
868 reported_user_id integer,
869 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
870 assigned_role public.user_role_enum NOT NULL,
871 resolved_at timestamp without time zone,
874 reports_count integer DEFAULT 0,
875 created_at timestamp without time zone NOT NULL,
876 updated_at timestamp without time zone NOT NULL
881 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
884 CREATE SEQUENCE public.issues_id_seq
894 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
897 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
901 -- Name: languages; Type: TABLE; Schema: public; Owner: -
904 CREATE TABLE public.languages (
905 code character varying NOT NULL,
906 english_name character varying NOT NULL,
907 native_name character varying
912 -- Name: messages; Type: TABLE; Schema: public; Owner: -
915 CREATE TABLE public.messages (
917 from_user_id bigint NOT NULL,
918 title character varying NOT NULL,
920 sent_on timestamp without time zone NOT NULL,
921 message_read boolean DEFAULT false NOT NULL,
922 to_user_id bigint NOT NULL,
923 to_user_visible boolean DEFAULT true NOT NULL,
924 from_user_visible boolean DEFAULT true NOT NULL,
925 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
930 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
933 CREATE SEQUENCE public.messages_id_seq
942 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
945 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
949 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
952 CREATE TABLE public.node_tags (
953 node_id bigint NOT NULL,
954 version bigint NOT NULL,
955 k character varying DEFAULT ''::character varying NOT NULL,
956 v character varying DEFAULT ''::character varying NOT NULL
961 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
964 CREATE TABLE public.nodes (
965 node_id bigint NOT NULL,
966 latitude integer NOT NULL,
967 longitude integer NOT NULL,
968 changeset_id bigint NOT NULL,
969 visible boolean NOT NULL,
970 "timestamp" timestamp without time zone NOT NULL,
971 tile bigint NOT NULL,
972 version bigint NOT NULL,
978 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
981 CREATE TABLE public.note_comments (
983 note_id bigint NOT NULL,
984 visible boolean NOT NULL,
985 created_at timestamp without time zone NOT NULL,
989 event public.note_event_enum
994 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
997 CREATE SEQUENCE public.note_comments_id_seq
1007 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1010 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
1014 -- Name: notes; Type: TABLE; Schema: public; Owner: -
1017 CREATE TABLE public.notes (
1019 latitude integer NOT NULL,
1020 longitude integer NOT NULL,
1021 tile bigint NOT NULL,
1022 updated_at timestamp without time zone NOT NULL,
1023 created_at timestamp without time zone NOT NULL,
1024 status public.note_status_enum NOT NULL,
1025 closed_at timestamp without time zone
1030 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1033 CREATE SEQUENCE public.notes_id_seq
1043 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1046 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
1050 -- Name: oauth_access_grants; Type: TABLE; Schema: public; Owner: -
1053 CREATE TABLE public.oauth_access_grants (
1055 resource_owner_id bigint NOT NULL,
1056 application_id bigint NOT NULL,
1057 token character varying NOT NULL,
1058 expires_in integer NOT NULL,
1059 redirect_uri text NOT NULL,
1060 created_at timestamp without time zone NOT NULL,
1061 revoked_at timestamp without time zone,
1062 scopes character varying DEFAULT ''::character varying NOT NULL,
1063 code_challenge character varying,
1064 code_challenge_method character varying
1069 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1072 CREATE SEQUENCE public.oauth_access_grants_id_seq
1081 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1084 ALTER SEQUENCE public.oauth_access_grants_id_seq OWNED BY public.oauth_access_grants.id;
1088 -- Name: oauth_access_tokens; Type: TABLE; Schema: public; Owner: -
1091 CREATE TABLE public.oauth_access_tokens (
1093 resource_owner_id bigint,
1094 application_id bigint NOT NULL,
1095 token character varying NOT NULL,
1096 refresh_token character varying,
1098 revoked_at timestamp without time zone,
1099 created_at timestamp without time zone NOT NULL,
1100 scopes character varying,
1101 previous_refresh_token character varying DEFAULT ''::character varying NOT NULL
1106 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1109 CREATE SEQUENCE public.oauth_access_tokens_id_seq
1118 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1121 ALTER SEQUENCE public.oauth_access_tokens_id_seq OWNED BY public.oauth_access_tokens.id;
1125 -- Name: oauth_applications; Type: TABLE; Schema: public; Owner: -
1128 CREATE TABLE public.oauth_applications (
1130 owner_type character varying NOT NULL,
1131 owner_id bigint NOT NULL,
1132 name character varying NOT NULL,
1133 uid character varying NOT NULL,
1134 secret character varying NOT NULL,
1135 redirect_uri text NOT NULL,
1136 scopes character varying DEFAULT ''::character varying NOT NULL,
1137 confidential boolean DEFAULT true NOT NULL,
1138 created_at timestamp(6) without time zone NOT NULL,
1139 updated_at timestamp(6) without time zone NOT NULL
1144 -- Name: oauth_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1147 CREATE SEQUENCE public.oauth_applications_id_seq
1156 -- Name: oauth_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1159 ALTER SEQUENCE public.oauth_applications_id_seq OWNED BY public.oauth_applications.id;
1163 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
1166 CREATE TABLE public.oauth_nonces (
1168 nonce character varying,
1169 "timestamp" integer,
1170 created_at timestamp without time zone,
1171 updated_at timestamp without time zone
1176 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1179 CREATE SEQUENCE public.oauth_nonces_id_seq
1189 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1192 ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id;
1196 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
1199 CREATE TABLE public.oauth_tokens (
1200 id integer NOT NULL,
1202 type character varying(20),
1203 client_application_id integer,
1204 token character varying(50),
1205 secret character varying(50),
1206 authorized_at timestamp without time zone,
1207 invalidated_at timestamp without time zone,
1208 created_at timestamp without time zone,
1209 updated_at timestamp without time zone,
1210 allow_read_prefs boolean DEFAULT false NOT NULL,
1211 allow_write_prefs boolean DEFAULT false NOT NULL,
1212 allow_write_diary boolean DEFAULT false NOT NULL,
1213 allow_write_api boolean DEFAULT false NOT NULL,
1214 allow_read_gpx boolean DEFAULT false NOT NULL,
1215 allow_write_gpx boolean DEFAULT false NOT NULL,
1216 callback_url character varying,
1217 verifier character varying(20),
1218 scope character varying,
1219 valid_to timestamp without time zone,
1220 allow_write_notes boolean DEFAULT false NOT NULL
1225 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1228 CREATE SEQUENCE public.oauth_tokens_id_seq
1238 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1241 ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
1245 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1248 CREATE TABLE public.redactions (
1249 id integer NOT NULL,
1250 title character varying,
1252 created_at timestamp without time zone,
1253 updated_at timestamp without time zone,
1254 user_id bigint NOT NULL,
1255 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1260 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1263 CREATE SEQUENCE public.redactions_id_seq
1273 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1276 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1280 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1283 CREATE TABLE public.relation_members (
1284 relation_id bigint DEFAULT 0 NOT NULL,
1285 member_type public.nwr_enum NOT NULL,
1286 member_id bigint NOT NULL,
1287 member_role character varying NOT NULL,
1288 version bigint DEFAULT 0 NOT NULL,
1289 sequence_id integer DEFAULT 0 NOT NULL
1294 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1297 CREATE TABLE public.relation_tags (
1298 relation_id bigint DEFAULT 0 NOT NULL,
1299 k character varying DEFAULT ''::character varying NOT NULL,
1300 v character varying DEFAULT ''::character varying NOT NULL,
1301 version bigint NOT NULL
1306 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1309 CREATE TABLE public.relations (
1310 relation_id bigint DEFAULT 0 NOT NULL,
1311 changeset_id bigint NOT NULL,
1312 "timestamp" timestamp without time zone NOT NULL,
1313 version bigint NOT NULL,
1314 visible boolean DEFAULT true NOT NULL,
1315 redaction_id integer
1320 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1323 CREATE TABLE public.reports (
1324 id integer NOT NULL,
1325 issue_id integer NOT NULL,
1326 user_id integer NOT NULL,
1327 details text NOT NULL,
1328 category character varying NOT NULL,
1329 created_at timestamp without time zone NOT NULL,
1330 updated_at timestamp without time zone NOT NULL
1335 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1338 CREATE SEQUENCE public.reports_id_seq
1348 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1351 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1355 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1358 CREATE TABLE public.schema_migrations (
1359 version character varying NOT NULL
1364 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1367 CREATE TABLE public.user_blocks (
1368 id integer NOT NULL,
1369 user_id bigint NOT NULL,
1370 creator_id bigint NOT NULL,
1371 reason text NOT NULL,
1372 ends_at timestamp without time zone NOT NULL,
1373 needs_view boolean DEFAULT false NOT NULL,
1375 created_at timestamp without time zone,
1376 updated_at timestamp without time zone,
1377 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1382 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1385 CREATE SEQUENCE public.user_blocks_id_seq
1395 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1398 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1402 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1405 CREATE TABLE public.user_preferences (
1406 user_id bigint NOT NULL,
1407 k character varying NOT NULL,
1408 v character varying NOT NULL
1413 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1416 CREATE TABLE public.user_roles (
1417 id integer NOT NULL,
1418 user_id bigint NOT NULL,
1419 role public.user_role_enum NOT NULL,
1420 created_at timestamp without time zone,
1421 updated_at timestamp without time zone,
1422 granter_id bigint NOT NULL
1427 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1430 CREATE SEQUENCE public.user_roles_id_seq
1440 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1443 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1447 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1450 CREATE TABLE public.user_tokens (
1452 user_id bigint NOT NULL,
1453 token character varying NOT NULL,
1454 expiry timestamp without time zone NOT NULL,
1460 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1463 CREATE SEQUENCE public.user_tokens_id_seq
1472 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1475 ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id;
1479 -- Name: users; Type: TABLE; Schema: public; Owner: -
1482 CREATE TABLE public.users (
1483 email character varying NOT NULL,
1485 pass_crypt character varying NOT NULL,
1486 creation_time timestamp without time zone NOT NULL,
1487 display_name character varying DEFAULT ''::character varying NOT NULL,
1488 data_public boolean DEFAULT false NOT NULL,
1489 description text DEFAULT ''::text NOT NULL,
1490 home_lat double precision,
1491 home_lon double precision,
1492 home_zoom smallint DEFAULT 3,
1493 pass_salt character varying,
1494 email_valid boolean DEFAULT false NOT NULL,
1495 new_email character varying,
1496 creation_ip character varying,
1497 languages character varying,
1498 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1499 terms_agreed timestamp without time zone,
1500 consider_pd boolean DEFAULT false NOT NULL,
1501 auth_uid character varying,
1502 preferred_editor character varying,
1503 terms_seen boolean DEFAULT false NOT NULL,
1504 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1505 changesets_count integer DEFAULT 0 NOT NULL,
1506 traces_count integer DEFAULT 0 NOT NULL,
1507 diary_entries_count integer DEFAULT 0 NOT NULL,
1508 image_use_gravatar boolean DEFAULT false NOT NULL,
1509 auth_provider character varying,
1511 tou_agreed timestamp without time zone
1516 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1519 CREATE SEQUENCE public.users_id_seq
1528 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1531 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1535 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1538 CREATE TABLE public.way_nodes (
1539 way_id bigint NOT NULL,
1540 node_id bigint NOT NULL,
1541 version bigint NOT NULL,
1542 sequence_id bigint NOT NULL
1547 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1550 CREATE TABLE public.way_tags (
1551 way_id bigint DEFAULT 0 NOT NULL,
1552 k character varying NOT NULL,
1553 v character varying NOT NULL,
1554 version bigint NOT NULL
1559 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1562 CREATE TABLE public.ways (
1563 way_id bigint DEFAULT 0 NOT NULL,
1564 changeset_id bigint NOT NULL,
1565 "timestamp" timestamp without time zone NOT NULL,
1566 version bigint NOT NULL,
1567 visible boolean DEFAULT true NOT NULL,
1568 redaction_id integer
1573 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1576 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1580 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1583 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1587 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1590 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1594 -- Name: active_storage_variant_records id; Type: DEFAULT; Schema: public; Owner: -
1597 ALTER TABLE ONLY public.active_storage_variant_records ALTER COLUMN id SET DEFAULT nextval('public.active_storage_variant_records_id_seq'::regclass);
1601 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1604 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1608 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1611 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1615 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1618 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1622 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1625 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1629 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1632 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1636 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1639 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1643 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1646 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1650 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1653 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1657 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1660 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1664 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1667 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1671 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1674 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1678 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1681 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1685 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1688 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1692 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1695 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1699 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1702 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1706 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1709 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1713 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1716 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1720 -- Name: oauth_access_grants id; Type: DEFAULT; Schema: public; Owner: -
1723 ALTER TABLE ONLY public.oauth_access_grants ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_grants_id_seq'::regclass);
1727 -- Name: oauth_access_tokens id; Type: DEFAULT; Schema: public; Owner: -
1730 ALTER TABLE ONLY public.oauth_access_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_tokens_id_seq'::regclass);
1734 -- Name: oauth_applications id; Type: DEFAULT; Schema: public; Owner: -
1737 ALTER TABLE ONLY public.oauth_applications ALTER COLUMN id SET DEFAULT nextval('public.oauth_applications_id_seq'::regclass);
1741 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1744 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1748 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1751 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1755 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1758 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1762 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1765 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1769 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1772 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1776 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1779 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1783 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1786 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1790 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1793 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1797 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1800 ALTER TABLE ONLY public.acls
1801 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1805 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1808 ALTER TABLE ONLY public.active_storage_attachments
1809 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1813 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1816 ALTER TABLE ONLY public.active_storage_blobs
1817 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1821 -- Name: active_storage_variant_records active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1824 ALTER TABLE ONLY public.active_storage_variant_records
1825 ADD CONSTRAINT active_storage_variant_records_pkey PRIMARY KEY (id);
1829 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1832 ALTER TABLE ONLY public.ar_internal_metadata
1833 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1837 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1840 ALTER TABLE ONLY public.changeset_comments
1841 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1845 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1848 ALTER TABLE ONLY public.changesets
1849 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1853 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1856 ALTER TABLE ONLY public.client_applications
1857 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1861 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1864 ALTER TABLE ONLY public.current_node_tags
1865 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1869 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1872 ALTER TABLE ONLY public.current_nodes
1873 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1877 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1880 ALTER TABLE ONLY public.current_relation_members
1881 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1885 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1888 ALTER TABLE ONLY public.current_relation_tags
1889 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1893 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1896 ALTER TABLE ONLY public.current_relations
1897 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1901 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1904 ALTER TABLE ONLY public.current_way_nodes
1905 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1909 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1912 ALTER TABLE ONLY public.current_way_tags
1913 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1917 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1920 ALTER TABLE ONLY public.current_ways
1921 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1925 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1928 ALTER TABLE ONLY public.delayed_jobs
1929 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1933 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1936 ALTER TABLE ONLY public.diary_comments
1937 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1941 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1944 ALTER TABLE ONLY public.diary_entries
1945 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1949 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1952 ALTER TABLE ONLY public.diary_entry_subscriptions
1953 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1957 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1960 ALTER TABLE ONLY public.friends
1961 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1965 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1968 ALTER TABLE ONLY public.gpx_file_tags
1969 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1973 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1976 ALTER TABLE ONLY public.gpx_files
1977 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1981 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1984 ALTER TABLE ONLY public.issue_comments
1985 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1989 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1992 ALTER TABLE ONLY public.issues
1993 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
1997 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2000 ALTER TABLE ONLY public.languages
2001 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
2005 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2008 ALTER TABLE ONLY public.messages
2009 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
2013 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2016 ALTER TABLE ONLY public.node_tags
2017 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
2021 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2024 ALTER TABLE ONLY public.nodes
2025 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
2029 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2032 ALTER TABLE ONLY public.note_comments
2033 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
2037 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2040 ALTER TABLE ONLY public.notes
2041 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
2045 -- Name: oauth_access_grants oauth_access_grants_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2048 ALTER TABLE ONLY public.oauth_access_grants
2049 ADD CONSTRAINT oauth_access_grants_pkey PRIMARY KEY (id);
2053 -- Name: oauth_access_tokens oauth_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2056 ALTER TABLE ONLY public.oauth_access_tokens
2057 ADD CONSTRAINT oauth_access_tokens_pkey PRIMARY KEY (id);
2061 -- Name: oauth_applications oauth_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2064 ALTER TABLE ONLY public.oauth_applications
2065 ADD CONSTRAINT oauth_applications_pkey PRIMARY KEY (id);
2069 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2072 ALTER TABLE ONLY public.oauth_nonces
2073 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
2077 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2080 ALTER TABLE ONLY public.oauth_tokens
2081 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
2085 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2088 ALTER TABLE ONLY public.redactions
2089 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
2093 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2096 ALTER TABLE ONLY public.relation_members
2097 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
2101 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2104 ALTER TABLE ONLY public.relation_tags
2105 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
2109 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2112 ALTER TABLE ONLY public.relations
2113 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
2117 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2120 ALTER TABLE ONLY public.reports
2121 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
2125 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2128 ALTER TABLE ONLY public.schema_migrations
2129 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
2133 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2136 ALTER TABLE ONLY public.user_blocks
2137 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
2141 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2144 ALTER TABLE ONLY public.user_preferences
2145 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
2149 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2152 ALTER TABLE ONLY public.user_roles
2153 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
2157 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2160 ALTER TABLE ONLY public.user_tokens
2161 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
2165 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2168 ALTER TABLE ONLY public.users
2169 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2173 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2176 ALTER TABLE ONLY public.way_nodes
2177 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2181 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2184 ALTER TABLE ONLY public.way_tags
2185 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2189 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2192 ALTER TABLE ONLY public.ways
2193 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2197 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2200 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2204 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
2207 CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id);
2211 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2214 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2218 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2221 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2225 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2228 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2232 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2235 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2239 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2242 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2246 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2249 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2253 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2256 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2260 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2263 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2267 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2270 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2274 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2277 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2281 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2284 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2288 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2291 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2295 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2298 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2302 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2305 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2309 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2312 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2316 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2319 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2323 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2326 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2330 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2333 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2337 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2340 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2344 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2347 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2351 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2354 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2358 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2361 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2365 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2368 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2372 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2375 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2379 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2382 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2386 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2389 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2393 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2396 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2400 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2403 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2407 -- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
2410 CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest);
2414 -- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2417 CREATE INDEX index_changeset_comments_on_changeset_id_and_created_at ON public.changeset_comments USING btree (changeset_id, created_at);
2421 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2424 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2428 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2431 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2435 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2438 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2442 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2445 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2449 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2452 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2456 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2459 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2463 -- Name: index_friends_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2466 CREATE INDEX index_friends_on_user_id_and_created_at ON public.friends USING btree (user_id, created_at);
2470 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2473 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2477 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2480 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2484 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2487 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2491 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2494 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2498 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2501 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2505 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2508 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2512 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2515 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2519 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2522 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2526 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2529 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2533 -- Name: index_oauth_access_grants_on_application_id; Type: INDEX; Schema: public; Owner: -
2536 CREATE INDEX index_oauth_access_grants_on_application_id ON public.oauth_access_grants USING btree (application_id);
2540 -- Name: index_oauth_access_grants_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2543 CREATE INDEX index_oauth_access_grants_on_resource_owner_id ON public.oauth_access_grants USING btree (resource_owner_id);
2547 -- Name: index_oauth_access_grants_on_token; Type: INDEX; Schema: public; Owner: -
2550 CREATE UNIQUE INDEX index_oauth_access_grants_on_token ON public.oauth_access_grants USING btree (token);
2554 -- Name: index_oauth_access_tokens_on_application_id; Type: INDEX; Schema: public; Owner: -
2557 CREATE INDEX index_oauth_access_tokens_on_application_id ON public.oauth_access_tokens USING btree (application_id);
2561 -- Name: index_oauth_access_tokens_on_refresh_token; Type: INDEX; Schema: public; Owner: -
2564 CREATE UNIQUE INDEX index_oauth_access_tokens_on_refresh_token ON public.oauth_access_tokens USING btree (refresh_token);
2568 -- Name: index_oauth_access_tokens_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2571 CREATE INDEX index_oauth_access_tokens_on_resource_owner_id ON public.oauth_access_tokens USING btree (resource_owner_id);
2575 -- Name: index_oauth_access_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2578 CREATE UNIQUE INDEX index_oauth_access_tokens_on_token ON public.oauth_access_tokens USING btree (token);
2582 -- Name: index_oauth_applications_on_owner_type_and_owner_id; Type: INDEX; Schema: public; Owner: -
2585 CREATE INDEX index_oauth_applications_on_owner_type_and_owner_id ON public.oauth_applications USING btree (owner_type, owner_id);
2589 -- Name: index_oauth_applications_on_uid; Type: INDEX; Schema: public; Owner: -
2592 CREATE UNIQUE INDEX index_oauth_applications_on_uid ON public.oauth_applications USING btree (uid);
2596 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2599 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2603 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2606 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2610 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2613 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2617 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2620 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2624 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2627 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2631 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2634 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2638 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2641 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2645 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2648 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2652 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2655 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2659 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2662 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2666 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2669 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2673 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2676 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2680 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2683 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2687 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2690 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2694 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2697 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2701 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2704 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2708 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2711 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2715 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2718 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2722 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2725 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2729 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2732 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2736 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2739 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2743 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2746 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2750 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2753 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2757 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2760 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2764 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2767 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2771 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2774 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2778 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2781 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2785 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2788 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2792 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2795 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2799 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2802 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2806 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2809 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2813 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2816 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2820 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2823 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2827 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2830 ALTER TABLE ONLY public.changeset_comments
2831 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2835 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2838 ALTER TABLE ONLY public.changeset_comments
2839 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2843 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2846 ALTER TABLE ONLY public.changeset_tags
2847 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2851 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2854 ALTER TABLE ONLY public.changesets_subscribers
2855 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2859 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2862 ALTER TABLE ONLY public.changesets_subscribers
2863 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2867 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2870 ALTER TABLE ONLY public.changesets
2871 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2875 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2878 ALTER TABLE ONLY public.client_applications
2879 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2883 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2886 ALTER TABLE ONLY public.current_node_tags
2887 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2891 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2894 ALTER TABLE ONLY public.current_nodes
2895 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2899 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2902 ALTER TABLE ONLY public.current_relation_members
2903 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2907 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2910 ALTER TABLE ONLY public.current_relation_tags
2911 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2915 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2918 ALTER TABLE ONLY public.current_relations
2919 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2923 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2926 ALTER TABLE ONLY public.current_way_nodes
2927 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2931 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2934 ALTER TABLE ONLY public.current_way_nodes
2935 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2939 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2942 ALTER TABLE ONLY public.current_way_tags
2943 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2947 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2950 ALTER TABLE ONLY public.current_ways
2951 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2955 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2958 ALTER TABLE ONLY public.diary_comments
2959 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2963 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2966 ALTER TABLE ONLY public.diary_comments
2967 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2971 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2974 ALTER TABLE ONLY public.diary_entries
2975 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
2979 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2982 ALTER TABLE ONLY public.diary_entries
2983 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2987 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2990 ALTER TABLE ONLY public.diary_entry_subscriptions
2991 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2995 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2998 ALTER TABLE ONLY public.diary_entry_subscriptions
2999 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3003 -- Name: oauth_access_grants fk_rails_330c32d8d9; Type: FK CONSTRAINT; Schema: public; Owner: -
3006 ALTER TABLE ONLY public.oauth_access_grants
3007 ADD CONSTRAINT fk_rails_330c32d8d9 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3011 -- Name: oauth_access_tokens fk_rails_732cb83ab7; Type: FK CONSTRAINT; Schema: public; Owner: -
3014 ALTER TABLE ONLY public.oauth_access_tokens
3015 ADD CONSTRAINT fk_rails_732cb83ab7 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3019 -- Name: active_storage_variant_records fk_rails_993965df05; Type: FK CONSTRAINT; Schema: public; Owner: -
3022 ALTER TABLE ONLY public.active_storage_variant_records
3023 ADD CONSTRAINT fk_rails_993965df05 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3027 -- Name: oauth_access_grants fk_rails_b4b53e07b8; Type: FK CONSTRAINT; Schema: public; Owner: -
3030 ALTER TABLE ONLY public.oauth_access_grants
3031 ADD CONSTRAINT fk_rails_b4b53e07b8 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3035 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
3038 ALTER TABLE ONLY public.active_storage_attachments
3039 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3043 -- Name: oauth_applications fk_rails_cc886e315a; Type: FK CONSTRAINT; Schema: public; Owner: -
3046 ALTER TABLE ONLY public.oauth_applications
3047 ADD CONSTRAINT fk_rails_cc886e315a FOREIGN KEY (owner_id) REFERENCES public.users(id) NOT VALID;
3051 -- Name: oauth_access_tokens fk_rails_ee63f25419; Type: FK CONSTRAINT; Schema: public; Owner: -
3054 ALTER TABLE ONLY public.oauth_access_tokens
3055 ADD CONSTRAINT fk_rails_ee63f25419 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3059 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3062 ALTER TABLE ONLY public.friends
3063 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
3067 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3070 ALTER TABLE ONLY public.friends
3071 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3075 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3078 ALTER TABLE ONLY public.gps_points
3079 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3083 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3086 ALTER TABLE ONLY public.gpx_file_tags
3087 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3091 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3094 ALTER TABLE ONLY public.gpx_files
3095 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3099 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3102 ALTER TABLE ONLY public.issue_comments
3103 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3107 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3110 ALTER TABLE ONLY public.issue_comments
3111 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3115 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3118 ALTER TABLE ONLY public.issues
3119 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
3123 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3126 ALTER TABLE ONLY public.issues
3127 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
3131 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3134 ALTER TABLE ONLY public.issues
3135 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
3139 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3142 ALTER TABLE ONLY public.messages
3143 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
3147 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3150 ALTER TABLE ONLY public.messages
3151 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
3155 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3158 ALTER TABLE ONLY public.node_tags
3159 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
3163 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3166 ALTER TABLE ONLY public.nodes
3167 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3171 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3174 ALTER TABLE ONLY public.nodes
3175 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3179 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3182 ALTER TABLE ONLY public.note_comments
3183 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
3187 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3190 ALTER TABLE ONLY public.note_comments
3191 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
3195 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3198 ALTER TABLE ONLY public.oauth_tokens
3199 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
3203 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3206 ALTER TABLE ONLY public.oauth_tokens
3207 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3211 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3214 ALTER TABLE ONLY public.redactions
3215 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3219 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3222 ALTER TABLE ONLY public.relation_members
3223 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3227 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3230 ALTER TABLE ONLY public.relation_tags
3231 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3235 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3238 ALTER TABLE ONLY public.relations
3239 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3243 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3246 ALTER TABLE ONLY public.relations
3247 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3251 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3254 ALTER TABLE ONLY public.reports
3255 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3259 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3262 ALTER TABLE ONLY public.reports
3263 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3267 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3270 ALTER TABLE ONLY public.user_blocks
3271 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
3275 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3278 ALTER TABLE ONLY public.user_blocks
3279 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
3283 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3286 ALTER TABLE ONLY public.user_blocks
3287 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3291 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3294 ALTER TABLE ONLY public.user_preferences
3295 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3299 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3302 ALTER TABLE ONLY public.user_roles
3303 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3307 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3310 ALTER TABLE ONLY public.user_roles
3311 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3315 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3318 ALTER TABLE ONLY public.user_tokens
3319 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3323 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3326 ALTER TABLE ONLY public.way_nodes
3327 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3331 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3334 ALTER TABLE ONLY public.way_tags
3335 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3339 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3342 ALTER TABLE ONLY public.ways
3343 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3347 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3350 ALTER TABLE ONLY public.ways
3351 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3355 -- PostgreSQL database dump complete
3358 SET search_path TO "$user", public;
3360 INSERT INTO "schema_migrations" (version) VALUES