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: public; Type: SCHEMA; Schema: -; Owner: -
16 -- *not* creating schema, since initdb creates it
20 -- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: -
23 CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public;
27 -- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: -
30 COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST';
34 -- Name: format_enum; Type: TYPE; Schema: public; Owner: -
37 CREATE TYPE public.format_enum AS ENUM (
45 -- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: -
48 CREATE TYPE public.gpx_visibility_enum AS ENUM (
57 -- Name: issue_status_enum; Type: TYPE; Schema: public; Owner: -
60 CREATE TYPE public.issue_status_enum AS ENUM (
68 -- Name: note_event_enum; Type: TYPE; Schema: public; Owner: -
71 CREATE TYPE public.note_event_enum AS ENUM (
81 -- Name: note_status_enum; Type: TYPE; Schema: public; Owner: -
84 CREATE TYPE public.note_status_enum AS ENUM (
92 -- Name: nwr_enum; Type: TYPE; Schema: public; Owner: -
95 CREATE TYPE public.nwr_enum AS ENUM (
103 -- Name: user_role_enum; Type: TYPE; Schema: public; Owner: -
106 CREATE TYPE public.user_role_enum AS ENUM (
114 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
117 CREATE TYPE public.user_status_enum AS ENUM (
127 -- Name: api_rate_limit(bigint); Type: FUNCTION; Schema: public; Owner: -
130 CREATE FUNCTION public.api_rate_limit(user_id bigint) RETURNS integer
131 LANGUAGE plpgsql STABLE
134 min_changes_per_hour int4 := 100;
135 initial_changes_per_hour int4 := 1000;
136 max_changes_per_hour int4 := 100000;
137 days_to_max_changes int4 := 7;
138 importer_changes_per_hour int4 := 1000000;
139 moderator_changes_per_hour int4 := 1000000;
141 last_block timestamp without time zone;
142 first_change timestamp without time zone;
144 time_since_first_change double precision;
145 max_changes double precision;
148 SELECT ARRAY_AGG(user_roles.role) INTO STRICT roles FROM user_roles WHERE user_roles.user_id = api_rate_limit.user_id;
150 IF 'moderator' = ANY(roles) THEN
151 max_changes := moderator_changes_per_hour;
152 ELSIF 'importer' = ANY(roles) THEN
153 max_changes := importer_changes_per_hour;
155 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;
158 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;
160 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;
164 first_change := CURRENT_TIMESTAMP AT TIME ZONE 'UTC';
167 SELECT COUNT(*) INTO STRICT active_reports
168 FROM issues INNER JOIN reports ON reports.issue_id = issues.id
169 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');
171 time_since_first_change := EXTRACT(EPOCH FROM CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - first_change);
173 max_changes := max_changes_per_hour * POWER(time_since_first_change, 2) / POWER(days_to_max_changes * 24 * 60 * 60, 2);
174 max_changes := GREATEST(initial_changes_per_hour, LEAST(max_changes_per_hour, FLOOR(max_changes)));
175 max_changes := max_changes / POWER(2, active_reports);
176 max_changes := GREATEST(min_changes_per_hour, LEAST(max_changes_per_hour, max_changes));
179 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;
181 RETURN max_changes - recent_changes;
187 -- Name: api_size_limit(bigint); Type: FUNCTION; Schema: public; Owner: -
190 CREATE FUNCTION public.api_size_limit(user_id bigint) RETURNS bigint
191 LANGUAGE plpgsql STABLE
194 min_size_limit int8 := 10000000;
195 initial_size_limit int8 := 30000000;
196 max_size_limit int8 := 5400000000;
197 days_to_max_size_limit int4 := 28;
198 importer_size_limit int8 := 5400000000;
199 moderator_size_limit int8 := 5400000000;
201 last_block timestamp without time zone;
202 first_change timestamp without time zone;
204 time_since_first_change double precision;
207 SELECT ARRAY_AGG(user_roles.role) INTO STRICT roles FROM user_roles WHERE user_roles.user_id = api_size_limit.user_id;
209 IF 'moderator' = ANY(roles) THEN
210 size_limit := moderator_size_limit;
211 ELSIF 'importer' = ANY(roles) THEN
212 size_limit := importer_size_limit;
214 SELECT user_blocks.created_at INTO last_block FROM user_blocks WHERE user_blocks.user_id = api_size_limit.user_id ORDER BY user_blocks.created_at DESC LIMIT 1;
217 SELECT changesets.created_at INTO first_change FROM changesets WHERE changesets.user_id = api_size_limit.user_id AND changesets.created_at > last_block ORDER BY changesets.created_at LIMIT 1;
219 SELECT changesets.created_at INTO first_change FROM changesets WHERE changesets.user_id = api_size_limit.user_id ORDER BY changesets.created_at LIMIT 1;
223 first_change := CURRENT_TIMESTAMP AT TIME ZONE 'UTC';
226 SELECT COUNT(*) INTO STRICT active_reports
227 FROM issues INNER JOIN reports ON reports.issue_id = issues.id
228 WHERE issues.reported_user_id = api_size_limit.user_id AND issues.status = 'open' AND reports.updated_at >= COALESCE(issues.resolved_at, '1970-01-01');
230 time_since_first_change := EXTRACT(EPOCH FROM CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - first_change);
232 size_limit := max_size_limit * POWER(time_since_first_change, 2) / POWER(days_to_max_size_limit * 24 * 60 * 60, 2);
233 size_limit := GREATEST(initial_size_limit, LEAST(max_size_limit, FLOOR(size_limit)));
234 size_limit := size_limit / POWER(2, active_reports);
235 size_limit := GREATEST(min_size_limit, LEAST(max_size_limit, size_limit));
243 SET default_tablespace = '';
245 SET default_table_access_method = heap;
248 -- Name: acls; Type: TABLE; Schema: public; Owner: -
251 CREATE TABLE public.acls (
254 k character varying NOT NULL,
256 domain character varying,
262 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
265 CREATE SEQUENCE public.acls_id_seq
274 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
277 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
281 -- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
284 CREATE TABLE public.active_storage_attachments (
286 name character varying NOT NULL,
287 record_type character varying NOT NULL,
288 record_id bigint NOT NULL,
289 blob_id bigint NOT NULL,
290 created_at timestamp without time zone NOT NULL
295 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
298 CREATE SEQUENCE public.active_storage_attachments_id_seq
307 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
310 ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
314 -- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
317 CREATE TABLE public.active_storage_blobs (
319 key character varying NOT NULL,
320 filename character varying NOT NULL,
321 content_type character varying,
323 byte_size bigint NOT NULL,
324 checksum character varying,
325 created_at timestamp without time zone NOT NULL,
326 service_name character varying NOT NULL
331 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
334 CREATE SEQUENCE public.active_storage_blobs_id_seq
343 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
346 ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
350 -- Name: active_storage_variant_records; Type: TABLE; Schema: public; Owner: -
353 CREATE TABLE public.active_storage_variant_records (
355 blob_id bigint NOT NULL,
356 variation_digest character varying NOT NULL
361 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE; Schema: public; Owner: -
364 CREATE SEQUENCE public.active_storage_variant_records_id_seq
373 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
376 ALTER SEQUENCE public.active_storage_variant_records_id_seq OWNED BY public.active_storage_variant_records.id;
380 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
383 CREATE TABLE public.ar_internal_metadata (
384 key character varying NOT NULL,
385 value character varying,
386 created_at timestamp(6) without time zone NOT NULL,
387 updated_at timestamp(6) without time zone NOT NULL
392 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
395 CREATE TABLE public.changeset_comments (
397 changeset_id bigint NOT NULL,
398 author_id bigint NOT NULL,
400 created_at timestamp without time zone NOT NULL,
401 visible boolean NOT NULL
406 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
409 CREATE SEQUENCE public.changeset_comments_id_seq
419 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
422 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
426 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
429 CREATE TABLE public.changeset_tags (
430 changeset_id bigint NOT NULL,
431 k character varying DEFAULT ''::character varying NOT NULL,
432 v character varying DEFAULT ''::character varying NOT NULL
437 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
440 CREATE TABLE public.changesets (
442 user_id bigint NOT NULL,
443 created_at timestamp without time zone NOT NULL,
448 closed_at timestamp without time zone NOT NULL,
449 num_changes integer DEFAULT 0 NOT NULL
454 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
457 CREATE SEQUENCE public.changesets_id_seq
466 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
469 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
473 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
476 CREATE TABLE public.changesets_subscribers (
477 subscriber_id bigint NOT NULL,
478 changeset_id bigint NOT NULL
483 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
486 CREATE TABLE public.current_node_tags (
487 node_id bigint NOT NULL,
488 k character varying DEFAULT ''::character varying NOT NULL,
489 v character varying DEFAULT ''::character varying NOT NULL
494 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
497 CREATE TABLE public.current_nodes (
499 latitude integer NOT NULL,
500 longitude integer NOT NULL,
501 changeset_id bigint NOT NULL,
502 visible boolean NOT NULL,
503 "timestamp" timestamp without time zone NOT NULL,
504 tile bigint NOT NULL,
505 version bigint NOT NULL
510 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
513 CREATE SEQUENCE public.current_nodes_id_seq
522 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
525 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
529 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
532 CREATE TABLE public.current_relation_members (
533 relation_id bigint NOT NULL,
534 member_type public.nwr_enum NOT NULL,
535 member_id bigint NOT NULL,
536 member_role character varying NOT NULL,
537 sequence_id integer DEFAULT 0 NOT NULL
542 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
545 CREATE TABLE public.current_relation_tags (
546 relation_id bigint NOT NULL,
547 k character varying DEFAULT ''::character varying NOT NULL,
548 v character varying DEFAULT ''::character varying NOT NULL
553 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
556 CREATE TABLE public.current_relations (
558 changeset_id bigint NOT NULL,
559 "timestamp" timestamp without time zone NOT NULL,
560 visible boolean NOT NULL,
561 version bigint NOT NULL
566 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
569 CREATE SEQUENCE public.current_relations_id_seq
578 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
581 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
585 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
588 CREATE TABLE public.current_way_nodes (
589 way_id bigint NOT NULL,
590 node_id bigint NOT NULL,
591 sequence_id bigint NOT NULL
596 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
599 CREATE TABLE public.current_way_tags (
600 way_id bigint NOT NULL,
601 k character varying DEFAULT ''::character varying NOT NULL,
602 v character varying DEFAULT ''::character varying NOT NULL
607 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
610 CREATE TABLE public.current_ways (
612 changeset_id bigint NOT NULL,
613 "timestamp" timestamp without time zone NOT NULL,
614 visible boolean NOT NULL,
615 version bigint NOT NULL
620 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
623 CREATE SEQUENCE public.current_ways_id_seq
632 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
635 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
639 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
642 CREATE TABLE public.delayed_jobs (
644 priority integer DEFAULT 0 NOT NULL,
645 attempts integer DEFAULT 0 NOT NULL,
646 handler text NOT NULL,
648 run_at timestamp without time zone,
649 locked_at timestamp without time zone,
650 failed_at timestamp without time zone,
651 locked_by character varying,
652 queue character varying,
653 created_at timestamp without time zone,
654 updated_at timestamp without time zone
659 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
662 CREATE SEQUENCE public.delayed_jobs_id_seq
671 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
674 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
678 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
681 CREATE TABLE public.diary_comments (
683 diary_entry_id bigint NOT NULL,
684 user_id bigint NOT NULL,
686 created_at timestamp without time zone NOT NULL,
687 updated_at timestamp without time zone NOT NULL,
688 visible boolean DEFAULT true NOT NULL,
689 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
694 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
697 CREATE SEQUENCE public.diary_comments_id_seq
706 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
709 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
713 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
716 CREATE TABLE public.diary_entries (
718 user_id bigint NOT NULL,
719 title character varying NOT NULL,
721 created_at timestamp without time zone NOT NULL,
722 updated_at timestamp without time zone NOT NULL,
723 latitude double precision,
724 longitude double precision,
725 language_code character varying DEFAULT 'en'::character varying NOT NULL,
726 visible boolean DEFAULT true NOT NULL,
727 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
732 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
735 CREATE SEQUENCE public.diary_entries_id_seq
744 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
747 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
751 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
754 CREATE TABLE public.diary_entry_subscriptions (
755 user_id bigint NOT NULL,
756 diary_entry_id bigint NOT NULL
761 -- Name: friends; Type: TABLE; Schema: public; Owner: -
764 CREATE TABLE public.friends (
766 user_id bigint NOT NULL,
767 friend_user_id bigint NOT NULL,
768 created_at timestamp without time zone
773 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
776 CREATE SEQUENCE public.friends_id_seq
785 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
788 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
792 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
795 CREATE TABLE public.gps_points (
796 altitude double precision,
797 trackid integer NOT NULL,
798 latitude integer NOT NULL,
799 longitude integer NOT NULL,
800 gpx_id bigint NOT NULL,
801 "timestamp" timestamp without time zone,
807 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
810 CREATE TABLE public.gpx_file_tags (
811 gpx_id bigint NOT NULL,
812 tag character varying NOT NULL,
818 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
821 CREATE SEQUENCE public.gpx_file_tags_id_seq
830 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
833 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
837 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
840 CREATE TABLE public.gpx_files (
842 user_id bigint NOT NULL,
843 visible boolean DEFAULT true NOT NULL,
844 name character varying DEFAULT ''::character varying NOT NULL,
846 latitude double precision,
847 longitude double precision,
848 "timestamp" timestamp without time zone NOT NULL,
849 description character varying DEFAULT ''::character varying NOT NULL,
850 inserted boolean NOT NULL,
851 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
856 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
859 CREATE SEQUENCE public.gpx_files_id_seq
868 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
871 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
875 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
878 CREATE TABLE public.issue_comments (
880 issue_id integer NOT NULL,
881 user_id integer NOT NULL,
883 created_at timestamp without time zone NOT NULL,
884 updated_at timestamp without time zone NOT NULL
889 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
892 CREATE SEQUENCE public.issue_comments_id_seq
902 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
905 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
909 -- Name: issues; Type: TABLE; Schema: public; Owner: -
912 CREATE TABLE public.issues (
914 reportable_type character varying NOT NULL,
915 reportable_id integer NOT NULL,
916 reported_user_id integer,
917 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
918 assigned_role public.user_role_enum NOT NULL,
919 resolved_at timestamp without time zone,
922 reports_count integer DEFAULT 0,
923 created_at timestamp without time zone NOT NULL,
924 updated_at timestamp without time zone NOT NULL
929 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
932 CREATE SEQUENCE public.issues_id_seq
942 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
945 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
949 -- Name: languages; Type: TABLE; Schema: public; Owner: -
952 CREATE TABLE public.languages (
953 code character varying NOT NULL,
954 english_name character varying NOT NULL,
955 native_name character varying
960 -- Name: messages; Type: TABLE; Schema: public; Owner: -
963 CREATE TABLE public.messages (
965 from_user_id bigint NOT NULL,
966 title character varying NOT NULL,
968 sent_on timestamp without time zone NOT NULL,
969 message_read boolean DEFAULT false NOT NULL,
970 to_user_id bigint NOT NULL,
971 to_user_visible boolean DEFAULT true NOT NULL,
972 from_user_visible boolean DEFAULT true NOT NULL,
973 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
974 muted boolean DEFAULT false NOT NULL
979 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
982 CREATE SEQUENCE public.messages_id_seq
991 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
994 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
998 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
1001 CREATE TABLE public.node_tags (
1002 node_id bigint NOT NULL,
1003 version bigint NOT NULL,
1004 k character varying DEFAULT ''::character varying NOT NULL,
1005 v character varying DEFAULT ''::character varying NOT NULL
1010 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
1013 CREATE TABLE public.nodes (
1014 node_id bigint NOT NULL,
1015 latitude integer NOT NULL,
1016 longitude integer NOT NULL,
1017 changeset_id bigint NOT NULL,
1018 visible boolean NOT NULL,
1019 "timestamp" timestamp without time zone NOT NULL,
1020 tile bigint NOT NULL,
1021 version bigint NOT NULL,
1022 redaction_id integer
1027 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
1030 CREATE TABLE public.note_comments (
1032 note_id bigint NOT NULL,
1033 visible boolean NOT NULL,
1034 created_at timestamp without time zone NOT NULL,
1038 event public.note_event_enum
1043 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1046 CREATE SEQUENCE public.note_comments_id_seq
1055 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1058 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
1062 -- Name: note_subscriptions; Type: TABLE; Schema: public; Owner: -
1065 CREATE TABLE public.note_subscriptions (
1066 user_id bigint NOT NULL,
1067 note_id bigint NOT NULL
1072 -- Name: notes; Type: TABLE; Schema: public; Owner: -
1075 CREATE TABLE public.notes (
1077 latitude integer NOT NULL,
1078 longitude integer NOT NULL,
1079 tile bigint NOT NULL,
1080 updated_at timestamp without time zone NOT NULL,
1081 created_at timestamp without time zone NOT NULL,
1082 status public.note_status_enum NOT NULL,
1083 closed_at timestamp without time zone,
1084 description text DEFAULT ''::text NOT NULL,
1091 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1094 CREATE SEQUENCE public.notes_id_seq
1103 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1106 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
1110 -- Name: oauth_access_grants; Type: TABLE; Schema: public; Owner: -
1113 CREATE TABLE public.oauth_access_grants (
1115 resource_owner_id bigint NOT NULL,
1116 application_id bigint NOT NULL,
1117 token character varying NOT NULL,
1118 expires_in integer NOT NULL,
1119 redirect_uri text NOT NULL,
1120 created_at timestamp without time zone NOT NULL,
1121 revoked_at timestamp without time zone,
1122 scopes character varying DEFAULT ''::character varying NOT NULL,
1123 code_challenge character varying,
1124 code_challenge_method character varying
1129 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1132 CREATE SEQUENCE public.oauth_access_grants_id_seq
1141 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1144 ALTER SEQUENCE public.oauth_access_grants_id_seq OWNED BY public.oauth_access_grants.id;
1148 -- Name: oauth_access_tokens; Type: TABLE; Schema: public; Owner: -
1151 CREATE TABLE public.oauth_access_tokens (
1153 resource_owner_id bigint,
1154 application_id bigint NOT NULL,
1155 token character varying NOT NULL,
1156 refresh_token character varying,
1158 revoked_at timestamp without time zone,
1159 created_at timestamp without time zone NOT NULL,
1160 scopes character varying,
1161 previous_refresh_token character varying DEFAULT ''::character varying NOT NULL
1166 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1169 CREATE SEQUENCE public.oauth_access_tokens_id_seq
1178 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1181 ALTER SEQUENCE public.oauth_access_tokens_id_seq OWNED BY public.oauth_access_tokens.id;
1185 -- Name: oauth_applications; Type: TABLE; Schema: public; Owner: -
1188 CREATE TABLE public.oauth_applications (
1190 owner_type character varying NOT NULL,
1191 owner_id bigint NOT NULL,
1192 name character varying NOT NULL,
1193 uid character varying NOT NULL,
1194 secret character varying NOT NULL,
1195 redirect_uri text NOT NULL,
1196 scopes character varying DEFAULT ''::character varying NOT NULL,
1197 confidential boolean DEFAULT true NOT NULL,
1198 created_at timestamp(6) without time zone NOT NULL,
1199 updated_at timestamp(6) without time zone NOT NULL
1204 -- Name: oauth_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1207 CREATE SEQUENCE public.oauth_applications_id_seq
1216 -- Name: oauth_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1219 ALTER SEQUENCE public.oauth_applications_id_seq OWNED BY public.oauth_applications.id;
1223 -- Name: oauth_openid_requests; Type: TABLE; Schema: public; Owner: -
1226 CREATE TABLE public.oauth_openid_requests (
1228 access_grant_id bigint NOT NULL,
1229 nonce character varying NOT NULL
1234 -- Name: oauth_openid_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1237 CREATE SEQUENCE public.oauth_openid_requests_id_seq
1246 -- Name: oauth_openid_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1249 ALTER SEQUENCE public.oauth_openid_requests_id_seq OWNED BY public.oauth_openid_requests.id;
1253 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1256 CREATE TABLE public.redactions (
1257 id integer NOT NULL,
1258 title character varying NOT NULL,
1259 description text NOT NULL,
1260 created_at timestamp without time zone,
1261 updated_at timestamp without time zone,
1262 user_id bigint NOT NULL,
1263 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1268 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1271 CREATE SEQUENCE public.redactions_id_seq
1281 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1284 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1288 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1291 CREATE TABLE public.relation_members (
1292 relation_id bigint NOT NULL,
1293 member_type public.nwr_enum NOT NULL,
1294 member_id bigint NOT NULL,
1295 member_role character varying NOT NULL,
1296 version bigint DEFAULT 0 NOT NULL,
1297 sequence_id integer DEFAULT 0 NOT NULL
1302 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1305 CREATE TABLE public.relation_tags (
1306 relation_id bigint NOT NULL,
1307 k character varying DEFAULT ''::character varying NOT NULL,
1308 v character varying DEFAULT ''::character varying NOT NULL,
1309 version bigint NOT NULL
1314 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1317 CREATE TABLE public.relations (
1318 relation_id bigint NOT NULL,
1319 changeset_id bigint NOT NULL,
1320 "timestamp" timestamp without time zone NOT NULL,
1321 version bigint NOT NULL,
1322 visible boolean DEFAULT true NOT NULL,
1323 redaction_id integer
1328 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1331 CREATE TABLE public.reports (
1332 id integer NOT NULL,
1333 issue_id integer NOT NULL,
1334 user_id integer NOT NULL,
1335 details text NOT NULL,
1336 category character varying NOT NULL,
1337 created_at timestamp without time zone NOT NULL,
1338 updated_at timestamp without time zone NOT NULL
1343 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1346 CREATE SEQUENCE public.reports_id_seq
1356 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1359 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1363 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1366 CREATE TABLE public.schema_migrations (
1367 version character varying NOT NULL
1372 -- Name: social_links; Type: TABLE; Schema: public; Owner: -
1375 CREATE TABLE public.social_links (
1377 user_id bigint NOT NULL,
1378 url character varying,
1379 created_at timestamp(6) without time zone NOT NULL,
1380 updated_at timestamp(6) without time zone NOT NULL
1385 -- Name: social_links_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1388 CREATE SEQUENCE public.social_links_id_seq
1397 -- Name: social_links_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1400 ALTER SEQUENCE public.social_links_id_seq OWNED BY public.social_links.id;
1404 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1407 CREATE TABLE public.user_blocks (
1408 id integer NOT NULL,
1409 user_id bigint NOT NULL,
1410 creator_id bigint NOT NULL,
1411 reason text NOT NULL,
1412 ends_at timestamp without time zone NOT NULL,
1413 needs_view boolean DEFAULT false NOT NULL,
1415 created_at timestamp without time zone,
1416 updated_at timestamp without time zone,
1417 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1418 deactivates_at timestamp without time zone
1423 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1426 CREATE SEQUENCE public.user_blocks_id_seq
1436 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1439 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1443 -- Name: user_mutes; Type: TABLE; Schema: public; Owner: -
1446 CREATE TABLE public.user_mutes (
1448 owner_id bigint NOT NULL,
1449 subject_id bigint NOT NULL,
1450 created_at timestamp(6) without time zone NOT NULL,
1451 updated_at timestamp(6) without time zone NOT NULL
1456 -- Name: user_mutes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1459 CREATE SEQUENCE public.user_mutes_id_seq
1468 -- Name: user_mutes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1471 ALTER SEQUENCE public.user_mutes_id_seq OWNED BY public.user_mutes.id;
1475 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1478 CREATE TABLE public.user_preferences (
1479 user_id bigint NOT NULL,
1480 k character varying NOT NULL,
1481 v character varying NOT NULL
1486 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1489 CREATE TABLE public.user_roles (
1490 id integer NOT NULL,
1491 user_id bigint NOT NULL,
1492 created_at timestamp without time zone,
1493 updated_at timestamp without time zone,
1494 role public.user_role_enum NOT NULL,
1495 granter_id bigint NOT NULL
1500 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1503 CREATE SEQUENCE public.user_roles_id_seq
1513 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1516 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1520 -- Name: users; Type: TABLE; Schema: public; Owner: -
1523 CREATE TABLE public.users (
1524 email character varying NOT NULL,
1526 pass_crypt character varying NOT NULL,
1527 creation_time timestamp without time zone NOT NULL,
1528 display_name character varying DEFAULT ''::character varying NOT NULL,
1529 data_public boolean DEFAULT false NOT NULL,
1530 description text DEFAULT ''::text NOT NULL,
1531 home_lat double precision,
1532 home_lon double precision,
1533 home_zoom smallint DEFAULT 3,
1534 pass_salt character varying,
1535 email_valid boolean DEFAULT false NOT NULL,
1536 new_email character varying,
1537 languages character varying,
1538 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1539 terms_agreed timestamp without time zone,
1540 consider_pd boolean DEFAULT false NOT NULL,
1541 auth_uid character varying,
1542 preferred_editor character varying,
1543 terms_seen boolean DEFAULT false NOT NULL,
1544 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1545 changesets_count integer DEFAULT 0 NOT NULL,
1546 traces_count integer DEFAULT 0 NOT NULL,
1547 diary_entries_count integer DEFAULT 0 NOT NULL,
1548 image_use_gravatar boolean DEFAULT false NOT NULL,
1549 auth_provider character varying,
1551 tou_agreed timestamp without time zone,
1552 diary_comments_count integer DEFAULT 0,
1553 note_comments_count integer DEFAULT 0,
1554 creation_address inet
1559 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1562 CREATE SEQUENCE public.users_id_seq
1571 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1574 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1578 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1581 CREATE TABLE public.way_nodes (
1582 way_id bigint NOT NULL,
1583 node_id bigint NOT NULL,
1584 version bigint NOT NULL,
1585 sequence_id bigint NOT NULL
1590 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1593 CREATE TABLE public.way_tags (
1594 way_id bigint NOT NULL,
1595 k character varying NOT NULL,
1596 v character varying NOT NULL,
1597 version bigint NOT NULL
1602 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1605 CREATE TABLE public.ways (
1606 way_id bigint NOT NULL,
1607 changeset_id bigint NOT NULL,
1608 "timestamp" timestamp without time zone NOT NULL,
1609 version bigint NOT NULL,
1610 visible boolean DEFAULT true NOT NULL,
1611 redaction_id integer
1616 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1619 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1623 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1626 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1630 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1633 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1637 -- Name: active_storage_variant_records id; Type: DEFAULT; Schema: public; Owner: -
1640 ALTER TABLE ONLY public.active_storage_variant_records ALTER COLUMN id SET DEFAULT nextval('public.active_storage_variant_records_id_seq'::regclass);
1644 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1647 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1651 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1654 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1658 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1661 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1665 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1668 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1672 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1675 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1679 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1682 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1686 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1689 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1693 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1696 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1700 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1703 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1707 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1710 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1714 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1717 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1721 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1724 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1728 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1731 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1735 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1738 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1742 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1745 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1749 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1752 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1756 -- Name: oauth_access_grants id; Type: DEFAULT; Schema: public; Owner: -
1759 ALTER TABLE ONLY public.oauth_access_grants ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_grants_id_seq'::regclass);
1763 -- Name: oauth_access_tokens id; Type: DEFAULT; Schema: public; Owner: -
1766 ALTER TABLE ONLY public.oauth_access_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_tokens_id_seq'::regclass);
1770 -- Name: oauth_applications id; Type: DEFAULT; Schema: public; Owner: -
1773 ALTER TABLE ONLY public.oauth_applications ALTER COLUMN id SET DEFAULT nextval('public.oauth_applications_id_seq'::regclass);
1777 -- Name: oauth_openid_requests id; Type: DEFAULT; Schema: public; Owner: -
1780 ALTER TABLE ONLY public.oauth_openid_requests ALTER COLUMN id SET DEFAULT nextval('public.oauth_openid_requests_id_seq'::regclass);
1784 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1787 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1791 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1794 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1798 -- Name: social_links id; Type: DEFAULT; Schema: public; Owner: -
1801 ALTER TABLE ONLY public.social_links ALTER COLUMN id SET DEFAULT nextval('public.social_links_id_seq'::regclass);
1805 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1808 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1812 -- Name: user_mutes id; Type: DEFAULT; Schema: public; Owner: -
1815 ALTER TABLE ONLY public.user_mutes ALTER COLUMN id SET DEFAULT nextval('public.user_mutes_id_seq'::regclass);
1819 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1822 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1826 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1829 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1833 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1836 ALTER TABLE ONLY public.acls
1837 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1841 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1844 ALTER TABLE ONLY public.active_storage_attachments
1845 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1849 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1852 ALTER TABLE ONLY public.active_storage_blobs
1853 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1857 -- Name: active_storage_variant_records active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1860 ALTER TABLE ONLY public.active_storage_variant_records
1861 ADD CONSTRAINT active_storage_variant_records_pkey PRIMARY KEY (id);
1865 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1868 ALTER TABLE ONLY public.ar_internal_metadata
1869 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1873 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1876 ALTER TABLE ONLY public.changeset_comments
1877 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1881 -- Name: changeset_tags changeset_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1884 ALTER TABLE ONLY public.changeset_tags
1885 ADD CONSTRAINT changeset_tags_pkey PRIMARY KEY (changeset_id, k);
1889 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1892 ALTER TABLE ONLY public.changesets
1893 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1897 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1900 ALTER TABLE ONLY public.current_node_tags
1901 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1905 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1908 ALTER TABLE ONLY public.current_nodes
1909 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1913 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1916 ALTER TABLE ONLY public.current_relation_members
1917 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, sequence_id);
1921 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1924 ALTER TABLE ONLY public.current_relation_tags
1925 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1929 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1932 ALTER TABLE ONLY public.current_relations
1933 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1937 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1940 ALTER TABLE ONLY public.current_way_nodes
1941 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1945 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1948 ALTER TABLE ONLY public.current_way_tags
1949 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1953 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1956 ALTER TABLE ONLY public.current_ways
1957 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1961 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1964 ALTER TABLE ONLY public.delayed_jobs
1965 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1969 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1972 ALTER TABLE ONLY public.diary_comments
1973 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1977 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1980 ALTER TABLE ONLY public.diary_entries
1981 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1985 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1988 ALTER TABLE ONLY public.diary_entry_subscriptions
1989 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1993 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1996 ALTER TABLE ONLY public.friends
1997 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
2001 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2004 ALTER TABLE ONLY public.gpx_file_tags
2005 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
2009 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2012 ALTER TABLE ONLY public.gpx_files
2013 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
2017 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2020 ALTER TABLE ONLY public.issue_comments
2021 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
2025 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2028 ALTER TABLE ONLY public.issues
2029 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
2033 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2036 ALTER TABLE ONLY public.languages
2037 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
2041 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2044 ALTER TABLE ONLY public.messages
2045 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
2049 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2052 ALTER TABLE ONLY public.node_tags
2053 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
2057 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2060 ALTER TABLE ONLY public.nodes
2061 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
2065 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2068 ALTER TABLE ONLY public.note_comments
2069 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
2073 -- Name: note_subscriptions note_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2076 ALTER TABLE ONLY public.note_subscriptions
2077 ADD CONSTRAINT note_subscriptions_pkey PRIMARY KEY (user_id, note_id);
2081 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2084 ALTER TABLE ONLY public.notes
2085 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
2089 -- Name: oauth_access_grants oauth_access_grants_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2092 ALTER TABLE ONLY public.oauth_access_grants
2093 ADD CONSTRAINT oauth_access_grants_pkey PRIMARY KEY (id);
2097 -- Name: oauth_access_tokens oauth_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2100 ALTER TABLE ONLY public.oauth_access_tokens
2101 ADD CONSTRAINT oauth_access_tokens_pkey PRIMARY KEY (id);
2105 -- Name: oauth_applications oauth_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2108 ALTER TABLE ONLY public.oauth_applications
2109 ADD CONSTRAINT oauth_applications_pkey PRIMARY KEY (id);
2113 -- Name: oauth_openid_requests oauth_openid_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2116 ALTER TABLE ONLY public.oauth_openid_requests
2117 ADD CONSTRAINT oauth_openid_requests_pkey PRIMARY KEY (id);
2121 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2124 ALTER TABLE ONLY public.redactions
2125 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
2129 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2132 ALTER TABLE ONLY public.relation_members
2133 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, sequence_id);
2137 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2140 ALTER TABLE ONLY public.relation_tags
2141 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
2145 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2148 ALTER TABLE ONLY public.relations
2149 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
2153 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2156 ALTER TABLE ONLY public.reports
2157 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
2161 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2164 ALTER TABLE ONLY public.schema_migrations
2165 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
2169 -- Name: social_links social_links_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2172 ALTER TABLE ONLY public.social_links
2173 ADD CONSTRAINT social_links_pkey PRIMARY KEY (id);
2177 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2180 ALTER TABLE ONLY public.user_blocks
2181 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
2185 -- Name: user_mutes user_mutes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2188 ALTER TABLE ONLY public.user_mutes
2189 ADD CONSTRAINT user_mutes_pkey PRIMARY KEY (id);
2193 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2196 ALTER TABLE ONLY public.user_preferences
2197 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
2201 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2204 ALTER TABLE ONLY public.user_roles
2205 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
2209 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2212 ALTER TABLE ONLY public.users
2213 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2217 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2220 ALTER TABLE ONLY public.way_nodes
2221 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2225 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2228 ALTER TABLE ONLY public.way_tags
2229 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2233 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2236 ALTER TABLE ONLY public.ways
2237 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2241 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2244 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2248 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2251 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2255 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2258 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2262 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2265 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2269 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2272 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2276 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2279 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2283 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2286 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2290 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2293 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2297 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2300 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2304 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2307 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2311 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2314 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2318 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2321 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2325 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2328 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2332 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2335 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2339 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2342 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2346 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2349 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2353 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2356 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2360 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2363 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2367 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2370 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2374 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2377 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2381 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2384 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2388 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2391 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2395 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2398 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2402 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2405 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2409 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2412 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2416 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2419 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2423 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2426 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2430 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2433 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2437 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2440 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2444 -- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
2447 CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest);
2451 -- Name: index_changeset_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2454 CREATE INDEX index_changeset_comments_on_author_id_and_created_at ON public.changeset_comments USING btree (author_id, created_at);
2458 -- Name: index_changeset_comments_on_author_id_and_id; Type: INDEX; Schema: public; Owner: -
2461 CREATE INDEX index_changeset_comments_on_author_id_and_id ON public.changeset_comments USING btree (author_id, id);
2465 -- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2468 CREATE INDEX index_changeset_comments_on_changeset_id_and_created_at ON public.changeset_comments USING btree (changeset_id, created_at);
2472 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2475 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2479 -- Name: index_changesets_on_user_id_and_closed_at; Type: INDEX; Schema: public; Owner: -
2482 CREATE INDEX index_changesets_on_user_id_and_closed_at ON public.changesets USING btree (user_id, closed_at);
2486 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2489 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2493 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2496 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2500 -- Name: index_diary_comments_on_user_id_and_id; Type: INDEX; Schema: public; Owner: -
2503 CREATE INDEX index_diary_comments_on_user_id_and_id ON public.diary_comments USING btree (user_id, id);
2507 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2510 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2514 -- Name: index_friends_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2517 CREATE INDEX index_friends_on_user_id_and_created_at ON public.friends USING btree (user_id, created_at);
2521 -- Name: index_gpx_files_on_user_id_and_id; Type: INDEX; Schema: public; Owner: -
2524 CREATE INDEX index_gpx_files_on_user_id_and_id ON public.gpx_files USING btree (user_id, id);
2528 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2531 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2535 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2538 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2542 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2545 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2549 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2552 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2556 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2559 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2563 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2566 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2570 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2573 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2577 -- Name: index_note_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2580 CREATE INDEX index_note_comments_on_author_id_and_created_at ON public.note_comments USING btree (author_id, created_at);
2584 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2587 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2591 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2594 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2598 -- Name: index_note_subscriptions_on_note_id; Type: INDEX; Schema: public; Owner: -
2601 CREATE INDEX index_note_subscriptions_on_note_id ON public.note_subscriptions USING btree (note_id);
2605 -- Name: index_notes_on_description; Type: INDEX; Schema: public; Owner: -
2608 CREATE INDEX index_notes_on_description ON public.notes USING gin (to_tsvector('english'::regconfig, description));
2612 -- Name: index_notes_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2615 CREATE INDEX index_notes_on_user_id_and_created_at ON public.notes USING btree (user_id, created_at) WHERE (user_id IS NOT NULL);
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_openid_requests_on_access_grant_id; Type: INDEX; Schema: public; Owner: -
2685 CREATE INDEX index_oauth_openid_requests_on_access_grant_id ON public.oauth_openid_requests USING btree (access_grant_id);
2689 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2692 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2696 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2699 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2703 -- Name: index_social_links_on_user_id; Type: INDEX; Schema: public; Owner: -
2706 CREATE INDEX index_social_links_on_user_id ON public.social_links USING btree (user_id);
2710 -- Name: index_user_blocks_on_creator_id_and_id; Type: INDEX; Schema: public; Owner: -
2713 CREATE INDEX index_user_blocks_on_creator_id_and_id ON public.user_blocks USING btree (creator_id, id);
2717 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2720 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2724 -- Name: index_user_mutes_on_owner_id_and_subject_id; Type: INDEX; Schema: public; Owner: -
2727 CREATE UNIQUE INDEX index_user_mutes_on_owner_id_and_subject_id ON public.user_mutes USING btree (owner_id, subject_id);
2731 -- Name: index_users_on_creation_address; Type: INDEX; Schema: public; Owner: -
2734 CREATE INDEX index_users_on_creation_address ON public.users USING gist (creation_address inet_ops);
2738 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2741 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2745 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2748 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2752 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2755 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2759 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2762 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2766 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2769 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2773 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2776 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2780 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2783 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2787 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2790 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2794 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2797 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2801 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2804 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2808 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2811 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2815 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2818 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2822 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2825 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2829 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2832 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2836 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2839 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2843 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2846 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2850 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2853 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2857 -- Name: users_display_name_canonical_idx; Type: INDEX; Schema: public; Owner: -
2860 CREATE INDEX users_display_name_canonical_idx ON public.users USING btree (lower(NORMALIZE(display_name, NFKC)));
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_email_idx; Type: INDEX; Schema: public; Owner: -
2874 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2878 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2881 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2885 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2888 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2892 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2895 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2899 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2902 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2906 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2909 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2913 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2916 ALTER TABLE ONLY public.changeset_comments
2917 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2921 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2924 ALTER TABLE ONLY public.changeset_comments
2925 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2929 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2932 ALTER TABLE ONLY public.changeset_tags
2933 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2937 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2940 ALTER TABLE ONLY public.changesets_subscribers
2941 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2945 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2948 ALTER TABLE ONLY public.changesets_subscribers
2949 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2953 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2956 ALTER TABLE ONLY public.changesets
2957 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2961 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2964 ALTER TABLE ONLY public.current_node_tags
2965 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2969 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2972 ALTER TABLE ONLY public.current_nodes
2973 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2977 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2980 ALTER TABLE ONLY public.current_relation_members
2981 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2985 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2988 ALTER TABLE ONLY public.current_relation_tags
2989 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2993 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2996 ALTER TABLE ONLY public.current_relations
2997 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3001 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3004 ALTER TABLE ONLY public.current_way_nodes
3005 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
3009 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3012 ALTER TABLE ONLY public.current_way_nodes
3013 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
3017 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3020 ALTER TABLE ONLY public.current_way_tags
3021 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
3025 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3028 ALTER TABLE ONLY public.current_ways
3029 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3033 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3036 ALTER TABLE ONLY public.diary_comments
3037 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
3041 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3044 ALTER TABLE ONLY public.diary_comments
3045 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3049 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3052 ALTER TABLE ONLY public.diary_entries
3053 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
3057 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3060 ALTER TABLE ONLY public.diary_entries
3061 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3065 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3068 ALTER TABLE ONLY public.diary_entry_subscriptions
3069 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
3073 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3076 ALTER TABLE ONLY public.diary_entry_subscriptions
3077 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3081 -- Name: note_subscriptions fk_rails_2c1913f293; Type: FK CONSTRAINT; Schema: public; Owner: -
3084 ALTER TABLE ONLY public.note_subscriptions
3085 ADD CONSTRAINT fk_rails_2c1913f293 FOREIGN KEY (note_id) REFERENCES public.notes(id);
3089 -- Name: oauth_access_grants fk_rails_330c32d8d9; Type: FK CONSTRAINT; Schema: public; Owner: -
3092 ALTER TABLE ONLY public.oauth_access_grants
3093 ADD CONSTRAINT fk_rails_330c32d8d9 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3097 -- Name: user_mutes fk_rails_591dad3359; Type: FK CONSTRAINT; Schema: public; Owner: -
3100 ALTER TABLE ONLY public.user_mutes
3101 ADD CONSTRAINT fk_rails_591dad3359 FOREIGN KEY (owner_id) REFERENCES public.users(id);
3105 -- Name: social_links fk_rails_6034fd4f62; Type: FK CONSTRAINT; Schema: public; Owner: -
3108 ALTER TABLE ONLY public.social_links
3109 ADD CONSTRAINT fk_rails_6034fd4f62 FOREIGN KEY (user_id) REFERENCES public.users(id);
3113 -- Name: oauth_access_tokens fk_rails_732cb83ab7; Type: FK CONSTRAINT; Schema: public; Owner: -
3116 ALTER TABLE ONLY public.oauth_access_tokens
3117 ADD CONSTRAINT fk_rails_732cb83ab7 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3121 -- Name: oauth_openid_requests fk_rails_77114b3b09; Type: FK CONSTRAINT; Schema: public; Owner: -
3124 ALTER TABLE ONLY public.oauth_openid_requests
3125 ADD CONSTRAINT fk_rails_77114b3b09 FOREIGN KEY (access_grant_id) REFERENCES public.oauth_access_grants(id) ON DELETE CASCADE;
3129 -- Name: active_storage_variant_records fk_rails_993965df05; Type: FK CONSTRAINT; Schema: public; Owner: -
3132 ALTER TABLE ONLY public.active_storage_variant_records
3133 ADD CONSTRAINT fk_rails_993965df05 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3137 -- Name: note_subscriptions fk_rails_a352f4eced; Type: FK CONSTRAINT; Schema: public; Owner: -
3140 ALTER TABLE ONLY public.note_subscriptions
3141 ADD CONSTRAINT fk_rails_a352f4eced FOREIGN KEY (user_id) REFERENCES public.users(id);
3145 -- Name: oauth_access_grants fk_rails_b4b53e07b8; Type: FK CONSTRAINT; Schema: public; Owner: -
3148 ALTER TABLE ONLY public.oauth_access_grants
3149 ADD CONSTRAINT fk_rails_b4b53e07b8 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3153 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
3156 ALTER TABLE ONLY public.active_storage_attachments
3157 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3161 -- Name: oauth_applications fk_rails_cc886e315a; Type: FK CONSTRAINT; Schema: public; Owner: -
3164 ALTER TABLE ONLY public.oauth_applications
3165 ADD CONSTRAINT fk_rails_cc886e315a FOREIGN KEY (owner_id) REFERENCES public.users(id) NOT VALID;
3169 -- Name: user_mutes fk_rails_e9dd4fb6c3; Type: FK CONSTRAINT; Schema: public; Owner: -
3172 ALTER TABLE ONLY public.user_mutes
3173 ADD CONSTRAINT fk_rails_e9dd4fb6c3 FOREIGN KEY (subject_id) REFERENCES public.users(id);
3177 -- Name: oauth_access_tokens fk_rails_ee63f25419; Type: FK CONSTRAINT; Schema: public; Owner: -
3180 ALTER TABLE ONLY public.oauth_access_tokens
3181 ADD CONSTRAINT fk_rails_ee63f25419 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3185 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3188 ALTER TABLE ONLY public.friends
3189 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
3193 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3196 ALTER TABLE ONLY public.friends
3197 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3201 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3204 ALTER TABLE ONLY public.gps_points
3205 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3209 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3212 ALTER TABLE ONLY public.gpx_file_tags
3213 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3217 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3220 ALTER TABLE ONLY public.gpx_files
3221 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3225 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3228 ALTER TABLE ONLY public.issue_comments
3229 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3233 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3236 ALTER TABLE ONLY public.issue_comments
3237 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3241 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3244 ALTER TABLE ONLY public.issues
3245 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
3249 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3252 ALTER TABLE ONLY public.issues
3253 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
3257 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3260 ALTER TABLE ONLY public.issues
3261 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
3265 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3268 ALTER TABLE ONLY public.messages
3269 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
3273 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3276 ALTER TABLE ONLY public.messages
3277 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
3281 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3284 ALTER TABLE ONLY public.node_tags
3285 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
3289 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3292 ALTER TABLE ONLY public.nodes
3293 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3297 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3300 ALTER TABLE ONLY public.nodes
3301 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3305 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3308 ALTER TABLE ONLY public.note_comments
3309 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
3313 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3316 ALTER TABLE ONLY public.note_comments
3317 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
3321 -- Name: notes notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3324 ALTER TABLE ONLY public.notes
3325 ADD CONSTRAINT notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3329 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3332 ALTER TABLE ONLY public.redactions
3333 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3337 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3340 ALTER TABLE ONLY public.relation_members
3341 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3345 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3348 ALTER TABLE ONLY public.relation_tags
3349 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3353 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3356 ALTER TABLE ONLY public.relations
3357 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3361 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3364 ALTER TABLE ONLY public.relations
3365 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3369 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3372 ALTER TABLE ONLY public.reports
3373 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3377 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3380 ALTER TABLE ONLY public.reports
3381 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3385 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3388 ALTER TABLE ONLY public.user_blocks
3389 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
3393 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3396 ALTER TABLE ONLY public.user_blocks
3397 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
3401 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3404 ALTER TABLE ONLY public.user_blocks
3405 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3409 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3412 ALTER TABLE ONLY public.user_preferences
3413 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3417 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3420 ALTER TABLE ONLY public.user_roles
3421 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3425 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3428 ALTER TABLE ONLY public.user_roles
3429 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3433 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3436 ALTER TABLE ONLY public.way_nodes
3437 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3441 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3444 ALTER TABLE ONLY public.way_tags
3445 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3449 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3452 ALTER TABLE ONLY public.ways
3453 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3457 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3460 ALTER TABLE ONLY public.ways
3461 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3465 -- PostgreSQL database dump complete
3468 SET search_path TO "$user", public;
3470 INSERT INTO "schema_migrations" (version) VALUES