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: format_enum; Type: TYPE; Schema: public; Owner: -
23 CREATE TYPE public.format_enum AS ENUM (
31 -- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: -
34 CREATE TYPE public.gpx_visibility_enum AS ENUM (
43 -- Name: issue_status_enum; Type: TYPE; Schema: public; Owner: -
46 CREATE TYPE public.issue_status_enum AS ENUM (
54 -- Name: note_event_enum; Type: TYPE; Schema: public; Owner: -
57 CREATE TYPE public.note_event_enum AS ENUM (
67 -- Name: note_status_enum; Type: TYPE; Schema: public; Owner: -
70 CREATE TYPE public.note_status_enum AS ENUM (
78 -- Name: nwr_enum; Type: TYPE; Schema: public; Owner: -
81 CREATE TYPE public.nwr_enum AS ENUM (
89 -- Name: user_role_enum; Type: TYPE; Schema: public; Owner: -
92 CREATE TYPE public.user_role_enum AS ENUM (
100 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
103 CREATE TYPE public.user_status_enum AS ENUM (
113 -- Name: api_rate_limit(bigint); Type: FUNCTION; Schema: public; Owner: -
116 CREATE FUNCTION public.api_rate_limit(user_id bigint) RETURNS integer
117 LANGUAGE plpgsql STABLE
120 min_changes_per_hour int4 := 100;
121 initial_changes_per_hour int4 := 1000;
122 max_changes_per_hour int4 := 100000;
123 days_to_max_changes int4 := 7;
124 importer_changes_per_hour int4 := 1000000;
125 moderator_changes_per_hour int4 := 1000000;
127 last_block timestamp without time zone;
128 first_change timestamp without time zone;
130 time_since_first_change double precision;
131 max_changes double precision;
134 SELECT ARRAY_AGG(user_roles.role) INTO STRICT roles FROM user_roles WHERE user_roles.user_id = api_rate_limit.user_id;
136 IF 'moderator' = ANY(roles) THEN
137 max_changes := moderator_changes_per_hour;
138 ELSIF 'importer' = ANY(roles) THEN
139 max_changes := importer_changes_per_hour;
141 SELECT user_blocks.created_at INTO last_block FROM user_blocks WHERE user_blocks.user_id = api_rate_limit.user_id ORDER BY user_blocks.created_at DESC LIMIT 1;
144 SELECT changesets.created_at INTO first_change FROM changesets WHERE changesets.user_id = api_rate_limit.user_id AND changesets.created_at > last_block ORDER BY changesets.created_at LIMIT 1;
146 SELECT changesets.created_at INTO first_change FROM changesets WHERE changesets.user_id = api_rate_limit.user_id ORDER BY changesets.created_at LIMIT 1;
150 first_change := CURRENT_TIMESTAMP AT TIME ZONE 'UTC';
153 SELECT COUNT(*) INTO STRICT active_reports
154 FROM issues INNER JOIN reports ON reports.issue_id = issues.id
155 WHERE issues.reported_user_id = api_rate_limit.user_id AND issues.status = 'open' AND reports.updated_at >= COALESCE(issues.resolved_at, '1970-01-01');
157 time_since_first_change := EXTRACT(EPOCH FROM CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - first_change);
159 max_changes := max_changes_per_hour * POWER(time_since_first_change, 2) / POWER(days_to_max_changes * 24 * 60 * 60, 2);
160 max_changes := GREATEST(initial_changes_per_hour, LEAST(max_changes_per_hour, FLOOR(max_changes)));
161 max_changes := max_changes / POWER(2, active_reports);
162 max_changes := GREATEST(min_changes_per_hour, LEAST(max_changes_per_hour, max_changes));
165 SELECT COALESCE(SUM(changesets.num_changes), 0) INTO STRICT recent_changes FROM changesets WHERE changesets.user_id = api_rate_limit.user_id AND changesets.created_at >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - '1 hour'::interval;
167 RETURN max_changes - recent_changes;
172 SET default_tablespace = '';
174 SET default_table_access_method = heap;
177 -- Name: acls; Type: TABLE; Schema: public; Owner: -
180 CREATE TABLE public.acls (
183 k character varying NOT NULL,
185 domain character varying,
191 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
194 CREATE SEQUENCE public.acls_id_seq
203 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
206 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
210 -- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
213 CREATE TABLE public.active_storage_attachments (
215 name character varying NOT NULL,
216 record_type character varying NOT NULL,
217 record_id bigint NOT NULL,
218 blob_id bigint NOT NULL,
219 created_at timestamp without time zone NOT NULL
224 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
227 CREATE SEQUENCE public.active_storage_attachments_id_seq
236 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
239 ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
243 -- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
246 CREATE TABLE public.active_storage_blobs (
248 key character varying NOT NULL,
249 filename character varying NOT NULL,
250 content_type character varying,
252 byte_size bigint NOT NULL,
253 checksum character varying,
254 created_at timestamp without time zone NOT NULL,
255 service_name character varying NOT NULL
260 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
263 CREATE SEQUENCE public.active_storage_blobs_id_seq
272 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
275 ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
279 -- Name: active_storage_variant_records; Type: TABLE; Schema: public; Owner: -
282 CREATE TABLE public.active_storage_variant_records (
284 blob_id bigint NOT NULL,
285 variation_digest character varying NOT NULL
290 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE; Schema: public; Owner: -
293 CREATE SEQUENCE public.active_storage_variant_records_id_seq
302 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
305 ALTER SEQUENCE public.active_storage_variant_records_id_seq OWNED BY public.active_storage_variant_records.id;
309 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
312 CREATE TABLE public.ar_internal_metadata (
313 key character varying NOT NULL,
314 value character varying,
315 created_at timestamp(6) without time zone NOT NULL,
316 updated_at timestamp(6) without time zone NOT NULL
321 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
324 CREATE TABLE public.changeset_comments (
326 changeset_id bigint NOT NULL,
327 author_id bigint NOT NULL,
329 created_at timestamp without time zone NOT NULL,
330 visible boolean NOT NULL
335 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
338 CREATE SEQUENCE public.changeset_comments_id_seq
348 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
351 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
355 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
358 CREATE TABLE public.changeset_tags (
359 changeset_id bigint NOT NULL,
360 k character varying DEFAULT ''::character varying NOT NULL,
361 v character varying DEFAULT ''::character varying NOT NULL
366 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
369 CREATE TABLE public.changesets (
371 user_id bigint NOT NULL,
372 created_at timestamp without time zone NOT NULL,
377 closed_at timestamp without time zone NOT NULL,
378 num_changes integer DEFAULT 0 NOT NULL
383 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
386 CREATE SEQUENCE public.changesets_id_seq
395 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
398 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
402 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
405 CREATE TABLE public.changesets_subscribers (
406 subscriber_id bigint NOT NULL,
407 changeset_id bigint NOT NULL
412 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
415 CREATE TABLE public.client_applications (
417 name character varying,
418 url character varying,
419 support_url character varying,
420 callback_url character varying,
421 key character varying(50),
422 secret character varying(50),
424 created_at timestamp without time zone,
425 updated_at timestamp without time zone,
426 allow_read_prefs boolean DEFAULT false NOT NULL,
427 allow_write_prefs boolean DEFAULT false NOT NULL,
428 allow_write_diary boolean DEFAULT false NOT NULL,
429 allow_write_api boolean DEFAULT false NOT NULL,
430 allow_read_gpx boolean DEFAULT false NOT NULL,
431 allow_write_gpx boolean DEFAULT false NOT NULL,
432 allow_write_notes boolean DEFAULT false NOT NULL
437 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
440 CREATE SEQUENCE public.client_applications_id_seq
450 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
453 ALTER SEQUENCE public.client_applications_id_seq OWNED BY public.client_applications.id;
457 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
460 CREATE TABLE public.current_node_tags (
461 node_id bigint NOT NULL,
462 k character varying DEFAULT ''::character varying NOT NULL,
463 v character varying DEFAULT ''::character varying NOT NULL
468 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
471 CREATE TABLE public.current_nodes (
473 latitude integer NOT NULL,
474 longitude integer NOT NULL,
475 changeset_id bigint NOT NULL,
476 visible boolean NOT NULL,
477 "timestamp" timestamp without time zone NOT NULL,
478 tile bigint NOT NULL,
479 version bigint NOT NULL
484 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
487 CREATE SEQUENCE public.current_nodes_id_seq
496 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
499 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
503 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
506 CREATE TABLE public.current_relation_members (
507 relation_id bigint NOT NULL,
508 member_type public.nwr_enum NOT NULL,
509 member_id bigint NOT NULL,
510 member_role character varying NOT NULL,
511 sequence_id integer DEFAULT 0 NOT NULL
516 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
519 CREATE TABLE public.current_relation_tags (
520 relation_id bigint NOT NULL,
521 k character varying DEFAULT ''::character varying NOT NULL,
522 v character varying DEFAULT ''::character varying NOT NULL
527 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
530 CREATE TABLE public.current_relations (
532 changeset_id bigint NOT NULL,
533 "timestamp" timestamp without time zone NOT NULL,
534 visible boolean NOT NULL,
535 version bigint NOT NULL
540 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
543 CREATE SEQUENCE public.current_relations_id_seq
552 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
555 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
559 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
562 CREATE TABLE public.current_way_nodes (
563 way_id bigint NOT NULL,
564 node_id bigint NOT NULL,
565 sequence_id bigint NOT NULL
570 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
573 CREATE TABLE public.current_way_tags (
574 way_id bigint NOT NULL,
575 k character varying DEFAULT ''::character varying NOT NULL,
576 v character varying DEFAULT ''::character varying NOT NULL
581 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
584 CREATE TABLE public.current_ways (
586 changeset_id bigint NOT NULL,
587 "timestamp" timestamp without time zone NOT NULL,
588 visible boolean NOT NULL,
589 version bigint NOT NULL
594 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
597 CREATE SEQUENCE public.current_ways_id_seq
606 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
609 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
613 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
616 CREATE TABLE public.delayed_jobs (
618 priority integer DEFAULT 0 NOT NULL,
619 attempts integer DEFAULT 0 NOT NULL,
620 handler text NOT NULL,
622 run_at timestamp without time zone,
623 locked_at timestamp without time zone,
624 failed_at timestamp without time zone,
625 locked_by character varying,
626 queue character varying,
627 created_at timestamp without time zone,
628 updated_at timestamp without time zone
633 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
636 CREATE SEQUENCE public.delayed_jobs_id_seq
645 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
648 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
652 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
655 CREATE TABLE public.diary_comments (
657 diary_entry_id bigint NOT NULL,
658 user_id bigint NOT NULL,
660 created_at timestamp without time zone NOT NULL,
661 updated_at timestamp without time zone NOT NULL,
662 visible boolean DEFAULT true NOT NULL,
663 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
668 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
671 CREATE SEQUENCE public.diary_comments_id_seq
680 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
683 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
687 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
690 CREATE TABLE public.diary_entries (
692 user_id bigint NOT NULL,
693 title character varying NOT NULL,
695 created_at timestamp without time zone NOT NULL,
696 updated_at timestamp without time zone NOT NULL,
697 latitude double precision,
698 longitude double precision,
699 language_code character varying DEFAULT 'en'::character varying NOT NULL,
700 visible boolean DEFAULT true NOT NULL,
701 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
706 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
709 CREATE SEQUENCE public.diary_entries_id_seq
718 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
721 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
725 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
728 CREATE TABLE public.diary_entry_subscriptions (
729 user_id bigint NOT NULL,
730 diary_entry_id bigint NOT NULL
735 -- Name: friends; Type: TABLE; Schema: public; Owner: -
738 CREATE TABLE public.friends (
740 user_id bigint NOT NULL,
741 friend_user_id bigint NOT NULL,
742 created_at timestamp without time zone
747 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
750 CREATE SEQUENCE public.friends_id_seq
759 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
762 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
766 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
769 CREATE TABLE public.gps_points (
770 altitude double precision,
771 trackid integer NOT NULL,
772 latitude integer NOT NULL,
773 longitude integer NOT NULL,
774 gpx_id bigint NOT NULL,
775 "timestamp" timestamp without time zone,
781 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
784 CREATE TABLE public.gpx_file_tags (
785 gpx_id bigint NOT NULL,
786 tag character varying NOT NULL,
792 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
795 CREATE SEQUENCE public.gpx_file_tags_id_seq
804 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
807 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
811 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
814 CREATE TABLE public.gpx_files (
816 user_id bigint NOT NULL,
817 visible boolean DEFAULT true NOT NULL,
818 name character varying DEFAULT ''::character varying NOT NULL,
820 latitude double precision,
821 longitude double precision,
822 "timestamp" timestamp without time zone NOT NULL,
823 description character varying DEFAULT ''::character varying NOT NULL,
824 inserted boolean NOT NULL,
825 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
830 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
833 CREATE SEQUENCE public.gpx_files_id_seq
842 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
845 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
849 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
852 CREATE TABLE public.issue_comments (
854 issue_id integer NOT NULL,
855 user_id integer NOT NULL,
857 created_at timestamp without time zone NOT NULL,
858 updated_at timestamp without time zone NOT NULL
863 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
866 CREATE SEQUENCE public.issue_comments_id_seq
876 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
879 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
883 -- Name: issues; Type: TABLE; Schema: public; Owner: -
886 CREATE TABLE public.issues (
888 reportable_type character varying NOT NULL,
889 reportable_id integer NOT NULL,
890 reported_user_id integer,
891 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
892 assigned_role public.user_role_enum NOT NULL,
893 resolved_at timestamp without time zone,
896 reports_count integer DEFAULT 0,
897 created_at timestamp without time zone NOT NULL,
898 updated_at timestamp without time zone NOT NULL
903 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
906 CREATE SEQUENCE public.issues_id_seq
916 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
919 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
923 -- Name: languages; Type: TABLE; Schema: public; Owner: -
926 CREATE TABLE public.languages (
927 code character varying NOT NULL,
928 english_name character varying NOT NULL,
929 native_name character varying
934 -- Name: messages; Type: TABLE; Schema: public; Owner: -
937 CREATE TABLE public.messages (
939 from_user_id bigint NOT NULL,
940 title character varying NOT NULL,
942 sent_on timestamp without time zone NOT NULL,
943 message_read boolean DEFAULT false NOT NULL,
944 to_user_id bigint NOT NULL,
945 to_user_visible boolean DEFAULT true NOT NULL,
946 from_user_visible boolean DEFAULT true NOT NULL,
947 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
952 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
955 CREATE SEQUENCE public.messages_id_seq
964 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
967 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
971 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
974 CREATE TABLE public.node_tags (
975 node_id bigint NOT NULL,
976 version bigint NOT NULL,
977 k character varying DEFAULT ''::character varying NOT NULL,
978 v character varying DEFAULT ''::character varying NOT NULL
983 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
986 CREATE TABLE public.nodes (
987 node_id bigint NOT NULL,
988 latitude integer NOT NULL,
989 longitude integer NOT NULL,
990 changeset_id bigint NOT NULL,
991 visible boolean NOT NULL,
992 "timestamp" timestamp without time zone NOT NULL,
993 tile bigint NOT NULL,
994 version bigint NOT NULL,
1000 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
1003 CREATE TABLE public.note_comments (
1005 note_id bigint NOT NULL,
1006 visible boolean NOT NULL,
1007 created_at timestamp without time zone NOT NULL,
1011 event public.note_event_enum
1016 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1019 CREATE SEQUENCE public.note_comments_id_seq
1028 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1031 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
1035 -- Name: notes; Type: TABLE; Schema: public; Owner: -
1038 CREATE TABLE public.notes (
1040 latitude integer NOT NULL,
1041 longitude integer NOT NULL,
1042 tile bigint NOT NULL,
1043 updated_at timestamp without time zone NOT NULL,
1044 created_at timestamp without time zone NOT NULL,
1045 status public.note_status_enum NOT NULL,
1046 closed_at timestamp without time zone
1051 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1054 CREATE SEQUENCE public.notes_id_seq
1063 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1066 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
1070 -- Name: oauth_access_grants; Type: TABLE; Schema: public; Owner: -
1073 CREATE TABLE public.oauth_access_grants (
1075 resource_owner_id bigint NOT NULL,
1076 application_id bigint NOT NULL,
1077 token character varying NOT NULL,
1078 expires_in integer NOT NULL,
1079 redirect_uri text NOT NULL,
1080 created_at timestamp without time zone NOT NULL,
1081 revoked_at timestamp without time zone,
1082 scopes character varying DEFAULT ''::character varying NOT NULL,
1083 code_challenge character varying,
1084 code_challenge_method character varying
1089 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1092 CREATE SEQUENCE public.oauth_access_grants_id_seq
1101 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1104 ALTER SEQUENCE public.oauth_access_grants_id_seq OWNED BY public.oauth_access_grants.id;
1108 -- Name: oauth_access_tokens; Type: TABLE; Schema: public; Owner: -
1111 CREATE TABLE public.oauth_access_tokens (
1113 resource_owner_id bigint,
1114 application_id bigint NOT NULL,
1115 token character varying NOT NULL,
1116 refresh_token character varying,
1118 revoked_at timestamp without time zone,
1119 created_at timestamp without time zone NOT NULL,
1120 scopes character varying,
1121 previous_refresh_token character varying DEFAULT ''::character varying NOT NULL
1126 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1129 CREATE SEQUENCE public.oauth_access_tokens_id_seq
1138 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1141 ALTER SEQUENCE public.oauth_access_tokens_id_seq OWNED BY public.oauth_access_tokens.id;
1145 -- Name: oauth_applications; Type: TABLE; Schema: public; Owner: -
1148 CREATE TABLE public.oauth_applications (
1150 owner_type character varying NOT NULL,
1151 owner_id bigint NOT NULL,
1152 name character varying NOT NULL,
1153 uid character varying NOT NULL,
1154 secret character varying NOT NULL,
1155 redirect_uri text NOT NULL,
1156 scopes character varying DEFAULT ''::character varying NOT NULL,
1157 confidential boolean DEFAULT true NOT NULL,
1158 created_at timestamp(6) without time zone NOT NULL,
1159 updated_at timestamp(6) without time zone NOT NULL
1164 -- Name: oauth_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1167 CREATE SEQUENCE public.oauth_applications_id_seq
1176 -- Name: oauth_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1179 ALTER SEQUENCE public.oauth_applications_id_seq OWNED BY public.oauth_applications.id;
1183 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
1186 CREATE TABLE public.oauth_nonces (
1188 nonce character varying,
1189 "timestamp" integer,
1190 created_at timestamp without time zone,
1191 updated_at timestamp without time zone
1196 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1199 CREATE SEQUENCE public.oauth_nonces_id_seq
1208 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1211 ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id;
1215 -- Name: oauth_openid_requests; Type: TABLE; Schema: public; Owner: -
1218 CREATE TABLE public.oauth_openid_requests (
1220 access_grant_id bigint NOT NULL,
1221 nonce character varying NOT NULL
1226 -- Name: oauth_openid_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1229 CREATE SEQUENCE public.oauth_openid_requests_id_seq
1238 -- Name: oauth_openid_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1241 ALTER SEQUENCE public.oauth_openid_requests_id_seq OWNED BY public.oauth_openid_requests.id;
1245 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
1248 CREATE TABLE public.oauth_tokens (
1249 id integer NOT NULL,
1251 type character varying(20),
1252 client_application_id integer,
1253 token character varying(50),
1254 secret character varying(50),
1255 authorized_at timestamp without time zone,
1256 invalidated_at timestamp without time zone,
1257 created_at timestamp without time zone,
1258 updated_at timestamp without time zone,
1259 allow_read_prefs boolean DEFAULT false NOT NULL,
1260 allow_write_prefs boolean DEFAULT false NOT NULL,
1261 allow_write_diary boolean DEFAULT false NOT NULL,
1262 allow_write_api boolean DEFAULT false NOT NULL,
1263 allow_read_gpx boolean DEFAULT false NOT NULL,
1264 allow_write_gpx boolean DEFAULT false NOT NULL,
1265 callback_url character varying,
1266 verifier character varying(20),
1267 scope character varying,
1268 valid_to timestamp without time zone,
1269 allow_write_notes boolean DEFAULT false NOT NULL
1274 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1277 CREATE SEQUENCE public.oauth_tokens_id_seq
1287 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1290 ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
1294 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1297 CREATE TABLE public.redactions (
1298 id integer NOT NULL,
1299 title character varying,
1301 created_at timestamp without time zone,
1302 updated_at timestamp without time zone,
1303 user_id bigint NOT NULL,
1304 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1309 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1312 CREATE SEQUENCE public.redactions_id_seq
1322 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1325 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1329 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1332 CREATE TABLE public.relation_members (
1333 relation_id bigint NOT NULL,
1334 member_type public.nwr_enum NOT NULL,
1335 member_id bigint NOT NULL,
1336 member_role character varying NOT NULL,
1337 version bigint DEFAULT 0 NOT NULL,
1338 sequence_id integer DEFAULT 0 NOT NULL
1343 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1346 CREATE TABLE public.relation_tags (
1347 relation_id bigint NOT NULL,
1348 k character varying DEFAULT ''::character varying NOT NULL,
1349 v character varying DEFAULT ''::character varying NOT NULL,
1350 version bigint NOT NULL
1355 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1358 CREATE TABLE public.relations (
1359 relation_id bigint NOT NULL,
1360 changeset_id bigint NOT NULL,
1361 "timestamp" timestamp without time zone NOT NULL,
1362 version bigint NOT NULL,
1363 visible boolean DEFAULT true NOT NULL,
1364 redaction_id integer
1369 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1372 CREATE TABLE public.reports (
1373 id integer NOT NULL,
1374 issue_id integer NOT NULL,
1375 user_id integer NOT NULL,
1376 details text NOT NULL,
1377 category character varying NOT NULL,
1378 created_at timestamp without time zone NOT NULL,
1379 updated_at timestamp without time zone NOT NULL
1384 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1387 CREATE SEQUENCE public.reports_id_seq
1397 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1400 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1404 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1407 CREATE TABLE public.schema_migrations (
1408 version character varying NOT NULL
1413 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1416 CREATE TABLE public.user_blocks (
1417 id integer NOT NULL,
1418 user_id bigint NOT NULL,
1419 creator_id bigint NOT NULL,
1420 reason text NOT NULL,
1421 ends_at timestamp without time zone NOT NULL,
1422 needs_view boolean DEFAULT false NOT NULL,
1424 created_at timestamp without time zone,
1425 updated_at timestamp without time zone,
1426 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1431 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1434 CREATE SEQUENCE public.user_blocks_id_seq
1444 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1447 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1451 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1454 CREATE TABLE public.user_preferences (
1455 user_id bigint NOT NULL,
1456 k character varying NOT NULL,
1457 v character varying NOT NULL
1462 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1465 CREATE TABLE public.user_roles (
1466 id integer NOT NULL,
1467 user_id bigint NOT NULL,
1468 role public.user_role_enum NOT NULL,
1469 created_at timestamp without time zone,
1470 updated_at timestamp without time zone,
1471 granter_id bigint NOT NULL
1476 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1479 CREATE SEQUENCE public.user_roles_id_seq
1489 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1492 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1496 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1499 CREATE TABLE public.user_tokens (
1501 user_id bigint NOT NULL,
1502 token character varying NOT NULL,
1503 expiry timestamp without time zone NOT NULL,
1509 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1512 CREATE SEQUENCE public.user_tokens_id_seq
1521 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1524 ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id;
1528 -- Name: users; Type: TABLE; Schema: public; Owner: -
1531 CREATE TABLE public.users (
1532 email character varying NOT NULL,
1534 pass_crypt character varying NOT NULL,
1535 creation_time timestamp without time zone NOT NULL,
1536 display_name character varying DEFAULT ''::character varying NOT NULL,
1537 data_public boolean DEFAULT false NOT NULL,
1538 description text DEFAULT ''::text NOT NULL,
1539 home_lat double precision,
1540 home_lon double precision,
1541 home_zoom smallint DEFAULT 3,
1542 pass_salt character varying,
1543 email_valid boolean DEFAULT false NOT NULL,
1544 new_email character varying,
1545 creation_ip character varying,
1546 languages character varying,
1547 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1548 terms_agreed timestamp without time zone,
1549 consider_pd boolean DEFAULT false NOT NULL,
1550 auth_uid character varying,
1551 preferred_editor character varying,
1552 terms_seen boolean DEFAULT false NOT NULL,
1553 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1554 changesets_count integer DEFAULT 0 NOT NULL,
1555 traces_count integer DEFAULT 0 NOT NULL,
1556 diary_entries_count integer DEFAULT 0 NOT NULL,
1557 image_use_gravatar boolean DEFAULT false NOT NULL,
1558 auth_provider character varying,
1560 tou_agreed timestamp without time zone
1565 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1568 CREATE SEQUENCE public.users_id_seq
1577 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1580 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1584 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1587 CREATE TABLE public.way_nodes (
1588 way_id bigint NOT NULL,
1589 node_id bigint NOT NULL,
1590 version bigint NOT NULL,
1591 sequence_id bigint NOT NULL
1596 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1599 CREATE TABLE public.way_tags (
1600 way_id bigint NOT NULL,
1601 k character varying NOT NULL,
1602 v character varying NOT NULL,
1603 version bigint NOT NULL
1608 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1611 CREATE TABLE public.ways (
1612 way_id bigint NOT NULL,
1613 changeset_id bigint NOT NULL,
1614 "timestamp" timestamp without time zone NOT NULL,
1615 version bigint NOT NULL,
1616 visible boolean DEFAULT true NOT NULL,
1617 redaction_id integer
1622 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1625 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1629 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1632 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1636 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1639 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1643 -- Name: active_storage_variant_records id; Type: DEFAULT; Schema: public; Owner: -
1646 ALTER TABLE ONLY public.active_storage_variant_records ALTER COLUMN id SET DEFAULT nextval('public.active_storage_variant_records_id_seq'::regclass);
1650 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1653 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1657 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1660 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1664 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1667 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1671 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1674 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1678 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1681 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1685 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1688 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1692 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1695 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1699 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1702 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1706 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1709 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1713 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1716 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1720 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1723 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1727 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1730 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1734 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1737 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1741 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1744 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1748 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1751 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1755 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1758 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1762 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1765 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1769 -- Name: oauth_access_grants id; Type: DEFAULT; Schema: public; Owner: -
1772 ALTER TABLE ONLY public.oauth_access_grants ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_grants_id_seq'::regclass);
1776 -- Name: oauth_access_tokens id; Type: DEFAULT; Schema: public; Owner: -
1779 ALTER TABLE ONLY public.oauth_access_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_tokens_id_seq'::regclass);
1783 -- Name: oauth_applications id; Type: DEFAULT; Schema: public; Owner: -
1786 ALTER TABLE ONLY public.oauth_applications ALTER COLUMN id SET DEFAULT nextval('public.oauth_applications_id_seq'::regclass);
1790 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1793 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1797 -- Name: oauth_openid_requests id; Type: DEFAULT; Schema: public; Owner: -
1800 ALTER TABLE ONLY public.oauth_openid_requests ALTER COLUMN id SET DEFAULT nextval('public.oauth_openid_requests_id_seq'::regclass);
1804 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1807 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1811 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1814 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1818 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1821 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1825 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1828 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1832 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1835 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1839 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1842 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1846 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1849 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1853 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1856 ALTER TABLE ONLY public.acls
1857 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1861 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1864 ALTER TABLE ONLY public.active_storage_attachments
1865 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1869 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1872 ALTER TABLE ONLY public.active_storage_blobs
1873 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1877 -- Name: active_storage_variant_records active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1880 ALTER TABLE ONLY public.active_storage_variant_records
1881 ADD CONSTRAINT active_storage_variant_records_pkey PRIMARY KEY (id);
1885 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1888 ALTER TABLE ONLY public.ar_internal_metadata
1889 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1893 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1896 ALTER TABLE ONLY public.changeset_comments
1897 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1901 -- Name: changeset_tags changeset_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1904 ALTER TABLE ONLY public.changeset_tags
1905 ADD CONSTRAINT changeset_tags_pkey PRIMARY KEY (changeset_id, k);
1909 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1912 ALTER TABLE ONLY public.changesets
1913 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1917 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1920 ALTER TABLE ONLY public.client_applications
1921 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1925 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1928 ALTER TABLE ONLY public.current_node_tags
1929 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1933 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1936 ALTER TABLE ONLY public.current_nodes
1937 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1941 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1944 ALTER TABLE ONLY public.current_relation_members
1945 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, sequence_id);
1949 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1952 ALTER TABLE ONLY public.current_relation_tags
1953 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1957 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1960 ALTER TABLE ONLY public.current_relations
1961 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1965 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1968 ALTER TABLE ONLY public.current_way_nodes
1969 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1973 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1976 ALTER TABLE ONLY public.current_way_tags
1977 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1981 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1984 ALTER TABLE ONLY public.current_ways
1985 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1989 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1992 ALTER TABLE ONLY public.delayed_jobs
1993 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1997 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2000 ALTER TABLE ONLY public.diary_comments
2001 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
2005 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2008 ALTER TABLE ONLY public.diary_entries
2009 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
2013 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2016 ALTER TABLE ONLY public.diary_entry_subscriptions
2017 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
2021 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2024 ALTER TABLE ONLY public.friends
2025 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
2029 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2032 ALTER TABLE ONLY public.gpx_file_tags
2033 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
2037 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2040 ALTER TABLE ONLY public.gpx_files
2041 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
2045 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2048 ALTER TABLE ONLY public.issue_comments
2049 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
2053 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2056 ALTER TABLE ONLY public.issues
2057 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
2061 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2064 ALTER TABLE ONLY public.languages
2065 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
2069 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2072 ALTER TABLE ONLY public.messages
2073 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
2077 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2080 ALTER TABLE ONLY public.node_tags
2081 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
2085 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2088 ALTER TABLE ONLY public.nodes
2089 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
2093 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2096 ALTER TABLE ONLY public.note_comments
2097 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
2101 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2104 ALTER TABLE ONLY public.notes
2105 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
2109 -- Name: oauth_access_grants oauth_access_grants_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2112 ALTER TABLE ONLY public.oauth_access_grants
2113 ADD CONSTRAINT oauth_access_grants_pkey PRIMARY KEY (id);
2117 -- Name: oauth_access_tokens oauth_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2120 ALTER TABLE ONLY public.oauth_access_tokens
2121 ADD CONSTRAINT oauth_access_tokens_pkey PRIMARY KEY (id);
2125 -- Name: oauth_applications oauth_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2128 ALTER TABLE ONLY public.oauth_applications
2129 ADD CONSTRAINT oauth_applications_pkey PRIMARY KEY (id);
2133 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2136 ALTER TABLE ONLY public.oauth_nonces
2137 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
2141 -- Name: oauth_openid_requests oauth_openid_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2144 ALTER TABLE ONLY public.oauth_openid_requests
2145 ADD CONSTRAINT oauth_openid_requests_pkey PRIMARY KEY (id);
2149 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2152 ALTER TABLE ONLY public.oauth_tokens
2153 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
2157 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2160 ALTER TABLE ONLY public.redactions
2161 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
2165 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2168 ALTER TABLE ONLY public.relation_members
2169 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, sequence_id);
2173 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2176 ALTER TABLE ONLY public.relation_tags
2177 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
2181 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2184 ALTER TABLE ONLY public.relations
2185 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
2189 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2192 ALTER TABLE ONLY public.reports
2193 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
2197 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2200 ALTER TABLE ONLY public.schema_migrations
2201 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
2205 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2208 ALTER TABLE ONLY public.user_blocks
2209 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
2213 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2216 ALTER TABLE ONLY public.user_preferences
2217 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
2221 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2224 ALTER TABLE ONLY public.user_roles
2225 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
2229 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2232 ALTER TABLE ONLY public.user_tokens
2233 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
2237 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2240 ALTER TABLE ONLY public.users
2241 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2245 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2248 ALTER TABLE ONLY public.way_nodes
2249 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2253 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2256 ALTER TABLE ONLY public.way_tags
2257 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2261 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2264 ALTER TABLE ONLY public.ways
2265 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2269 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2272 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2276 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2279 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2283 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2286 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2290 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2293 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2297 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2300 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2304 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2307 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2311 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2314 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2318 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2321 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2325 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2328 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2332 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2335 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2339 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2342 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2346 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2349 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2353 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2356 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2360 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2363 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2367 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2370 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2374 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2377 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2381 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2384 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2388 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2391 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2395 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2398 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2402 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2405 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2409 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2412 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2416 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2419 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2423 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2426 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2430 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2433 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2437 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2440 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2444 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2447 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2451 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2454 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2458 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2461 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2465 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2468 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2472 -- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
2475 CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest);
2479 -- Name: index_changeset_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2482 CREATE INDEX index_changeset_comments_on_author_id_and_created_at ON public.changeset_comments USING btree (author_id, created_at);
2486 -- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2489 CREATE INDEX index_changeset_comments_on_changeset_id_and_created_at ON public.changeset_comments USING btree (changeset_id, created_at);
2493 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2496 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2500 -- Name: index_changesets_on_user_id_and_closed_at; Type: INDEX; Schema: public; Owner: -
2503 CREATE INDEX index_changesets_on_user_id_and_closed_at ON public.changesets USING btree (user_id, closed_at);
2507 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2510 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2514 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2517 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2521 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2524 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2528 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2531 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2535 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2538 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2542 -- Name: index_friends_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2545 CREATE INDEX index_friends_on_user_id_and_created_at ON public.friends USING btree (user_id, created_at);
2549 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2552 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2556 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2559 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2563 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2566 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2570 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2573 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2577 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2580 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2584 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2587 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2591 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2594 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2598 -- Name: index_note_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2601 CREATE INDEX index_note_comments_on_author_id_and_created_at ON public.note_comments USING btree (author_id, created_at);
2605 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2608 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2612 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2615 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2619 -- Name: index_oauth_access_grants_on_application_id; Type: INDEX; Schema: public; Owner: -
2622 CREATE INDEX index_oauth_access_grants_on_application_id ON public.oauth_access_grants USING btree (application_id);
2626 -- Name: index_oauth_access_grants_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2629 CREATE INDEX index_oauth_access_grants_on_resource_owner_id ON public.oauth_access_grants USING btree (resource_owner_id);
2633 -- Name: index_oauth_access_grants_on_token; Type: INDEX; Schema: public; Owner: -
2636 CREATE UNIQUE INDEX index_oauth_access_grants_on_token ON public.oauth_access_grants USING btree (token);
2640 -- Name: index_oauth_access_tokens_on_application_id; Type: INDEX; Schema: public; Owner: -
2643 CREATE INDEX index_oauth_access_tokens_on_application_id ON public.oauth_access_tokens USING btree (application_id);
2647 -- Name: index_oauth_access_tokens_on_refresh_token; Type: INDEX; Schema: public; Owner: -
2650 CREATE UNIQUE INDEX index_oauth_access_tokens_on_refresh_token ON public.oauth_access_tokens USING btree (refresh_token);
2654 -- Name: index_oauth_access_tokens_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2657 CREATE INDEX index_oauth_access_tokens_on_resource_owner_id ON public.oauth_access_tokens USING btree (resource_owner_id);
2661 -- Name: index_oauth_access_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2664 CREATE UNIQUE INDEX index_oauth_access_tokens_on_token ON public.oauth_access_tokens USING btree (token);
2668 -- Name: index_oauth_applications_on_owner_type_and_owner_id; Type: INDEX; Schema: public; Owner: -
2671 CREATE INDEX index_oauth_applications_on_owner_type_and_owner_id ON public.oauth_applications USING btree (owner_type, owner_id);
2675 -- Name: index_oauth_applications_on_uid; Type: INDEX; Schema: public; Owner: -
2678 CREATE UNIQUE INDEX index_oauth_applications_on_uid ON public.oauth_applications USING btree (uid);
2682 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2685 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2689 -- Name: index_oauth_openid_requests_on_access_grant_id; Type: INDEX; Schema: public; Owner: -
2692 CREATE INDEX index_oauth_openid_requests_on_access_grant_id ON public.oauth_openid_requests USING btree (access_grant_id);
2696 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2699 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2703 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2706 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2710 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2713 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2717 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2720 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2724 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2727 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2731 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2734 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2738 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2741 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2745 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2748 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2752 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2755 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2759 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2762 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2766 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2769 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2773 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2776 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2780 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2783 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2787 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2790 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2794 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2797 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2801 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2804 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2808 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2811 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2815 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2818 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2822 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2825 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2829 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2832 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2836 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2839 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2843 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2846 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2850 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2853 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2857 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2860 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2864 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2867 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2871 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2874 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2878 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2881 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2885 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2888 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2892 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2895 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2899 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2902 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2906 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2909 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2913 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2916 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2920 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2923 ALTER TABLE ONLY public.changeset_comments
2924 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2928 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2931 ALTER TABLE ONLY public.changeset_comments
2932 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2936 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2939 ALTER TABLE ONLY public.changeset_tags
2940 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2944 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2947 ALTER TABLE ONLY public.changesets_subscribers
2948 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2952 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2955 ALTER TABLE ONLY public.changesets_subscribers
2956 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2960 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2963 ALTER TABLE ONLY public.changesets
2964 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2968 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2971 ALTER TABLE ONLY public.client_applications
2972 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2976 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2979 ALTER TABLE ONLY public.current_node_tags
2980 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2984 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2987 ALTER TABLE ONLY public.current_nodes
2988 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2992 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2995 ALTER TABLE ONLY public.current_relation_members
2996 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
3000 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3003 ALTER TABLE ONLY public.current_relation_tags
3004 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
3008 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3011 ALTER TABLE ONLY public.current_relations
3012 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3016 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3019 ALTER TABLE ONLY public.current_way_nodes
3020 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
3024 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3027 ALTER TABLE ONLY public.current_way_nodes
3028 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
3032 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3035 ALTER TABLE ONLY public.current_way_tags
3036 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
3040 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3043 ALTER TABLE ONLY public.current_ways
3044 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3048 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3051 ALTER TABLE ONLY public.diary_comments
3052 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
3056 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3059 ALTER TABLE ONLY public.diary_comments
3060 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3064 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3067 ALTER TABLE ONLY public.diary_entries
3068 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
3072 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3075 ALTER TABLE ONLY public.diary_entries
3076 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3080 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3083 ALTER TABLE ONLY public.diary_entry_subscriptions
3084 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
3088 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3091 ALTER TABLE ONLY public.diary_entry_subscriptions
3092 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3096 -- Name: oauth_access_grants fk_rails_330c32d8d9; Type: FK CONSTRAINT; Schema: public; Owner: -
3099 ALTER TABLE ONLY public.oauth_access_grants
3100 ADD CONSTRAINT fk_rails_330c32d8d9 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3104 -- Name: oauth_access_tokens fk_rails_732cb83ab7; Type: FK CONSTRAINT; Schema: public; Owner: -
3107 ALTER TABLE ONLY public.oauth_access_tokens
3108 ADD CONSTRAINT fk_rails_732cb83ab7 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3112 -- Name: oauth_openid_requests fk_rails_77114b3b09; Type: FK CONSTRAINT; Schema: public; Owner: -
3115 ALTER TABLE ONLY public.oauth_openid_requests
3116 ADD CONSTRAINT fk_rails_77114b3b09 FOREIGN KEY (access_grant_id) REFERENCES public.oauth_access_grants(id) ON DELETE CASCADE;
3120 -- Name: active_storage_variant_records fk_rails_993965df05; Type: FK CONSTRAINT; Schema: public; Owner: -
3123 ALTER TABLE ONLY public.active_storage_variant_records
3124 ADD CONSTRAINT fk_rails_993965df05 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3128 -- Name: oauth_access_grants fk_rails_b4b53e07b8; Type: FK CONSTRAINT; Schema: public; Owner: -
3131 ALTER TABLE ONLY public.oauth_access_grants
3132 ADD CONSTRAINT fk_rails_b4b53e07b8 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3136 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
3139 ALTER TABLE ONLY public.active_storage_attachments
3140 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3144 -- Name: oauth_applications fk_rails_cc886e315a; Type: FK CONSTRAINT; Schema: public; Owner: -
3147 ALTER TABLE ONLY public.oauth_applications
3148 ADD CONSTRAINT fk_rails_cc886e315a FOREIGN KEY (owner_id) REFERENCES public.users(id) NOT VALID;
3152 -- Name: oauth_access_tokens fk_rails_ee63f25419; Type: FK CONSTRAINT; Schema: public; Owner: -
3155 ALTER TABLE ONLY public.oauth_access_tokens
3156 ADD CONSTRAINT fk_rails_ee63f25419 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3160 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3163 ALTER TABLE ONLY public.friends
3164 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
3168 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3171 ALTER TABLE ONLY public.friends
3172 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3176 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3179 ALTER TABLE ONLY public.gps_points
3180 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3184 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3187 ALTER TABLE ONLY public.gpx_file_tags
3188 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3192 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3195 ALTER TABLE ONLY public.gpx_files
3196 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3200 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3203 ALTER TABLE ONLY public.issue_comments
3204 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3208 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3211 ALTER TABLE ONLY public.issue_comments
3212 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3216 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3219 ALTER TABLE ONLY public.issues
3220 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
3224 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3227 ALTER TABLE ONLY public.issues
3228 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
3232 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3235 ALTER TABLE ONLY public.issues
3236 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
3240 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3243 ALTER TABLE ONLY public.messages
3244 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
3248 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3251 ALTER TABLE ONLY public.messages
3252 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
3256 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3259 ALTER TABLE ONLY public.node_tags
3260 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
3264 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3267 ALTER TABLE ONLY public.nodes
3268 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3272 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3275 ALTER TABLE ONLY public.nodes
3276 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3280 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3283 ALTER TABLE ONLY public.note_comments
3284 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
3288 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3291 ALTER TABLE ONLY public.note_comments
3292 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
3296 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3299 ALTER TABLE ONLY public.oauth_tokens
3300 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
3304 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3307 ALTER TABLE ONLY public.oauth_tokens
3308 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3312 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3315 ALTER TABLE ONLY public.redactions
3316 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3320 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3323 ALTER TABLE ONLY public.relation_members
3324 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3328 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3331 ALTER TABLE ONLY public.relation_tags
3332 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3336 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3339 ALTER TABLE ONLY public.relations
3340 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3344 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3347 ALTER TABLE ONLY public.relations
3348 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3352 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3355 ALTER TABLE ONLY public.reports
3356 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3360 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3363 ALTER TABLE ONLY public.reports
3364 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3368 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3371 ALTER TABLE ONLY public.user_blocks
3372 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
3376 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3379 ALTER TABLE ONLY public.user_blocks
3380 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
3384 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3387 ALTER TABLE ONLY public.user_blocks
3388 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3392 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3395 ALTER TABLE ONLY public.user_preferences
3396 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3400 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3403 ALTER TABLE ONLY public.user_roles
3404 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3408 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3411 ALTER TABLE ONLY public.user_roles
3412 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3416 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3419 ALTER TABLE ONLY public.user_tokens
3420 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3424 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3427 ALTER TABLE ONLY public.way_nodes
3428 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3432 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3435 ALTER TABLE ONLY public.way_tags
3436 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3440 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3443 ALTER TABLE ONLY public.ways
3444 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3448 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3451 ALTER TABLE ONLY public.ways
3452 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3456 -- PostgreSQL database dump complete
3459 SET search_path TO "$user", public;
3461 INSERT INTO "schema_migrations" (version) VALUES