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
1029 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1032 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
1036 -- Name: notes; Type: TABLE; Schema: public; Owner: -
1039 CREATE TABLE public.notes (
1041 latitude integer NOT NULL,
1042 longitude integer NOT NULL,
1043 tile bigint NOT NULL,
1044 updated_at timestamp without time zone NOT NULL,
1045 created_at timestamp without time zone NOT NULL,
1046 status public.note_status_enum NOT NULL,
1047 closed_at timestamp without time zone
1052 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1055 CREATE SEQUENCE public.notes_id_seq
1065 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1068 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
1072 -- Name: oauth_access_grants; Type: TABLE; Schema: public; Owner: -
1075 CREATE TABLE public.oauth_access_grants (
1077 resource_owner_id bigint NOT NULL,
1078 application_id bigint NOT NULL,
1079 token character varying NOT NULL,
1080 expires_in integer NOT NULL,
1081 redirect_uri text NOT NULL,
1082 created_at timestamp without time zone NOT NULL,
1083 revoked_at timestamp without time zone,
1084 scopes character varying DEFAULT ''::character varying NOT NULL,
1085 code_challenge character varying,
1086 code_challenge_method character varying
1091 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1094 CREATE SEQUENCE public.oauth_access_grants_id_seq
1103 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1106 ALTER SEQUENCE public.oauth_access_grants_id_seq OWNED BY public.oauth_access_grants.id;
1110 -- Name: oauth_access_tokens; Type: TABLE; Schema: public; Owner: -
1113 CREATE TABLE public.oauth_access_tokens (
1115 resource_owner_id bigint,
1116 application_id bigint NOT NULL,
1117 token character varying NOT NULL,
1118 refresh_token character varying,
1120 revoked_at timestamp without time zone,
1121 created_at timestamp without time zone NOT NULL,
1122 scopes character varying,
1123 previous_refresh_token character varying DEFAULT ''::character varying NOT NULL
1128 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1131 CREATE SEQUENCE public.oauth_access_tokens_id_seq
1140 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1143 ALTER SEQUENCE public.oauth_access_tokens_id_seq OWNED BY public.oauth_access_tokens.id;
1147 -- Name: oauth_applications; Type: TABLE; Schema: public; Owner: -
1150 CREATE TABLE public.oauth_applications (
1152 owner_type character varying NOT NULL,
1153 owner_id bigint NOT NULL,
1154 name character varying NOT NULL,
1155 uid character varying NOT NULL,
1156 secret character varying NOT NULL,
1157 redirect_uri text NOT NULL,
1158 scopes character varying DEFAULT ''::character varying NOT NULL,
1159 confidential boolean DEFAULT true NOT NULL,
1160 created_at timestamp(6) without time zone NOT NULL,
1161 updated_at timestamp(6) without time zone NOT NULL
1166 -- Name: oauth_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1169 CREATE SEQUENCE public.oauth_applications_id_seq
1178 -- Name: oauth_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1181 ALTER SEQUENCE public.oauth_applications_id_seq OWNED BY public.oauth_applications.id;
1185 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
1188 CREATE TABLE public.oauth_nonces (
1190 nonce character varying,
1191 "timestamp" integer,
1192 created_at timestamp without time zone,
1193 updated_at timestamp without time zone
1198 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1201 CREATE SEQUENCE public.oauth_nonces_id_seq
1211 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1214 ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id;
1218 -- Name: oauth_openid_requests; Type: TABLE; Schema: public; Owner: -
1221 CREATE TABLE public.oauth_openid_requests (
1223 access_grant_id bigint NOT NULL,
1224 nonce character varying NOT NULL
1229 -- Name: oauth_openid_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1232 CREATE SEQUENCE public.oauth_openid_requests_id_seq
1241 -- Name: oauth_openid_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1244 ALTER SEQUENCE public.oauth_openid_requests_id_seq OWNED BY public.oauth_openid_requests.id;
1248 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
1251 CREATE TABLE public.oauth_tokens (
1252 id integer NOT NULL,
1254 type character varying(20),
1255 client_application_id integer,
1256 token character varying(50),
1257 secret character varying(50),
1258 authorized_at timestamp without time zone,
1259 invalidated_at timestamp without time zone,
1260 created_at timestamp without time zone,
1261 updated_at timestamp without time zone,
1262 allow_read_prefs boolean DEFAULT false NOT NULL,
1263 allow_write_prefs boolean DEFAULT false NOT NULL,
1264 allow_write_diary boolean DEFAULT false NOT NULL,
1265 allow_write_api boolean DEFAULT false NOT NULL,
1266 allow_read_gpx boolean DEFAULT false NOT NULL,
1267 allow_write_gpx boolean DEFAULT false NOT NULL,
1268 callback_url character varying,
1269 verifier character varying(20),
1270 scope character varying,
1271 valid_to timestamp without time zone,
1272 allow_write_notes boolean DEFAULT false NOT NULL
1277 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1280 CREATE SEQUENCE public.oauth_tokens_id_seq
1290 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1293 ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
1297 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1300 CREATE TABLE public.redactions (
1301 id integer NOT NULL,
1302 title character varying,
1304 created_at timestamp without time zone,
1305 updated_at timestamp without time zone,
1306 user_id bigint NOT NULL,
1307 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1312 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1315 CREATE SEQUENCE public.redactions_id_seq
1325 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1328 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1332 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1335 CREATE TABLE public.relation_members (
1336 relation_id bigint NOT NULL,
1337 member_type public.nwr_enum NOT NULL,
1338 member_id bigint NOT NULL,
1339 member_role character varying NOT NULL,
1340 version bigint DEFAULT 0 NOT NULL,
1341 sequence_id integer DEFAULT 0 NOT NULL
1346 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1349 CREATE TABLE public.relation_tags (
1350 relation_id bigint NOT NULL,
1351 k character varying DEFAULT ''::character varying NOT NULL,
1352 v character varying DEFAULT ''::character varying NOT NULL,
1353 version bigint NOT NULL
1358 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1361 CREATE TABLE public.relations (
1362 relation_id bigint NOT NULL,
1363 changeset_id bigint NOT NULL,
1364 "timestamp" timestamp without time zone NOT NULL,
1365 version bigint NOT NULL,
1366 visible boolean DEFAULT true NOT NULL,
1367 redaction_id integer
1372 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1375 CREATE TABLE public.reports (
1376 id integer NOT NULL,
1377 issue_id integer NOT NULL,
1378 user_id integer NOT NULL,
1379 details text NOT NULL,
1380 category character varying NOT NULL,
1381 created_at timestamp without time zone NOT NULL,
1382 updated_at timestamp without time zone NOT NULL
1387 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1390 CREATE SEQUENCE public.reports_id_seq
1400 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1403 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1407 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1410 CREATE TABLE public.schema_migrations (
1411 version character varying NOT NULL
1416 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1419 CREATE TABLE public.user_blocks (
1420 id integer NOT NULL,
1421 user_id bigint NOT NULL,
1422 creator_id bigint NOT NULL,
1423 reason text NOT NULL,
1424 ends_at timestamp without time zone NOT NULL,
1425 needs_view boolean DEFAULT false NOT NULL,
1427 created_at timestamp without time zone,
1428 updated_at timestamp without time zone,
1429 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1434 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1437 CREATE SEQUENCE public.user_blocks_id_seq
1447 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1450 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1454 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1457 CREATE TABLE public.user_preferences (
1458 user_id bigint NOT NULL,
1459 k character varying NOT NULL,
1460 v character varying NOT NULL
1465 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1468 CREATE TABLE public.user_roles (
1469 id integer NOT NULL,
1470 user_id bigint NOT NULL,
1471 role public.user_role_enum NOT NULL,
1472 created_at timestamp without time zone,
1473 updated_at timestamp without time zone,
1474 granter_id bigint NOT NULL
1479 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1482 CREATE SEQUENCE public.user_roles_id_seq
1492 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1495 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1499 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1502 CREATE TABLE public.user_tokens (
1504 user_id bigint NOT NULL,
1505 token character varying NOT NULL,
1506 expiry timestamp without time zone NOT NULL,
1512 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1515 CREATE SEQUENCE public.user_tokens_id_seq
1524 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1527 ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id;
1531 -- Name: users; Type: TABLE; Schema: public; Owner: -
1534 CREATE TABLE public.users (
1535 email character varying NOT NULL,
1537 pass_crypt character varying NOT NULL,
1538 creation_time timestamp without time zone NOT NULL,
1539 display_name character varying DEFAULT ''::character varying NOT NULL,
1540 data_public boolean DEFAULT false NOT NULL,
1541 description text DEFAULT ''::text NOT NULL,
1542 home_lat double precision,
1543 home_lon double precision,
1544 home_zoom smallint DEFAULT 3,
1545 pass_salt character varying,
1546 email_valid boolean DEFAULT false NOT NULL,
1547 new_email character varying,
1548 creation_ip character varying,
1549 languages character varying,
1550 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1551 terms_agreed timestamp without time zone,
1552 consider_pd boolean DEFAULT false NOT NULL,
1553 auth_uid character varying,
1554 preferred_editor character varying,
1555 terms_seen boolean DEFAULT false NOT NULL,
1556 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1557 changesets_count integer DEFAULT 0 NOT NULL,
1558 traces_count integer DEFAULT 0 NOT NULL,
1559 diary_entries_count integer DEFAULT 0 NOT NULL,
1560 image_use_gravatar boolean DEFAULT false NOT NULL,
1561 auth_provider character varying,
1563 tou_agreed timestamp without time zone
1568 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1571 CREATE SEQUENCE public.users_id_seq
1580 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1583 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1587 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1590 CREATE TABLE public.way_nodes (
1591 way_id bigint NOT NULL,
1592 node_id bigint NOT NULL,
1593 version bigint NOT NULL,
1594 sequence_id bigint NOT NULL
1599 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1602 CREATE TABLE public.way_tags (
1603 way_id bigint NOT NULL,
1604 k character varying NOT NULL,
1605 v character varying NOT NULL,
1606 version bigint NOT NULL
1611 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1614 CREATE TABLE public.ways (
1615 way_id bigint NOT NULL,
1616 changeset_id bigint NOT NULL,
1617 "timestamp" timestamp without time zone NOT NULL,
1618 version bigint NOT NULL,
1619 visible boolean DEFAULT true NOT NULL,
1620 redaction_id integer
1625 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1628 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1632 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1635 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1639 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1642 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1646 -- Name: active_storage_variant_records id; Type: DEFAULT; Schema: public; Owner: -
1649 ALTER TABLE ONLY public.active_storage_variant_records ALTER COLUMN id SET DEFAULT nextval('public.active_storage_variant_records_id_seq'::regclass);
1653 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1656 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1660 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1663 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1667 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1670 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1674 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1677 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1681 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1684 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1688 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1691 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1695 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1698 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1702 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1705 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1709 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1712 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1716 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1719 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1723 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1726 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1730 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1733 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1737 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1740 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1744 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1747 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1751 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1754 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1758 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1761 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1765 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1768 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1772 -- Name: oauth_access_grants id; Type: DEFAULT; Schema: public; Owner: -
1775 ALTER TABLE ONLY public.oauth_access_grants ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_grants_id_seq'::regclass);
1779 -- Name: oauth_access_tokens id; Type: DEFAULT; Schema: public; Owner: -
1782 ALTER TABLE ONLY public.oauth_access_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_tokens_id_seq'::regclass);
1786 -- Name: oauth_applications id; Type: DEFAULT; Schema: public; Owner: -
1789 ALTER TABLE ONLY public.oauth_applications ALTER COLUMN id SET DEFAULT nextval('public.oauth_applications_id_seq'::regclass);
1793 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1796 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1800 -- Name: oauth_openid_requests id; Type: DEFAULT; Schema: public; Owner: -
1803 ALTER TABLE ONLY public.oauth_openid_requests ALTER COLUMN id SET DEFAULT nextval('public.oauth_openid_requests_id_seq'::regclass);
1807 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1810 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1814 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1817 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1821 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1824 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1828 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1831 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1835 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1838 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1842 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1845 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1849 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1852 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1856 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1859 ALTER TABLE ONLY public.acls
1860 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1864 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1867 ALTER TABLE ONLY public.active_storage_attachments
1868 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1872 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1875 ALTER TABLE ONLY public.active_storage_blobs
1876 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1880 -- Name: active_storage_variant_records active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1883 ALTER TABLE ONLY public.active_storage_variant_records
1884 ADD CONSTRAINT active_storage_variant_records_pkey PRIMARY KEY (id);
1888 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1891 ALTER TABLE ONLY public.ar_internal_metadata
1892 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1896 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1899 ALTER TABLE ONLY public.changeset_comments
1900 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1904 -- Name: changeset_tags changeset_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1907 ALTER TABLE ONLY public.changeset_tags
1908 ADD CONSTRAINT changeset_tags_pkey PRIMARY KEY (changeset_id, k);
1912 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1915 ALTER TABLE ONLY public.changesets
1916 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1920 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1923 ALTER TABLE ONLY public.client_applications
1924 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1928 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1931 ALTER TABLE ONLY public.current_node_tags
1932 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1936 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1939 ALTER TABLE ONLY public.current_nodes
1940 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1944 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1947 ALTER TABLE ONLY public.current_relation_members
1948 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, sequence_id);
1952 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1955 ALTER TABLE ONLY public.current_relation_tags
1956 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1960 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1963 ALTER TABLE ONLY public.current_relations
1964 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1968 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1971 ALTER TABLE ONLY public.current_way_nodes
1972 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1976 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1979 ALTER TABLE ONLY public.current_way_tags
1980 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1984 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1987 ALTER TABLE ONLY public.current_ways
1988 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1992 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1995 ALTER TABLE ONLY public.delayed_jobs
1996 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
2000 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2003 ALTER TABLE ONLY public.diary_comments
2004 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
2008 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2011 ALTER TABLE ONLY public.diary_entries
2012 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
2016 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2019 ALTER TABLE ONLY public.diary_entry_subscriptions
2020 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
2024 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2027 ALTER TABLE ONLY public.friends
2028 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
2032 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2035 ALTER TABLE ONLY public.gpx_file_tags
2036 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
2040 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2043 ALTER TABLE ONLY public.gpx_files
2044 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
2048 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2051 ALTER TABLE ONLY public.issue_comments
2052 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
2056 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2059 ALTER TABLE ONLY public.issues
2060 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
2064 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2067 ALTER TABLE ONLY public.languages
2068 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
2072 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2075 ALTER TABLE ONLY public.messages
2076 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
2080 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2083 ALTER TABLE ONLY public.node_tags
2084 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
2088 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2091 ALTER TABLE ONLY public.nodes
2092 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
2096 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2099 ALTER TABLE ONLY public.note_comments
2100 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
2104 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2107 ALTER TABLE ONLY public.notes
2108 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
2112 -- Name: oauth_access_grants oauth_access_grants_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2115 ALTER TABLE ONLY public.oauth_access_grants
2116 ADD CONSTRAINT oauth_access_grants_pkey PRIMARY KEY (id);
2120 -- Name: oauth_access_tokens oauth_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2123 ALTER TABLE ONLY public.oauth_access_tokens
2124 ADD CONSTRAINT oauth_access_tokens_pkey PRIMARY KEY (id);
2128 -- Name: oauth_applications oauth_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2131 ALTER TABLE ONLY public.oauth_applications
2132 ADD CONSTRAINT oauth_applications_pkey PRIMARY KEY (id);
2136 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2139 ALTER TABLE ONLY public.oauth_nonces
2140 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
2144 -- Name: oauth_openid_requests oauth_openid_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2147 ALTER TABLE ONLY public.oauth_openid_requests
2148 ADD CONSTRAINT oauth_openid_requests_pkey PRIMARY KEY (id);
2152 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2155 ALTER TABLE ONLY public.oauth_tokens
2156 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
2160 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2163 ALTER TABLE ONLY public.redactions
2164 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
2168 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2171 ALTER TABLE ONLY public.relation_members
2172 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, sequence_id);
2176 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2179 ALTER TABLE ONLY public.relation_tags
2180 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
2184 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2187 ALTER TABLE ONLY public.relations
2188 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
2192 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2195 ALTER TABLE ONLY public.reports
2196 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
2200 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2203 ALTER TABLE ONLY public.schema_migrations
2204 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
2208 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2211 ALTER TABLE ONLY public.user_blocks
2212 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
2216 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2219 ALTER TABLE ONLY public.user_preferences
2220 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
2224 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2227 ALTER TABLE ONLY public.user_roles
2228 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
2232 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2235 ALTER TABLE ONLY public.user_tokens
2236 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
2240 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2243 ALTER TABLE ONLY public.users
2244 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2248 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2251 ALTER TABLE ONLY public.way_nodes
2252 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2256 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2259 ALTER TABLE ONLY public.way_tags
2260 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2264 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2267 ALTER TABLE ONLY public.ways
2268 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2272 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2275 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2279 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2282 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2286 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2289 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2293 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2296 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2300 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2303 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2307 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2310 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2314 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2317 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2321 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2324 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2328 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2331 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2335 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2338 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2342 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2345 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2349 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2352 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2356 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2359 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2363 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2366 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2370 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2373 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2377 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2380 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2384 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2387 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2391 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2394 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2398 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2401 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2405 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2408 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2412 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2415 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2419 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2422 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2426 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2429 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2433 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2436 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2440 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2443 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2447 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2450 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2454 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2457 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2461 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2464 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2468 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2471 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2475 -- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
2478 CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest);
2482 -- Name: index_changeset_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2485 CREATE INDEX index_changeset_comments_on_author_id_and_created_at ON public.changeset_comments USING btree (author_id, created_at);
2489 -- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2492 CREATE INDEX index_changeset_comments_on_changeset_id_and_created_at ON public.changeset_comments USING btree (changeset_id, created_at);
2496 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2499 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2503 -- Name: index_changesets_on_user_id_and_closed_at; Type: INDEX; Schema: public; Owner: -
2506 CREATE INDEX index_changesets_on_user_id_and_closed_at ON public.changesets USING btree (user_id, closed_at);
2510 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2513 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2517 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2520 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2524 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2527 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2531 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2534 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2538 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2541 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2545 -- Name: index_friends_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2548 CREATE INDEX index_friends_on_user_id_and_created_at ON public.friends USING btree (user_id, created_at);
2552 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2555 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2559 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2562 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2566 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2569 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2573 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2576 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2580 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2583 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2587 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2590 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2594 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2597 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2601 -- Name: index_note_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2604 CREATE INDEX index_note_comments_on_author_id_and_created_at ON public.note_comments USING btree (author_id, created_at);
2608 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2611 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2615 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2618 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2622 -- Name: index_oauth_access_grants_on_application_id; Type: INDEX; Schema: public; Owner: -
2625 CREATE INDEX index_oauth_access_grants_on_application_id ON public.oauth_access_grants USING btree (application_id);
2629 -- Name: index_oauth_access_grants_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2632 CREATE INDEX index_oauth_access_grants_on_resource_owner_id ON public.oauth_access_grants USING btree (resource_owner_id);
2636 -- Name: index_oauth_access_grants_on_token; Type: INDEX; Schema: public; Owner: -
2639 CREATE UNIQUE INDEX index_oauth_access_grants_on_token ON public.oauth_access_grants USING btree (token);
2643 -- Name: index_oauth_access_tokens_on_application_id; Type: INDEX; Schema: public; Owner: -
2646 CREATE INDEX index_oauth_access_tokens_on_application_id ON public.oauth_access_tokens USING btree (application_id);
2650 -- Name: index_oauth_access_tokens_on_refresh_token; Type: INDEX; Schema: public; Owner: -
2653 CREATE UNIQUE INDEX index_oauth_access_tokens_on_refresh_token ON public.oauth_access_tokens USING btree (refresh_token);
2657 -- Name: index_oauth_access_tokens_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2660 CREATE INDEX index_oauth_access_tokens_on_resource_owner_id ON public.oauth_access_tokens USING btree (resource_owner_id);
2664 -- Name: index_oauth_access_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2667 CREATE UNIQUE INDEX index_oauth_access_tokens_on_token ON public.oauth_access_tokens USING btree (token);
2671 -- Name: index_oauth_applications_on_owner_type_and_owner_id; Type: INDEX; Schema: public; Owner: -
2674 CREATE INDEX index_oauth_applications_on_owner_type_and_owner_id ON public.oauth_applications USING btree (owner_type, owner_id);
2678 -- Name: index_oauth_applications_on_uid; Type: INDEX; Schema: public; Owner: -
2681 CREATE UNIQUE INDEX index_oauth_applications_on_uid ON public.oauth_applications USING btree (uid);
2685 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2688 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2692 -- Name: index_oauth_openid_requests_on_access_grant_id; Type: INDEX; Schema: public; Owner: -
2695 CREATE INDEX index_oauth_openid_requests_on_access_grant_id ON public.oauth_openid_requests USING btree (access_grant_id);
2699 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2702 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2706 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2709 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2713 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2716 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2720 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2723 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2727 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2730 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2734 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2737 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2741 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2744 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2748 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2751 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2755 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2758 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2762 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2765 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2769 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2772 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2776 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2779 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2783 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2786 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2790 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2793 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2797 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2800 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2804 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2807 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2811 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2814 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2818 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2821 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2825 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2828 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2832 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2835 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2839 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2842 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2846 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2849 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2853 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2856 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2860 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2863 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2867 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2870 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2874 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2877 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2881 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2884 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2888 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2891 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2895 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2898 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2902 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2905 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2909 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2912 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2916 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2919 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2923 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2926 ALTER TABLE ONLY public.changeset_comments
2927 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2931 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2934 ALTER TABLE ONLY public.changeset_comments
2935 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2939 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2942 ALTER TABLE ONLY public.changeset_tags
2943 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2947 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2950 ALTER TABLE ONLY public.changesets_subscribers
2951 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2955 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2958 ALTER TABLE ONLY public.changesets_subscribers
2959 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2963 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2966 ALTER TABLE ONLY public.changesets
2967 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2971 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2974 ALTER TABLE ONLY public.client_applications
2975 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2979 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2982 ALTER TABLE ONLY public.current_node_tags
2983 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2987 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2990 ALTER TABLE ONLY public.current_nodes
2991 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2995 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2998 ALTER TABLE ONLY public.current_relation_members
2999 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
3003 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3006 ALTER TABLE ONLY public.current_relation_tags
3007 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
3011 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3014 ALTER TABLE ONLY public.current_relations
3015 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3019 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3022 ALTER TABLE ONLY public.current_way_nodes
3023 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
3027 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3030 ALTER TABLE ONLY public.current_way_nodes
3031 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
3035 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3038 ALTER TABLE ONLY public.current_way_tags
3039 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
3043 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3046 ALTER TABLE ONLY public.current_ways
3047 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3051 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3054 ALTER TABLE ONLY public.diary_comments
3055 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
3059 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3062 ALTER TABLE ONLY public.diary_comments
3063 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3067 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3070 ALTER TABLE ONLY public.diary_entries
3071 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
3075 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3078 ALTER TABLE ONLY public.diary_entries
3079 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3083 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3086 ALTER TABLE ONLY public.diary_entry_subscriptions
3087 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
3091 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3094 ALTER TABLE ONLY public.diary_entry_subscriptions
3095 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3099 -- Name: oauth_access_grants fk_rails_330c32d8d9; Type: FK CONSTRAINT; Schema: public; Owner: -
3102 ALTER TABLE ONLY public.oauth_access_grants
3103 ADD CONSTRAINT fk_rails_330c32d8d9 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3107 -- Name: oauth_access_tokens fk_rails_732cb83ab7; Type: FK CONSTRAINT; Schema: public; Owner: -
3110 ALTER TABLE ONLY public.oauth_access_tokens
3111 ADD CONSTRAINT fk_rails_732cb83ab7 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3115 -- Name: oauth_openid_requests fk_rails_77114b3b09; Type: FK CONSTRAINT; Schema: public; Owner: -
3118 ALTER TABLE ONLY public.oauth_openid_requests
3119 ADD CONSTRAINT fk_rails_77114b3b09 FOREIGN KEY (access_grant_id) REFERENCES public.oauth_access_grants(id) ON DELETE CASCADE;
3123 -- Name: active_storage_variant_records fk_rails_993965df05; Type: FK CONSTRAINT; Schema: public; Owner: -
3126 ALTER TABLE ONLY public.active_storage_variant_records
3127 ADD CONSTRAINT fk_rails_993965df05 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3131 -- Name: oauth_access_grants fk_rails_b4b53e07b8; Type: FK CONSTRAINT; Schema: public; Owner: -
3134 ALTER TABLE ONLY public.oauth_access_grants
3135 ADD CONSTRAINT fk_rails_b4b53e07b8 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3139 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
3142 ALTER TABLE ONLY public.active_storage_attachments
3143 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3147 -- Name: oauth_applications fk_rails_cc886e315a; Type: FK CONSTRAINT; Schema: public; Owner: -
3150 ALTER TABLE ONLY public.oauth_applications
3151 ADD CONSTRAINT fk_rails_cc886e315a FOREIGN KEY (owner_id) REFERENCES public.users(id) NOT VALID;
3155 -- Name: oauth_access_tokens fk_rails_ee63f25419; Type: FK CONSTRAINT; Schema: public; Owner: -
3158 ALTER TABLE ONLY public.oauth_access_tokens
3159 ADD CONSTRAINT fk_rails_ee63f25419 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3163 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3166 ALTER TABLE ONLY public.friends
3167 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
3171 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3174 ALTER TABLE ONLY public.friends
3175 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3179 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3182 ALTER TABLE ONLY public.gps_points
3183 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3187 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3190 ALTER TABLE ONLY public.gpx_file_tags
3191 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3195 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3198 ALTER TABLE ONLY public.gpx_files
3199 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3203 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3206 ALTER TABLE ONLY public.issue_comments
3207 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3211 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3214 ALTER TABLE ONLY public.issue_comments
3215 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3219 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3222 ALTER TABLE ONLY public.issues
3223 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
3227 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3230 ALTER TABLE ONLY public.issues
3231 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
3235 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3238 ALTER TABLE ONLY public.issues
3239 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
3243 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3246 ALTER TABLE ONLY public.messages
3247 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
3251 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3254 ALTER TABLE ONLY public.messages
3255 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
3259 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3262 ALTER TABLE ONLY public.node_tags
3263 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
3267 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3270 ALTER TABLE ONLY public.nodes
3271 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3275 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3278 ALTER TABLE ONLY public.nodes
3279 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3283 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3286 ALTER TABLE ONLY public.note_comments
3287 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
3291 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3294 ALTER TABLE ONLY public.note_comments
3295 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
3299 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3302 ALTER TABLE ONLY public.oauth_tokens
3303 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
3307 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3310 ALTER TABLE ONLY public.oauth_tokens
3311 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3315 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3318 ALTER TABLE ONLY public.redactions
3319 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3323 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3326 ALTER TABLE ONLY public.relation_members
3327 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3331 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3334 ALTER TABLE ONLY public.relation_tags
3335 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3339 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3342 ALTER TABLE ONLY public.relations
3343 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3347 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3350 ALTER TABLE ONLY public.relations
3351 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3355 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3358 ALTER TABLE ONLY public.reports
3359 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3363 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3366 ALTER TABLE ONLY public.reports
3367 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3371 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3374 ALTER TABLE ONLY public.user_blocks
3375 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
3379 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3382 ALTER TABLE ONLY public.user_blocks
3383 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
3387 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3390 ALTER TABLE ONLY public.user_blocks
3391 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3395 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3398 ALTER TABLE ONLY public.user_preferences
3399 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3403 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3406 ALTER TABLE ONLY public.user_roles
3407 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3411 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3414 ALTER TABLE ONLY public.user_roles
3415 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3419 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3422 ALTER TABLE ONLY public.user_tokens
3423 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3427 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3430 ALTER TABLE ONLY public.way_nodes
3431 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3435 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3438 ALTER TABLE ONLY public.way_tags
3439 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3443 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3446 ALTER TABLE ONLY public.ways
3447 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3451 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3454 ALTER TABLE ONLY public.ways
3455 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3459 -- PostgreSQL database dump complete
3462 SET search_path TO "$user", public;
3464 INSERT INTO "schema_migrations" (version) VALUES