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: postgis; Type: EXTENSION; Schema: -; Owner: -
37 CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA public;
41 -- Name: EXTENSION postgis; Type: COMMENT; Schema: -; Owner: -
44 COMMENT ON EXTENSION postgis IS 'PostGIS geometry and geography spatial types and functions';
48 -- Name: format_enum; Type: TYPE; Schema: public; Owner: -
51 CREATE TYPE public.format_enum AS ENUM (
59 -- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: -
62 CREATE TYPE public.gpx_visibility_enum AS ENUM (
71 -- Name: issue_status_enum; Type: TYPE; Schema: public; Owner: -
74 CREATE TYPE public.issue_status_enum AS ENUM (
82 -- Name: note_event_enum; Type: TYPE; Schema: public; Owner: -
85 CREATE TYPE public.note_event_enum AS ENUM (
95 -- Name: note_status_enum; Type: TYPE; Schema: public; Owner: -
98 CREATE TYPE public.note_status_enum AS ENUM (
106 -- Name: nwr_enum; Type: TYPE; Schema: public; Owner: -
109 CREATE TYPE public.nwr_enum AS ENUM (
117 -- Name: user_role_enum; Type: TYPE; Schema: public; Owner: -
120 CREATE TYPE public.user_role_enum AS ENUM (
128 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
131 CREATE TYPE public.user_status_enum AS ENUM (
141 -- Name: api_rate_limit(bigint); Type: FUNCTION; Schema: public; Owner: -
144 CREATE FUNCTION public.api_rate_limit(user_id bigint) RETURNS integer
145 LANGUAGE plpgsql STABLE
148 min_changes_per_hour int4 := 100;
149 initial_changes_per_hour int4 := 1000;
150 max_changes_per_hour int4 := 100000;
151 days_to_max_changes int4 := 7;
152 importer_changes_per_hour int4 := 1000000;
153 moderator_changes_per_hour int4 := 1000000;
155 last_block timestamp without time zone;
156 first_change timestamp without time zone;
158 time_since_first_change double precision;
159 max_changes double precision;
162 SELECT ARRAY_AGG(user_roles.role) INTO STRICT roles FROM user_roles WHERE user_roles.user_id = api_rate_limit.user_id;
164 IF 'moderator' = ANY(roles) THEN
165 max_changes := moderator_changes_per_hour;
166 ELSIF 'importer' = ANY(roles) THEN
167 max_changes := importer_changes_per_hour;
169 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;
172 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;
174 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;
178 first_change := CURRENT_TIMESTAMP AT TIME ZONE 'UTC';
181 SELECT COUNT(*) INTO STRICT active_reports
182 FROM issues INNER JOIN reports ON reports.issue_id = issues.id
183 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');
185 time_since_first_change := EXTRACT(EPOCH FROM CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - first_change);
187 max_changes := max_changes_per_hour * POWER(time_since_first_change, 2) / POWER(days_to_max_changes * 24 * 60 * 60, 2);
188 max_changes := GREATEST(initial_changes_per_hour, LEAST(max_changes_per_hour, FLOOR(max_changes)));
189 max_changes := max_changes / POWER(2, active_reports);
190 max_changes := GREATEST(min_changes_per_hour, LEAST(max_changes_per_hour, max_changes));
193 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;
195 RETURN max_changes - recent_changes;
201 -- Name: api_size_limit(bigint); Type: FUNCTION; Schema: public; Owner: -
204 CREATE FUNCTION public.api_size_limit(user_id bigint) RETURNS bigint
205 LANGUAGE plpgsql STABLE
208 min_size_limit int8 := 10000000;
209 initial_size_limit int8 := 30000000;
210 max_size_limit int8 := 5400000000;
211 days_to_max_size_limit int4 := 28;
212 importer_size_limit int8 := 5400000000;
213 moderator_size_limit int8 := 5400000000;
215 last_block timestamp without time zone;
216 first_change timestamp without time zone;
218 time_since_first_change double precision;
221 SELECT ARRAY_AGG(user_roles.role) INTO STRICT roles FROM user_roles WHERE user_roles.user_id = api_size_limit.user_id;
223 IF 'moderator' = ANY(roles) THEN
224 size_limit := moderator_size_limit;
225 ELSIF 'importer' = ANY(roles) THEN
226 size_limit := importer_size_limit;
228 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;
231 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;
233 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;
237 first_change := CURRENT_TIMESTAMP AT TIME ZONE 'UTC';
240 SELECT COUNT(*) INTO STRICT active_reports
241 FROM issues INNER JOIN reports ON reports.issue_id = issues.id
242 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');
244 time_since_first_change := EXTRACT(EPOCH FROM CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - first_change);
246 size_limit := max_size_limit * POWER(time_since_first_change, 2) / POWER(days_to_max_size_limit * 24 * 60 * 60, 2);
247 size_limit := GREATEST(initial_size_limit, LEAST(max_size_limit, FLOOR(size_limit)));
248 size_limit := size_limit / POWER(2, active_reports);
249 size_limit := GREATEST(min_size_limit, LEAST(max_size_limit, size_limit));
257 SET default_tablespace = '';
259 SET default_table_access_method = heap;
262 -- Name: acls; Type: TABLE; Schema: public; Owner: -
265 CREATE TABLE public.acls (
268 k character varying NOT NULL,
270 domain character varying,
276 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
279 CREATE SEQUENCE public.acls_id_seq
288 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
291 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
295 -- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
298 CREATE TABLE public.active_storage_attachments (
300 name character varying NOT NULL,
301 record_type character varying NOT NULL,
302 record_id bigint NOT NULL,
303 blob_id bigint NOT NULL,
304 created_at timestamp without time zone NOT NULL
309 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
312 CREATE SEQUENCE public.active_storage_attachments_id_seq
321 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
324 ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
328 -- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
331 CREATE TABLE public.active_storage_blobs (
333 key character varying NOT NULL,
334 filename character varying NOT NULL,
335 content_type character varying,
337 byte_size bigint NOT NULL,
338 checksum character varying,
339 created_at timestamp without time zone NOT NULL,
340 service_name character varying NOT NULL
345 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
348 CREATE SEQUENCE public.active_storage_blobs_id_seq
357 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
360 ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
364 -- Name: active_storage_variant_records; Type: TABLE; Schema: public; Owner: -
367 CREATE TABLE public.active_storage_variant_records (
369 blob_id bigint NOT NULL,
370 variation_digest character varying NOT NULL
375 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE; Schema: public; Owner: -
378 CREATE SEQUENCE public.active_storage_variant_records_id_seq
387 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
390 ALTER SEQUENCE public.active_storage_variant_records_id_seq OWNED BY public.active_storage_variant_records.id;
394 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
397 CREATE TABLE public.ar_internal_metadata (
398 key character varying NOT NULL,
399 value character varying,
400 created_at timestamp(6) without time zone NOT NULL,
401 updated_at timestamp(6) without time zone NOT NULL
406 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
409 CREATE TABLE public.changeset_comments (
411 changeset_id bigint NOT NULL,
412 author_id bigint NOT NULL,
414 created_at timestamp without time zone NOT NULL,
415 visible boolean NOT NULL
420 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
423 CREATE SEQUENCE public.changeset_comments_id_seq
433 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
436 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
440 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
443 CREATE TABLE public.changeset_tags (
444 changeset_id bigint NOT NULL,
445 k character varying DEFAULT ''::character varying NOT NULL,
446 v character varying DEFAULT ''::character varying NOT NULL
451 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
454 CREATE TABLE public.changesets (
456 user_id bigint NOT NULL,
457 created_at timestamp without time zone NOT NULL,
462 closed_at timestamp without time zone NOT NULL,
463 num_changes integer DEFAULT 0 NOT NULL,
464 num_created_nodes integer DEFAULT 0 NOT NULL,
465 num_modified_nodes integer DEFAULT 0 NOT NULL,
466 num_deleted_nodes integer DEFAULT 0 NOT NULL,
467 num_created_ways integer DEFAULT 0 NOT NULL,
468 num_modified_ways integer DEFAULT 0 NOT NULL,
469 num_deleted_ways integer DEFAULT 0 NOT NULL,
470 num_created_relations integer DEFAULT 0 NOT NULL,
471 num_modified_relations integer DEFAULT 0 NOT NULL,
472 num_deleted_relations integer DEFAULT 0 NOT NULL
477 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
480 CREATE SEQUENCE public.changesets_id_seq
489 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
492 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
496 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
499 CREATE TABLE public.changesets_subscribers (
500 subscriber_id bigint NOT NULL,
501 changeset_id bigint NOT NULL
506 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
509 CREATE TABLE public.current_node_tags (
510 node_id bigint NOT NULL,
511 k character varying DEFAULT ''::character varying NOT NULL,
512 v character varying DEFAULT ''::character varying NOT NULL
517 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
520 CREATE TABLE public.current_nodes (
522 latitude integer NOT NULL,
523 longitude integer NOT NULL,
524 changeset_id bigint NOT NULL,
525 visible boolean NOT NULL,
526 "timestamp" timestamp without time zone NOT NULL,
527 tile bigint NOT NULL,
528 version bigint NOT NULL
533 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
536 CREATE SEQUENCE public.current_nodes_id_seq
545 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
548 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
552 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
555 CREATE TABLE public.current_relation_members (
556 relation_id bigint NOT NULL,
557 member_type public.nwr_enum NOT NULL,
558 member_id bigint NOT NULL,
559 member_role character varying NOT NULL,
560 sequence_id integer DEFAULT 0 NOT NULL
565 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
568 CREATE TABLE public.current_relation_tags (
569 relation_id bigint NOT NULL,
570 k character varying DEFAULT ''::character varying NOT NULL,
571 v character varying DEFAULT ''::character varying NOT NULL
576 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
579 CREATE TABLE public.current_relations (
581 changeset_id bigint NOT NULL,
582 "timestamp" timestamp without time zone NOT NULL,
583 visible boolean NOT NULL,
584 version bigint NOT NULL
589 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
592 CREATE SEQUENCE public.current_relations_id_seq
601 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
604 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
608 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
611 CREATE TABLE public.current_way_nodes (
612 way_id bigint NOT NULL,
613 node_id bigint NOT NULL,
614 sequence_id bigint NOT NULL
619 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
622 CREATE TABLE public.current_way_tags (
623 way_id bigint NOT NULL,
624 k character varying DEFAULT ''::character varying NOT NULL,
625 v character varying DEFAULT ''::character varying NOT NULL
630 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
633 CREATE TABLE public.current_ways (
635 changeset_id bigint NOT NULL,
636 "timestamp" timestamp without time zone NOT NULL,
637 visible boolean NOT NULL,
638 version bigint NOT NULL
643 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
646 CREATE SEQUENCE public.current_ways_id_seq
655 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
658 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
662 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
665 CREATE TABLE public.delayed_jobs (
667 priority integer DEFAULT 0 NOT NULL,
668 attempts integer DEFAULT 0 NOT NULL,
669 handler text NOT NULL,
671 run_at timestamp without time zone,
672 locked_at timestamp without time zone,
673 failed_at timestamp without time zone,
674 locked_by character varying,
675 queue character varying,
676 created_at timestamp without time zone,
677 updated_at timestamp without time zone
682 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
685 CREATE SEQUENCE public.delayed_jobs_id_seq
694 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
697 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
701 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
704 CREATE TABLE public.diary_comments (
706 diary_entry_id bigint NOT NULL,
707 user_id bigint NOT NULL,
709 created_at timestamp without time zone NOT NULL,
710 updated_at timestamp without time zone NOT NULL,
711 visible boolean DEFAULT true NOT NULL,
712 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
717 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
720 CREATE SEQUENCE public.diary_comments_id_seq
729 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
732 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
736 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
739 CREATE TABLE public.diary_entries (
741 user_id bigint NOT NULL,
742 title character varying NOT NULL,
744 created_at timestamp without time zone NOT NULL,
745 updated_at timestamp without time zone NOT NULL,
746 latitude double precision,
747 longitude double precision,
748 language_code character varying DEFAULT 'en'::character varying NOT NULL,
749 visible boolean DEFAULT true NOT NULL,
750 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
755 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
758 CREATE SEQUENCE public.diary_entries_id_seq
767 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
770 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
774 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
777 CREATE TABLE public.diary_entry_subscriptions (
778 user_id bigint NOT NULL,
779 diary_entry_id bigint NOT NULL
784 -- Name: friends; Type: TABLE; Schema: public; Owner: -
787 CREATE TABLE public.friends (
789 user_id bigint NOT NULL,
790 friend_user_id bigint NOT NULL,
791 created_at timestamp without time zone
796 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
799 CREATE SEQUENCE public.friends_id_seq
808 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
811 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
815 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
818 CREATE TABLE public.gps_points (
819 altitude double precision,
820 trackid integer NOT NULL,
821 latitude integer NOT NULL,
822 longitude integer NOT NULL,
823 gpx_id bigint NOT NULL,
824 "timestamp" timestamp without time zone,
830 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
833 CREATE TABLE public.gpx_file_tags (
834 gpx_id bigint NOT NULL,
835 tag character varying NOT NULL,
841 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
844 CREATE SEQUENCE public.gpx_file_tags_id_seq
853 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
856 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
860 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
863 CREATE TABLE public.gpx_files (
865 user_id bigint NOT NULL,
866 visible boolean DEFAULT true NOT NULL,
867 name character varying DEFAULT ''::character varying NOT NULL,
869 latitude double precision,
870 longitude double precision,
871 "timestamp" timestamp without time zone NOT NULL,
872 description character varying DEFAULT ''::character varying NOT NULL,
873 inserted boolean NOT NULL,
874 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
879 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
882 CREATE SEQUENCE public.gpx_files_id_seq
891 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
894 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
898 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
901 CREATE TABLE public.issue_comments (
903 issue_id integer NOT NULL,
904 user_id integer NOT NULL,
906 created_at timestamp without time zone NOT NULL,
907 updated_at timestamp without time zone NOT NULL
912 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
915 CREATE SEQUENCE public.issue_comments_id_seq
925 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
928 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
932 -- Name: issues; Type: TABLE; Schema: public; Owner: -
935 CREATE TABLE public.issues (
937 reportable_type character varying NOT NULL,
938 reportable_id integer NOT NULL,
939 reported_user_id integer,
940 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
941 assigned_role public.user_role_enum NOT NULL,
942 resolved_at timestamp without time zone,
945 reports_count integer DEFAULT 0,
946 created_at timestamp without time zone NOT NULL,
947 updated_at timestamp without time zone NOT NULL
952 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
955 CREATE SEQUENCE public.issues_id_seq
965 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
968 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
972 -- Name: languages; Type: TABLE; Schema: public; Owner: -
975 CREATE TABLE public.languages (
976 code character varying NOT NULL,
977 english_name character varying NOT NULL,
978 native_name character varying
983 -- Name: messages; Type: TABLE; Schema: public; Owner: -
986 CREATE TABLE public.messages (
988 from_user_id bigint NOT NULL,
989 title character varying NOT NULL,
991 sent_on timestamp without time zone NOT NULL,
992 message_read boolean DEFAULT false NOT NULL,
993 to_user_id bigint NOT NULL,
994 to_user_visible boolean DEFAULT true NOT NULL,
995 from_user_visible boolean DEFAULT true NOT NULL,
996 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
997 muted boolean DEFAULT false NOT NULL
1002 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1005 CREATE SEQUENCE public.messages_id_seq
1014 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1017 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
1021 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
1024 CREATE TABLE public.node_tags (
1025 node_id bigint NOT NULL,
1026 version bigint NOT NULL,
1027 k character varying DEFAULT ''::character varying NOT NULL,
1028 v character varying DEFAULT ''::character varying NOT NULL
1033 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
1036 CREATE TABLE public.nodes (
1037 node_id bigint NOT NULL,
1038 latitude integer NOT NULL,
1039 longitude integer NOT NULL,
1040 changeset_id bigint NOT NULL,
1041 visible boolean NOT NULL,
1042 "timestamp" timestamp without time zone NOT NULL,
1043 tile bigint NOT NULL,
1044 version bigint NOT NULL,
1045 redaction_id integer
1050 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
1053 CREATE TABLE public.note_comments (
1055 note_id bigint NOT NULL,
1056 visible boolean NOT NULL,
1057 created_at timestamp without time zone NOT NULL,
1061 event public.note_event_enum
1066 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1069 CREATE SEQUENCE public.note_comments_id_seq
1078 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1081 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
1085 -- Name: note_subscriptions; Type: TABLE; Schema: public; Owner: -
1088 CREATE TABLE public.note_subscriptions (
1089 user_id bigint NOT NULL,
1090 note_id bigint NOT NULL
1095 -- Name: notes; Type: TABLE; Schema: public; Owner: -
1098 CREATE TABLE public.notes (
1100 latitude integer NOT NULL,
1101 longitude integer NOT NULL,
1102 tile bigint NOT NULL,
1103 updated_at timestamp without time zone NOT NULL,
1104 created_at timestamp without time zone NOT NULL,
1105 status public.note_status_enum NOT NULL,
1106 closed_at timestamp without time zone,
1107 description text DEFAULT ''::text NOT NULL,
1114 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1117 CREATE SEQUENCE public.notes_id_seq
1126 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1129 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
1133 -- Name: noticed_events; Type: TABLE; Schema: public; Owner: -
1136 CREATE TABLE public.noticed_events (
1138 type character varying,
1139 record_type character varying,
1141 notifications_count integer,
1143 created_at timestamp(6) without time zone NOT NULL,
1144 updated_at timestamp(6) without time zone NOT NULL
1149 -- Name: noticed_events_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1152 CREATE SEQUENCE public.noticed_events_id_seq
1161 -- Name: noticed_events_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1164 ALTER SEQUENCE public.noticed_events_id_seq OWNED BY public.noticed_events.id;
1168 -- Name: noticed_notifications; Type: TABLE; Schema: public; Owner: -
1171 CREATE TABLE public.noticed_notifications (
1173 type character varying,
1174 event_id bigint NOT NULL,
1175 recipient_type character varying NOT NULL,
1176 recipient_id bigint NOT NULL,
1177 read_at timestamp(6) without time zone,
1178 seen_at timestamp(6) without time zone,
1179 created_at timestamp(6) without time zone NOT NULL,
1180 updated_at timestamp(6) without time zone NOT NULL
1185 -- Name: noticed_notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1188 CREATE SEQUENCE public.noticed_notifications_id_seq
1197 -- Name: noticed_notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1200 ALTER SEQUENCE public.noticed_notifications_id_seq OWNED BY public.noticed_notifications.id;
1204 -- Name: oauth_access_grants; Type: TABLE; Schema: public; Owner: -
1207 CREATE TABLE public.oauth_access_grants (
1209 resource_owner_id bigint NOT NULL,
1210 application_id bigint NOT NULL,
1211 token character varying NOT NULL,
1212 expires_in integer NOT NULL,
1213 redirect_uri text NOT NULL,
1214 created_at timestamp without time zone NOT NULL,
1215 revoked_at timestamp without time zone,
1216 scopes character varying DEFAULT ''::character varying NOT NULL,
1217 code_challenge character varying,
1218 code_challenge_method character varying
1223 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1226 CREATE SEQUENCE public.oauth_access_grants_id_seq
1235 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1238 ALTER SEQUENCE public.oauth_access_grants_id_seq OWNED BY public.oauth_access_grants.id;
1242 -- Name: oauth_access_tokens; Type: TABLE; Schema: public; Owner: -
1245 CREATE TABLE public.oauth_access_tokens (
1247 resource_owner_id bigint,
1248 application_id bigint NOT NULL,
1249 token character varying NOT NULL,
1250 refresh_token character varying,
1252 revoked_at timestamp without time zone,
1253 created_at timestamp without time zone NOT NULL,
1254 scopes character varying,
1255 previous_refresh_token character varying DEFAULT ''::character varying NOT NULL
1260 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1263 CREATE SEQUENCE public.oauth_access_tokens_id_seq
1272 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1275 ALTER SEQUENCE public.oauth_access_tokens_id_seq OWNED BY public.oauth_access_tokens.id;
1279 -- Name: oauth_applications; Type: TABLE; Schema: public; Owner: -
1282 CREATE TABLE public.oauth_applications (
1284 owner_type character varying NOT NULL,
1285 owner_id bigint NOT NULL,
1286 name character varying NOT NULL,
1287 uid character varying NOT NULL,
1288 secret character varying NOT NULL,
1289 redirect_uri text NOT NULL,
1290 scopes character varying DEFAULT ''::character varying NOT NULL,
1291 confidential boolean DEFAULT true NOT NULL,
1292 created_at timestamp(6) without time zone NOT NULL,
1293 updated_at timestamp(6) without time zone NOT NULL
1298 -- Name: oauth_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1301 CREATE SEQUENCE public.oauth_applications_id_seq
1310 -- Name: oauth_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1313 ALTER SEQUENCE public.oauth_applications_id_seq OWNED BY public.oauth_applications.id;
1317 -- Name: oauth_openid_requests; Type: TABLE; Schema: public; Owner: -
1320 CREATE TABLE public.oauth_openid_requests (
1322 access_grant_id bigint NOT NULL,
1323 nonce character varying NOT NULL
1328 -- Name: oauth_openid_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1331 CREATE SEQUENCE public.oauth_openid_requests_id_seq
1340 -- Name: oauth_openid_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1343 ALTER SEQUENCE public.oauth_openid_requests_id_seq OWNED BY public.oauth_openid_requests.id;
1347 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1350 CREATE TABLE public.redactions (
1351 id integer NOT NULL,
1352 title character varying NOT NULL,
1353 description text NOT NULL,
1354 created_at timestamp without time zone,
1355 updated_at timestamp without time zone,
1356 user_id bigint NOT NULL,
1357 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1362 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1365 CREATE SEQUENCE public.redactions_id_seq
1375 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1378 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1382 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1385 CREATE TABLE public.relation_members (
1386 relation_id bigint NOT NULL,
1387 member_type public.nwr_enum NOT NULL,
1388 member_id bigint NOT NULL,
1389 member_role character varying NOT NULL,
1390 version bigint DEFAULT 0 NOT NULL,
1391 sequence_id integer DEFAULT 0 NOT NULL
1396 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1399 CREATE TABLE public.relation_tags (
1400 relation_id bigint NOT NULL,
1401 k character varying DEFAULT ''::character varying NOT NULL,
1402 v character varying DEFAULT ''::character varying NOT NULL,
1403 version bigint NOT NULL
1408 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1411 CREATE TABLE public.relations (
1412 relation_id bigint NOT NULL,
1413 changeset_id bigint NOT NULL,
1414 "timestamp" timestamp without time zone NOT NULL,
1415 version bigint NOT NULL,
1416 visible boolean DEFAULT true NOT NULL,
1417 redaction_id integer
1422 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1425 CREATE TABLE public.reports (
1426 id integer NOT NULL,
1427 issue_id integer NOT NULL,
1428 user_id integer NOT NULL,
1429 details text NOT NULL,
1430 category character varying NOT NULL,
1431 created_at timestamp without time zone NOT NULL,
1432 updated_at timestamp without time zone NOT NULL
1437 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1440 CREATE SEQUENCE public.reports_id_seq
1450 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1453 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1457 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1460 CREATE TABLE public.schema_migrations (
1461 version character varying NOT NULL
1466 -- Name: social_links; Type: TABLE; Schema: public; Owner: -
1469 CREATE TABLE public.social_links (
1471 user_id bigint NOT NULL,
1472 url character varying NOT NULL,
1473 created_at timestamp(6) without time zone NOT NULL,
1474 updated_at timestamp(6) without time zone NOT NULL
1479 -- Name: social_links_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1482 CREATE SEQUENCE public.social_links_id_seq
1491 -- Name: social_links_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1494 ALTER SEQUENCE public.social_links_id_seq OWNED BY public.social_links.id;
1498 -- Name: spammy_phrases; Type: TABLE; Schema: public; Owner: -
1501 CREATE TABLE public.spammy_phrases (
1503 phrase character varying,
1504 created_at timestamp(6) without time zone NOT NULL,
1505 updated_at timestamp(6) without time zone NOT NULL
1510 -- Name: spammy_phrases_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1513 CREATE SEQUENCE public.spammy_phrases_id_seq
1522 -- Name: spammy_phrases_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1525 ALTER SEQUENCE public.spammy_phrases_id_seq OWNED BY public.spammy_phrases.id;
1529 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1532 CREATE TABLE public.user_blocks (
1533 id integer NOT NULL,
1534 user_id bigint NOT NULL,
1535 creator_id bigint NOT NULL,
1536 reason text NOT NULL,
1537 ends_at timestamp without time zone NOT NULL,
1538 needs_view boolean DEFAULT false NOT NULL,
1540 created_at timestamp without time zone,
1541 updated_at timestamp without time zone,
1542 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1543 deactivates_at timestamp without time zone
1548 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1551 CREATE SEQUENCE public.user_blocks_id_seq
1561 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1564 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1568 -- Name: user_mutes; Type: TABLE; Schema: public; Owner: -
1571 CREATE TABLE public.user_mutes (
1573 owner_id bigint NOT NULL,
1574 subject_id bigint NOT NULL,
1575 created_at timestamp(6) without time zone NOT NULL,
1576 updated_at timestamp(6) without time zone NOT NULL
1581 -- Name: user_mutes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1584 CREATE SEQUENCE public.user_mutes_id_seq
1593 -- Name: user_mutes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1596 ALTER SEQUENCE public.user_mutes_id_seq OWNED BY public.user_mutes.id;
1600 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1603 CREATE TABLE public.user_preferences (
1604 user_id bigint NOT NULL,
1605 k character varying NOT NULL,
1606 v character varying NOT NULL
1611 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1614 CREATE TABLE public.user_roles (
1615 id integer NOT NULL,
1616 user_id bigint NOT NULL,
1617 role public.user_role_enum NOT NULL,
1618 created_at timestamp without time zone,
1619 updated_at timestamp without time zone,
1620 granter_id bigint NOT NULL
1625 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1628 CREATE SEQUENCE public.user_roles_id_seq
1638 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1641 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1645 -- Name: users; Type: TABLE; Schema: public; Owner: -
1648 CREATE TABLE public.users (
1649 email character varying NOT NULL,
1651 pass_crypt character varying NOT NULL,
1652 creation_time timestamp without time zone NOT NULL,
1653 display_name character varying DEFAULT ''::character varying NOT NULL,
1654 data_public boolean DEFAULT false NOT NULL,
1655 description text DEFAULT ''::text NOT NULL,
1656 home_lat double precision,
1657 home_lon double precision,
1658 home_zoom smallint DEFAULT 3,
1659 pass_salt character varying,
1660 email_valid boolean DEFAULT false NOT NULL,
1661 new_email character varying,
1662 languages character varying,
1663 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1664 terms_agreed timestamp without time zone,
1665 consider_pd boolean DEFAULT false NOT NULL,
1666 auth_uid character varying,
1667 preferred_editor character varying,
1668 terms_seen boolean DEFAULT false NOT NULL,
1669 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1670 changesets_count integer DEFAULT 0 NOT NULL,
1671 traces_count integer DEFAULT 0 NOT NULL,
1672 diary_entries_count integer DEFAULT 0 NOT NULL,
1673 image_use_gravatar boolean DEFAULT false NOT NULL,
1674 auth_provider character varying,
1676 tou_agreed timestamp without time zone,
1677 diary_comments_count integer DEFAULT 0,
1678 note_comments_count integer DEFAULT 0,
1679 creation_address inet,
1680 home_location_name character varying,
1681 company character varying,
1682 public_heatmap boolean DEFAULT true NOT NULL
1687 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1690 CREATE SEQUENCE public.users_id_seq
1699 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1702 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1706 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1709 CREATE TABLE public.way_nodes (
1710 way_id bigint NOT NULL,
1711 node_id bigint NOT NULL,
1712 version bigint NOT NULL,
1713 sequence_id bigint NOT NULL
1718 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1721 CREATE TABLE public.way_tags (
1722 way_id bigint NOT NULL,
1723 k character varying NOT NULL,
1724 v character varying NOT NULL,
1725 version bigint NOT NULL
1730 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1733 CREATE TABLE public.ways (
1734 way_id bigint NOT NULL,
1735 changeset_id bigint NOT NULL,
1736 "timestamp" timestamp without time zone NOT NULL,
1737 version bigint NOT NULL,
1738 visible boolean DEFAULT true NOT NULL,
1739 redaction_id integer
1744 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1747 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1751 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1754 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1758 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1761 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1765 -- Name: active_storage_variant_records id; Type: DEFAULT; Schema: public; Owner: -
1768 ALTER TABLE ONLY public.active_storage_variant_records ALTER COLUMN id SET DEFAULT nextval('public.active_storage_variant_records_id_seq'::regclass);
1772 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1775 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1779 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1782 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1786 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1789 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1793 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1796 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1800 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1803 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1807 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1810 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1814 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1817 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1821 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1824 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1828 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1831 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1835 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1838 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1842 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1845 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1849 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1852 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1856 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1859 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1863 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1866 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1870 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1873 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1877 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1880 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1884 -- Name: noticed_events id; Type: DEFAULT; Schema: public; Owner: -
1887 ALTER TABLE ONLY public.noticed_events ALTER COLUMN id SET DEFAULT nextval('public.noticed_events_id_seq'::regclass);
1891 -- Name: noticed_notifications id; Type: DEFAULT; Schema: public; Owner: -
1894 ALTER TABLE ONLY public.noticed_notifications ALTER COLUMN id SET DEFAULT nextval('public.noticed_notifications_id_seq'::regclass);
1898 -- Name: oauth_access_grants id; Type: DEFAULT; Schema: public; Owner: -
1901 ALTER TABLE ONLY public.oauth_access_grants ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_grants_id_seq'::regclass);
1905 -- Name: oauth_access_tokens id; Type: DEFAULT; Schema: public; Owner: -
1908 ALTER TABLE ONLY public.oauth_access_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_tokens_id_seq'::regclass);
1912 -- Name: oauth_applications id; Type: DEFAULT; Schema: public; Owner: -
1915 ALTER TABLE ONLY public.oauth_applications ALTER COLUMN id SET DEFAULT nextval('public.oauth_applications_id_seq'::regclass);
1919 -- Name: oauth_openid_requests id; Type: DEFAULT; Schema: public; Owner: -
1922 ALTER TABLE ONLY public.oauth_openid_requests ALTER COLUMN id SET DEFAULT nextval('public.oauth_openid_requests_id_seq'::regclass);
1926 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1929 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1933 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1936 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1940 -- Name: social_links id; Type: DEFAULT; Schema: public; Owner: -
1943 ALTER TABLE ONLY public.social_links ALTER COLUMN id SET DEFAULT nextval('public.social_links_id_seq'::regclass);
1947 -- Name: spammy_phrases id; Type: DEFAULT; Schema: public; Owner: -
1950 ALTER TABLE ONLY public.spammy_phrases ALTER COLUMN id SET DEFAULT nextval('public.spammy_phrases_id_seq'::regclass);
1954 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1957 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1961 -- Name: user_mutes id; Type: DEFAULT; Schema: public; Owner: -
1964 ALTER TABLE ONLY public.user_mutes ALTER COLUMN id SET DEFAULT nextval('public.user_mutes_id_seq'::regclass);
1968 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1971 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1975 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1978 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1982 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1985 ALTER TABLE ONLY public.acls
1986 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1990 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1993 ALTER TABLE ONLY public.active_storage_attachments
1994 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1998 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2001 ALTER TABLE ONLY public.active_storage_blobs
2002 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
2006 -- Name: active_storage_variant_records active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2009 ALTER TABLE ONLY public.active_storage_variant_records
2010 ADD CONSTRAINT active_storage_variant_records_pkey PRIMARY KEY (id);
2014 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2017 ALTER TABLE ONLY public.ar_internal_metadata
2018 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
2022 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2025 ALTER TABLE ONLY public.changeset_comments
2026 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
2030 -- Name: changeset_tags changeset_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2033 ALTER TABLE ONLY public.changeset_tags
2034 ADD CONSTRAINT changeset_tags_pkey PRIMARY KEY (changeset_id, k);
2038 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2041 ALTER TABLE ONLY public.changesets
2042 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
2046 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2049 ALTER TABLE ONLY public.current_node_tags
2050 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
2054 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
2057 ALTER TABLE ONLY public.current_nodes
2058 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
2062 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2065 ALTER TABLE ONLY public.current_relation_members
2066 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, sequence_id);
2070 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2073 ALTER TABLE ONLY public.current_relation_tags
2074 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
2078 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2081 ALTER TABLE ONLY public.current_relations
2082 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
2086 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2089 ALTER TABLE ONLY public.current_way_nodes
2090 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
2094 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2097 ALTER TABLE ONLY public.current_way_tags
2098 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
2102 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2105 ALTER TABLE ONLY public.current_ways
2106 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
2110 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2113 ALTER TABLE ONLY public.delayed_jobs
2114 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
2118 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2121 ALTER TABLE ONLY public.diary_comments
2122 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
2126 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2129 ALTER TABLE ONLY public.diary_entries
2130 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
2134 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2137 ALTER TABLE ONLY public.diary_entry_subscriptions
2138 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
2142 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2145 ALTER TABLE ONLY public.friends
2146 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
2150 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2153 ALTER TABLE ONLY public.gpx_file_tags
2154 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
2158 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2161 ALTER TABLE ONLY public.gpx_files
2162 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
2166 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2169 ALTER TABLE ONLY public.issue_comments
2170 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
2174 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2177 ALTER TABLE ONLY public.issues
2178 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
2182 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2185 ALTER TABLE ONLY public.languages
2186 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
2190 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2193 ALTER TABLE ONLY public.messages
2194 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
2198 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2201 ALTER TABLE ONLY public.node_tags
2202 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
2206 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2209 ALTER TABLE ONLY public.nodes
2210 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
2214 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2217 ALTER TABLE ONLY public.note_comments
2218 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
2222 -- Name: note_subscriptions note_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2225 ALTER TABLE ONLY public.note_subscriptions
2226 ADD CONSTRAINT note_subscriptions_pkey PRIMARY KEY (user_id, note_id);
2230 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2233 ALTER TABLE ONLY public.notes
2234 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
2238 -- Name: noticed_events noticed_events_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2241 ALTER TABLE ONLY public.noticed_events
2242 ADD CONSTRAINT noticed_events_pkey PRIMARY KEY (id);
2246 -- Name: noticed_notifications noticed_notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2249 ALTER TABLE ONLY public.noticed_notifications
2250 ADD CONSTRAINT noticed_notifications_pkey PRIMARY KEY (id);
2254 -- Name: oauth_access_grants oauth_access_grants_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2257 ALTER TABLE ONLY public.oauth_access_grants
2258 ADD CONSTRAINT oauth_access_grants_pkey PRIMARY KEY (id);
2262 -- Name: oauth_access_tokens oauth_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2265 ALTER TABLE ONLY public.oauth_access_tokens
2266 ADD CONSTRAINT oauth_access_tokens_pkey PRIMARY KEY (id);
2270 -- Name: oauth_applications oauth_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2273 ALTER TABLE ONLY public.oauth_applications
2274 ADD CONSTRAINT oauth_applications_pkey PRIMARY KEY (id);
2278 -- Name: oauth_openid_requests oauth_openid_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2281 ALTER TABLE ONLY public.oauth_openid_requests
2282 ADD CONSTRAINT oauth_openid_requests_pkey PRIMARY KEY (id);
2286 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2289 ALTER TABLE ONLY public.redactions
2290 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
2294 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2297 ALTER TABLE ONLY public.relation_members
2298 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, sequence_id);
2302 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2305 ALTER TABLE ONLY public.relation_tags
2306 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
2310 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2313 ALTER TABLE ONLY public.relations
2314 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
2318 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2321 ALTER TABLE ONLY public.reports
2322 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
2326 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2329 ALTER TABLE ONLY public.schema_migrations
2330 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
2334 -- Name: social_links social_links_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2337 ALTER TABLE ONLY public.social_links
2338 ADD CONSTRAINT social_links_pkey PRIMARY KEY (id);
2342 -- Name: spammy_phrases spammy_phrases_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2345 ALTER TABLE ONLY public.spammy_phrases
2346 ADD CONSTRAINT spammy_phrases_pkey PRIMARY KEY (id);
2350 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2353 ALTER TABLE ONLY public.user_blocks
2354 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
2358 -- Name: user_mutes user_mutes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2361 ALTER TABLE ONLY public.user_mutes
2362 ADD CONSTRAINT user_mutes_pkey PRIMARY KEY (id);
2366 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2369 ALTER TABLE ONLY public.user_preferences
2370 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
2374 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2377 ALTER TABLE ONLY public.user_roles
2378 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
2382 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2385 ALTER TABLE ONLY public.users
2386 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2390 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2393 ALTER TABLE ONLY public.way_nodes
2394 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2398 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2401 ALTER TABLE ONLY public.way_tags
2402 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2406 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2409 ALTER TABLE ONLY public.ways
2410 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2414 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2417 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2421 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2424 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2428 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2431 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2435 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2438 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2442 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2445 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2449 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2452 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2456 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2459 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2463 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2466 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2470 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2473 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2477 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2480 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2484 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2487 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2491 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2494 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2498 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2501 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2505 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2508 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2512 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2515 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2519 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2522 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2526 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2529 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2533 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2536 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2540 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2543 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2547 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2550 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2554 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2557 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2561 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2564 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2568 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2571 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2575 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2578 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2582 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2585 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2589 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2592 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2596 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2599 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2603 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2606 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2610 -- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
2613 CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest);
2617 -- Name: index_changeset_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2620 CREATE INDEX index_changeset_comments_on_author_id_and_created_at ON public.changeset_comments USING btree (author_id, created_at);
2624 -- Name: index_changeset_comments_on_author_id_and_id; Type: INDEX; Schema: public; Owner: -
2627 CREATE INDEX index_changeset_comments_on_author_id_and_id ON public.changeset_comments USING btree (author_id, id);
2631 -- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2634 CREATE INDEX index_changeset_comments_on_changeset_id_and_created_at ON public.changeset_comments USING btree (changeset_id, created_at);
2638 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2641 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2645 -- Name: index_changesets_on_user_id_and_closed_at; Type: INDEX; Schema: public; Owner: -
2648 CREATE INDEX index_changesets_on_user_id_and_closed_at ON public.changesets USING btree (user_id, closed_at);
2652 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2655 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2659 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2662 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2666 -- Name: index_diary_comments_on_user_id_and_id; Type: INDEX; Schema: public; Owner: -
2669 CREATE INDEX index_diary_comments_on_user_id_and_id ON public.diary_comments USING btree (user_id, id);
2673 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2676 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2680 -- Name: index_friends_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2683 CREATE INDEX index_friends_on_user_id_and_created_at ON public.friends USING btree (user_id, created_at);
2687 -- Name: index_gpx_files_on_user_id_and_id; Type: INDEX; Schema: public; Owner: -
2690 CREATE INDEX index_gpx_files_on_user_id_and_id ON public.gpx_files USING btree (user_id, id);
2694 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2697 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2701 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2704 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2708 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2711 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2715 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2718 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2722 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2725 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2729 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2732 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2736 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2739 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2743 -- Name: index_note_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2746 CREATE INDEX index_note_comments_on_author_id_and_created_at ON public.note_comments USING btree (author_id, created_at);
2750 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2753 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2757 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2760 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2764 -- Name: index_note_subscriptions_on_note_id; Type: INDEX; Schema: public; Owner: -
2767 CREATE INDEX index_note_subscriptions_on_note_id ON public.note_subscriptions USING btree (note_id);
2771 -- Name: index_notes_on_description; Type: INDEX; Schema: public; Owner: -
2774 CREATE INDEX index_notes_on_description ON public.notes USING gin (to_tsvector('english'::regconfig, description));
2778 -- Name: index_notes_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2781 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);
2785 -- Name: index_noticed_events_on_record; Type: INDEX; Schema: public; Owner: -
2788 CREATE INDEX index_noticed_events_on_record ON public.noticed_events USING btree (record_type, record_id);
2792 -- Name: index_noticed_notifications_on_event_id; Type: INDEX; Schema: public; Owner: -
2795 CREATE INDEX index_noticed_notifications_on_event_id ON public.noticed_notifications USING btree (event_id);
2799 -- Name: index_noticed_notifications_on_recipient; Type: INDEX; Schema: public; Owner: -
2802 CREATE INDEX index_noticed_notifications_on_recipient ON public.noticed_notifications USING btree (recipient_type, recipient_id);
2806 -- Name: index_oauth_access_grants_on_application_id; Type: INDEX; Schema: public; Owner: -
2809 CREATE INDEX index_oauth_access_grants_on_application_id ON public.oauth_access_grants USING btree (application_id);
2813 -- Name: index_oauth_access_grants_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2816 CREATE INDEX index_oauth_access_grants_on_resource_owner_id ON public.oauth_access_grants USING btree (resource_owner_id);
2820 -- Name: index_oauth_access_grants_on_token; Type: INDEX; Schema: public; Owner: -
2823 CREATE UNIQUE INDEX index_oauth_access_grants_on_token ON public.oauth_access_grants USING btree (token);
2827 -- Name: index_oauth_access_tokens_on_application_id; Type: INDEX; Schema: public; Owner: -
2830 CREATE INDEX index_oauth_access_tokens_on_application_id ON public.oauth_access_tokens USING btree (application_id);
2834 -- Name: index_oauth_access_tokens_on_refresh_token; Type: INDEX; Schema: public; Owner: -
2837 CREATE UNIQUE INDEX index_oauth_access_tokens_on_refresh_token ON public.oauth_access_tokens USING btree (refresh_token);
2841 -- Name: index_oauth_access_tokens_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2844 CREATE INDEX index_oauth_access_tokens_on_resource_owner_id ON public.oauth_access_tokens USING btree (resource_owner_id);
2848 -- Name: index_oauth_access_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2851 CREATE UNIQUE INDEX index_oauth_access_tokens_on_token ON public.oauth_access_tokens USING btree (token);
2855 -- Name: index_oauth_applications_on_owner_type_and_owner_id; Type: INDEX; Schema: public; Owner: -
2858 CREATE INDEX index_oauth_applications_on_owner_type_and_owner_id ON public.oauth_applications USING btree (owner_type, owner_id);
2862 -- Name: index_oauth_applications_on_uid; Type: INDEX; Schema: public; Owner: -
2865 CREATE UNIQUE INDEX index_oauth_applications_on_uid ON public.oauth_applications USING btree (uid);
2869 -- Name: index_oauth_openid_requests_on_access_grant_id; Type: INDEX; Schema: public; Owner: -
2872 CREATE INDEX index_oauth_openid_requests_on_access_grant_id ON public.oauth_openid_requests USING btree (access_grant_id);
2876 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2879 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2883 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2886 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2890 -- Name: index_social_links_on_user_id; Type: INDEX; Schema: public; Owner: -
2893 CREATE INDEX index_social_links_on_user_id ON public.social_links USING btree (user_id);
2897 -- Name: index_user_blocks_on_creator_id_and_id; Type: INDEX; Schema: public; Owner: -
2900 CREATE INDEX index_user_blocks_on_creator_id_and_id ON public.user_blocks USING btree (creator_id, id);
2904 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2907 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2911 -- Name: index_user_mutes_on_owner_id_and_subject_id; Type: INDEX; Schema: public; Owner: -
2914 CREATE UNIQUE INDEX index_user_mutes_on_owner_id_and_subject_id ON public.user_mutes USING btree (owner_id, subject_id);
2918 -- Name: index_users_on_creation_address; Type: INDEX; Schema: public; Owner: -
2921 CREATE INDEX index_users_on_creation_address ON public.users USING gist (creation_address inet_ops);
2925 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2928 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2932 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2935 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2939 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2942 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2946 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2949 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2953 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2956 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2960 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2963 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2967 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2970 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2974 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2977 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2981 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2984 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2988 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2991 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2995 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2998 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
3002 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
3005 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
3009 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
3012 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
3016 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
3019 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
3023 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
3026 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
3030 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
3033 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
3037 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
3040 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
3044 -- Name: users_display_name_canonical_idx; Type: INDEX; Schema: public; Owner: -
3047 CREATE INDEX users_display_name_canonical_idx ON public.users USING btree (lower(NORMALIZE(display_name, NFKC)));
3051 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
3054 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
3058 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
3061 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
3065 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
3068 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
3072 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
3075 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
3079 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
3082 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
3086 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
3089 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
3093 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
3096 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
3100 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3103 ALTER TABLE ONLY public.changeset_comments
3104 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
3108 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3111 ALTER TABLE ONLY public.changeset_comments
3112 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3116 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3119 ALTER TABLE ONLY public.changeset_tags
3120 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3124 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3127 ALTER TABLE ONLY public.changesets_subscribers
3128 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3132 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3135 ALTER TABLE ONLY public.changesets_subscribers
3136 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
3140 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3143 ALTER TABLE ONLY public.changesets
3144 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3148 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3151 ALTER TABLE ONLY public.current_node_tags
3152 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
3156 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3159 ALTER TABLE ONLY public.current_nodes
3160 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3164 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3167 ALTER TABLE ONLY public.current_relation_members
3168 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
3172 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3175 ALTER TABLE ONLY public.current_relation_tags
3176 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
3180 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3183 ALTER TABLE ONLY public.current_relations
3184 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3188 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3191 ALTER TABLE ONLY public.current_way_nodes
3192 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
3196 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3199 ALTER TABLE ONLY public.current_way_nodes
3200 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
3204 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3207 ALTER TABLE ONLY public.current_way_tags
3208 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
3212 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3215 ALTER TABLE ONLY public.current_ways
3216 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3220 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3223 ALTER TABLE ONLY public.diary_comments
3224 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
3228 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3231 ALTER TABLE ONLY public.diary_comments
3232 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3236 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3239 ALTER TABLE ONLY public.diary_entries
3240 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
3244 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3247 ALTER TABLE ONLY public.diary_entries
3248 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3252 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3255 ALTER TABLE ONLY public.diary_entry_subscriptions
3256 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
3260 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3263 ALTER TABLE ONLY public.diary_entry_subscriptions
3264 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3268 -- Name: note_subscriptions fk_rails_2c1913f293; Type: FK CONSTRAINT; Schema: public; Owner: -
3271 ALTER TABLE ONLY public.note_subscriptions
3272 ADD CONSTRAINT fk_rails_2c1913f293 FOREIGN KEY (note_id) REFERENCES public.notes(id);
3276 -- Name: oauth_access_grants fk_rails_330c32d8d9; Type: FK CONSTRAINT; Schema: public; Owner: -
3279 ALTER TABLE ONLY public.oauth_access_grants
3280 ADD CONSTRAINT fk_rails_330c32d8d9 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3284 -- Name: user_mutes fk_rails_591dad3359; Type: FK CONSTRAINT; Schema: public; Owner: -
3287 ALTER TABLE ONLY public.user_mutes
3288 ADD CONSTRAINT fk_rails_591dad3359 FOREIGN KEY (owner_id) REFERENCES public.users(id);
3292 -- Name: social_links fk_rails_6034fd4f62; Type: FK CONSTRAINT; Schema: public; Owner: -
3295 ALTER TABLE ONLY public.social_links
3296 ADD CONSTRAINT fk_rails_6034fd4f62 FOREIGN KEY (user_id) REFERENCES public.users(id);
3300 -- Name: oauth_access_tokens fk_rails_732cb83ab7; Type: FK CONSTRAINT; Schema: public; Owner: -
3303 ALTER TABLE ONLY public.oauth_access_tokens
3304 ADD CONSTRAINT fk_rails_732cb83ab7 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3308 -- Name: oauth_openid_requests fk_rails_77114b3b09; Type: FK CONSTRAINT; Schema: public; Owner: -
3311 ALTER TABLE ONLY public.oauth_openid_requests
3312 ADD CONSTRAINT fk_rails_77114b3b09 FOREIGN KEY (access_grant_id) REFERENCES public.oauth_access_grants(id) ON DELETE CASCADE;
3316 -- Name: active_storage_variant_records fk_rails_993965df05; Type: FK CONSTRAINT; Schema: public; Owner: -
3319 ALTER TABLE ONLY public.active_storage_variant_records
3320 ADD CONSTRAINT fk_rails_993965df05 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3324 -- Name: note_subscriptions fk_rails_a352f4eced; Type: FK CONSTRAINT; Schema: public; Owner: -
3327 ALTER TABLE ONLY public.note_subscriptions
3328 ADD CONSTRAINT fk_rails_a352f4eced FOREIGN KEY (user_id) REFERENCES public.users(id);
3332 -- Name: oauth_access_grants fk_rails_b4b53e07b8; Type: FK CONSTRAINT; Schema: public; Owner: -
3335 ALTER TABLE ONLY public.oauth_access_grants
3336 ADD CONSTRAINT fk_rails_b4b53e07b8 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3340 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
3343 ALTER TABLE ONLY public.active_storage_attachments
3344 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3348 -- Name: oauth_applications fk_rails_cc886e315a; Type: FK CONSTRAINT; Schema: public; Owner: -
3351 ALTER TABLE ONLY public.oauth_applications
3352 ADD CONSTRAINT fk_rails_cc886e315a FOREIGN KEY (owner_id) REFERENCES public.users(id) NOT VALID;
3356 -- Name: user_mutes fk_rails_e9dd4fb6c3; Type: FK CONSTRAINT; Schema: public; Owner: -
3359 ALTER TABLE ONLY public.user_mutes
3360 ADD CONSTRAINT fk_rails_e9dd4fb6c3 FOREIGN KEY (subject_id) REFERENCES public.users(id);
3364 -- Name: oauth_access_tokens fk_rails_ee63f25419; Type: FK CONSTRAINT; Schema: public; Owner: -
3367 ALTER TABLE ONLY public.oauth_access_tokens
3368 ADD CONSTRAINT fk_rails_ee63f25419 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3372 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3375 ALTER TABLE ONLY public.friends
3376 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
3380 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3383 ALTER TABLE ONLY public.friends
3384 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3388 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3391 ALTER TABLE ONLY public.gps_points
3392 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3396 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3399 ALTER TABLE ONLY public.gpx_file_tags
3400 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3404 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3407 ALTER TABLE ONLY public.gpx_files
3408 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3412 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3415 ALTER TABLE ONLY public.issue_comments
3416 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3420 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3423 ALTER TABLE ONLY public.issue_comments
3424 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3428 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3431 ALTER TABLE ONLY public.issues
3432 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
3436 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3439 ALTER TABLE ONLY public.issues
3440 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
3444 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3447 ALTER TABLE ONLY public.issues
3448 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
3452 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3455 ALTER TABLE ONLY public.messages
3456 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
3460 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3463 ALTER TABLE ONLY public.messages
3464 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
3468 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3471 ALTER TABLE ONLY public.node_tags
3472 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
3476 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3479 ALTER TABLE ONLY public.nodes
3480 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3484 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3487 ALTER TABLE ONLY public.nodes
3488 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3492 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3495 ALTER TABLE ONLY public.note_comments
3496 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
3500 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3503 ALTER TABLE ONLY public.note_comments
3504 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
3508 -- Name: notes notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3511 ALTER TABLE ONLY public.notes
3512 ADD CONSTRAINT notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3516 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3519 ALTER TABLE ONLY public.redactions
3520 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3524 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3527 ALTER TABLE ONLY public.relation_members
3528 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3532 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3535 ALTER TABLE ONLY public.relation_tags
3536 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3540 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3543 ALTER TABLE ONLY public.relations
3544 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3548 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3551 ALTER TABLE ONLY public.relations
3552 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3556 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3559 ALTER TABLE ONLY public.reports
3560 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3564 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3567 ALTER TABLE ONLY public.reports
3568 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3572 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3575 ALTER TABLE ONLY public.user_blocks
3576 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
3580 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3583 ALTER TABLE ONLY public.user_blocks
3584 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
3588 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3591 ALTER TABLE ONLY public.user_blocks
3592 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3596 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3599 ALTER TABLE ONLY public.user_preferences
3600 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3604 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3607 ALTER TABLE ONLY public.user_roles
3608 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3612 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3615 ALTER TABLE ONLY public.user_roles
3616 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3620 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3623 ALTER TABLE ONLY public.way_nodes
3624 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3628 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3631 ALTER TABLE ONLY public.way_tags
3632 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3636 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3639 ALTER TABLE ONLY public.ways
3640 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3644 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3647 ALTER TABLE ONLY public.ways
3648 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3652 -- PostgreSQL database dump complete
3655 SET search_path TO "$user", public;
3657 INSERT INTO "schema_migrations" (version) VALUES