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,
450 num_created_nodes integer DEFAULT 0 NOT NULL,
451 num_modified_nodes integer DEFAULT 0 NOT NULL,
452 num_deleted_nodes integer DEFAULT 0 NOT NULL,
453 num_created_ways integer DEFAULT 0 NOT NULL,
454 num_modified_ways integer DEFAULT 0 NOT NULL,
455 num_deleted_ways integer DEFAULT 0 NOT NULL,
456 num_created_relations integer DEFAULT 0 NOT NULL,
457 num_modified_relations integer DEFAULT 0 NOT NULL,
458 num_deleted_relations integer DEFAULT 0 NOT NULL
463 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
466 CREATE SEQUENCE public.changesets_id_seq
475 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
478 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
482 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
485 CREATE TABLE public.changesets_subscribers (
486 subscriber_id bigint NOT NULL,
487 changeset_id bigint NOT NULL
492 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
495 CREATE TABLE public.current_node_tags (
496 node_id bigint NOT NULL,
497 k character varying DEFAULT ''::character varying NOT NULL,
498 v character varying DEFAULT ''::character varying NOT NULL
503 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
506 CREATE TABLE public.current_nodes (
508 latitude integer NOT NULL,
509 longitude integer NOT NULL,
510 changeset_id bigint NOT NULL,
511 visible boolean NOT NULL,
512 "timestamp" timestamp without time zone NOT NULL,
513 tile bigint NOT NULL,
514 version bigint NOT NULL
519 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
522 CREATE SEQUENCE public.current_nodes_id_seq
531 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
534 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
538 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
541 CREATE TABLE public.current_relation_members (
542 relation_id bigint NOT NULL,
543 member_type public.nwr_enum NOT NULL,
544 member_id bigint NOT NULL,
545 member_role character varying NOT NULL,
546 sequence_id integer DEFAULT 0 NOT NULL
551 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
554 CREATE TABLE public.current_relation_tags (
555 relation_id bigint NOT NULL,
556 k character varying DEFAULT ''::character varying NOT NULL,
557 v character varying DEFAULT ''::character varying NOT NULL
562 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
565 CREATE TABLE public.current_relations (
567 changeset_id bigint NOT NULL,
568 "timestamp" timestamp without time zone NOT NULL,
569 visible boolean NOT NULL,
570 version bigint NOT NULL
575 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
578 CREATE SEQUENCE public.current_relations_id_seq
587 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
590 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
594 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
597 CREATE TABLE public.current_way_nodes (
598 way_id bigint NOT NULL,
599 node_id bigint NOT NULL,
600 sequence_id bigint NOT NULL
605 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
608 CREATE TABLE public.current_way_tags (
609 way_id bigint NOT NULL,
610 k character varying DEFAULT ''::character varying NOT NULL,
611 v character varying DEFAULT ''::character varying NOT NULL
616 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
619 CREATE TABLE public.current_ways (
621 changeset_id bigint NOT NULL,
622 "timestamp" timestamp without time zone NOT NULL,
623 visible boolean NOT NULL,
624 version bigint NOT NULL
629 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
632 CREATE SEQUENCE public.current_ways_id_seq
641 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
644 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
648 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
651 CREATE TABLE public.delayed_jobs (
653 priority integer DEFAULT 0 NOT NULL,
654 attempts integer DEFAULT 0 NOT NULL,
655 handler text NOT NULL,
657 run_at timestamp without time zone,
658 locked_at timestamp without time zone,
659 failed_at timestamp without time zone,
660 locked_by character varying,
661 queue character varying,
662 created_at timestamp without time zone,
663 updated_at timestamp without time zone
668 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
671 CREATE SEQUENCE public.delayed_jobs_id_seq
680 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
683 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
687 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
690 CREATE TABLE public.diary_comments (
692 diary_entry_id bigint NOT NULL,
693 user_id bigint NOT NULL,
695 created_at timestamp without time zone NOT NULL,
696 updated_at timestamp without time zone NOT NULL,
697 visible boolean DEFAULT true NOT NULL,
698 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
703 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
706 CREATE SEQUENCE public.diary_comments_id_seq
715 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
718 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
722 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
725 CREATE TABLE public.diary_entries (
727 user_id bigint NOT NULL,
728 title character varying NOT NULL,
730 created_at timestamp without time zone NOT NULL,
731 updated_at timestamp without time zone NOT NULL,
732 latitude double precision,
733 longitude double precision,
734 language_code character varying DEFAULT 'en'::character varying NOT NULL,
735 visible boolean DEFAULT true NOT NULL,
736 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
741 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
744 CREATE SEQUENCE public.diary_entries_id_seq
753 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
756 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
760 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
763 CREATE TABLE public.diary_entry_subscriptions (
764 user_id bigint NOT NULL,
765 diary_entry_id bigint NOT NULL
770 -- Name: friends; Type: TABLE; Schema: public; Owner: -
773 CREATE TABLE public.friends (
775 user_id bigint NOT NULL,
776 friend_user_id bigint NOT NULL,
777 created_at timestamp without time zone
782 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
785 CREATE SEQUENCE public.friends_id_seq
794 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
797 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
801 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
804 CREATE TABLE public.gps_points (
805 altitude double precision,
806 trackid integer NOT NULL,
807 latitude integer NOT NULL,
808 longitude integer NOT NULL,
809 gpx_id bigint NOT NULL,
810 "timestamp" timestamp without time zone,
816 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
819 CREATE TABLE public.gpx_file_tags (
820 gpx_id bigint NOT NULL,
821 tag character varying NOT NULL,
827 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
830 CREATE SEQUENCE public.gpx_file_tags_id_seq
839 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
842 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
846 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
849 CREATE TABLE public.gpx_files (
851 user_id bigint NOT NULL,
852 visible boolean DEFAULT true NOT NULL,
853 name character varying DEFAULT ''::character varying NOT NULL,
855 latitude double precision,
856 longitude double precision,
857 "timestamp" timestamp without time zone NOT NULL,
858 description character varying DEFAULT ''::character varying NOT NULL,
859 inserted boolean NOT NULL,
860 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
865 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
868 CREATE SEQUENCE public.gpx_files_id_seq
877 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
880 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
884 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
887 CREATE TABLE public.issue_comments (
889 issue_id integer NOT NULL,
890 user_id integer NOT NULL,
892 created_at timestamp without time zone NOT NULL,
893 updated_at timestamp without time zone NOT NULL
898 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
901 CREATE SEQUENCE public.issue_comments_id_seq
911 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
914 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
918 -- Name: issues; Type: TABLE; Schema: public; Owner: -
921 CREATE TABLE public.issues (
923 reportable_type character varying NOT NULL,
924 reportable_id integer NOT NULL,
925 reported_user_id integer,
926 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
927 assigned_role public.user_role_enum NOT NULL,
928 resolved_at timestamp without time zone,
931 reports_count integer DEFAULT 0,
932 created_at timestamp without time zone NOT NULL,
933 updated_at timestamp without time zone NOT NULL
938 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
941 CREATE SEQUENCE public.issues_id_seq
951 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
954 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
958 -- Name: languages; Type: TABLE; Schema: public; Owner: -
961 CREATE TABLE public.languages (
962 code character varying NOT NULL,
963 english_name character varying NOT NULL,
964 native_name character varying
969 -- Name: messages; Type: TABLE; Schema: public; Owner: -
972 CREATE TABLE public.messages (
974 from_user_id bigint NOT NULL,
975 title character varying NOT NULL,
977 sent_on timestamp without time zone NOT NULL,
978 message_read boolean DEFAULT false NOT NULL,
979 to_user_id bigint NOT NULL,
980 to_user_visible boolean DEFAULT true NOT NULL,
981 from_user_visible boolean DEFAULT true NOT NULL,
982 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
983 muted boolean DEFAULT false NOT NULL
988 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
991 CREATE SEQUENCE public.messages_id_seq
1000 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1003 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
1007 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
1010 CREATE TABLE public.node_tags (
1011 node_id bigint NOT NULL,
1012 version bigint NOT NULL,
1013 k character varying DEFAULT ''::character varying NOT NULL,
1014 v character varying DEFAULT ''::character varying NOT NULL
1019 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
1022 CREATE TABLE public.nodes (
1023 node_id bigint NOT NULL,
1024 latitude integer NOT NULL,
1025 longitude integer NOT NULL,
1026 changeset_id bigint NOT NULL,
1027 visible boolean NOT NULL,
1028 "timestamp" timestamp without time zone NOT NULL,
1029 tile bigint NOT NULL,
1030 version bigint NOT NULL,
1031 redaction_id integer
1036 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
1039 CREATE TABLE public.note_comments (
1041 note_id bigint NOT NULL,
1042 visible boolean NOT NULL,
1043 created_at timestamp without time zone NOT NULL,
1047 event public.note_event_enum
1052 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1055 CREATE SEQUENCE public.note_comments_id_seq
1064 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1067 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
1071 -- Name: note_subscriptions; Type: TABLE; Schema: public; Owner: -
1074 CREATE TABLE public.note_subscriptions (
1075 user_id bigint NOT NULL,
1076 note_id bigint NOT NULL
1081 -- Name: notes; Type: TABLE; Schema: public; Owner: -
1084 CREATE TABLE public.notes (
1086 latitude integer NOT NULL,
1087 longitude integer NOT NULL,
1088 tile bigint NOT NULL,
1089 updated_at timestamp without time zone NOT NULL,
1090 created_at timestamp without time zone NOT NULL,
1091 status public.note_status_enum NOT NULL,
1092 closed_at timestamp without time zone,
1093 description text DEFAULT ''::text NOT NULL,
1100 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1103 CREATE SEQUENCE public.notes_id_seq
1112 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1115 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
1119 -- Name: oauth_access_grants; Type: TABLE; Schema: public; Owner: -
1122 CREATE TABLE public.oauth_access_grants (
1124 resource_owner_id bigint NOT NULL,
1125 application_id bigint NOT NULL,
1126 token character varying NOT NULL,
1127 expires_in integer NOT NULL,
1128 redirect_uri text NOT NULL,
1129 created_at timestamp without time zone NOT NULL,
1130 revoked_at timestamp without time zone,
1131 scopes character varying DEFAULT ''::character varying NOT NULL,
1132 code_challenge character varying,
1133 code_challenge_method character varying
1138 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1141 CREATE SEQUENCE public.oauth_access_grants_id_seq
1150 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1153 ALTER SEQUENCE public.oauth_access_grants_id_seq OWNED BY public.oauth_access_grants.id;
1157 -- Name: oauth_access_tokens; Type: TABLE; Schema: public; Owner: -
1160 CREATE TABLE public.oauth_access_tokens (
1162 resource_owner_id bigint,
1163 application_id bigint NOT NULL,
1164 token character varying NOT NULL,
1165 refresh_token character varying,
1167 revoked_at timestamp without time zone,
1168 created_at timestamp without time zone NOT NULL,
1169 scopes character varying,
1170 previous_refresh_token character varying DEFAULT ''::character varying NOT NULL
1175 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1178 CREATE SEQUENCE public.oauth_access_tokens_id_seq
1187 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1190 ALTER SEQUENCE public.oauth_access_tokens_id_seq OWNED BY public.oauth_access_tokens.id;
1194 -- Name: oauth_applications; Type: TABLE; Schema: public; Owner: -
1197 CREATE TABLE public.oauth_applications (
1199 owner_type character varying NOT NULL,
1200 owner_id bigint NOT NULL,
1201 name character varying NOT NULL,
1202 uid character varying NOT NULL,
1203 secret character varying NOT NULL,
1204 redirect_uri text NOT NULL,
1205 scopes character varying DEFAULT ''::character varying NOT NULL,
1206 confidential boolean DEFAULT true NOT NULL,
1207 created_at timestamp(6) without time zone NOT NULL,
1208 updated_at timestamp(6) without time zone NOT NULL
1213 -- Name: oauth_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1216 CREATE SEQUENCE public.oauth_applications_id_seq
1225 -- Name: oauth_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1228 ALTER SEQUENCE public.oauth_applications_id_seq OWNED BY public.oauth_applications.id;
1232 -- Name: oauth_openid_requests; Type: TABLE; Schema: public; Owner: -
1235 CREATE TABLE public.oauth_openid_requests (
1237 access_grant_id bigint NOT NULL,
1238 nonce character varying NOT NULL
1243 -- Name: oauth_openid_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1246 CREATE SEQUENCE public.oauth_openid_requests_id_seq
1255 -- Name: oauth_openid_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1258 ALTER SEQUENCE public.oauth_openid_requests_id_seq OWNED BY public.oauth_openid_requests.id;
1262 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1265 CREATE TABLE public.redactions (
1266 id integer NOT NULL,
1267 title character varying NOT NULL,
1268 description text NOT NULL,
1269 created_at timestamp without time zone,
1270 updated_at timestamp without time zone,
1271 user_id bigint NOT NULL,
1272 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1277 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1280 CREATE SEQUENCE public.redactions_id_seq
1290 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1293 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1297 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1300 CREATE TABLE public.relation_members (
1301 relation_id bigint NOT NULL,
1302 member_type public.nwr_enum NOT NULL,
1303 member_id bigint NOT NULL,
1304 member_role character varying NOT NULL,
1305 version bigint DEFAULT 0 NOT NULL,
1306 sequence_id integer DEFAULT 0 NOT NULL
1311 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1314 CREATE TABLE public.relation_tags (
1315 relation_id bigint NOT NULL,
1316 k character varying DEFAULT ''::character varying NOT NULL,
1317 v character varying DEFAULT ''::character varying NOT NULL,
1318 version bigint NOT NULL
1323 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1326 CREATE TABLE public.relations (
1327 relation_id bigint NOT NULL,
1328 changeset_id bigint NOT NULL,
1329 "timestamp" timestamp without time zone NOT NULL,
1330 version bigint NOT NULL,
1331 visible boolean DEFAULT true NOT NULL,
1332 redaction_id integer
1337 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1340 CREATE TABLE public.reports (
1341 id integer NOT NULL,
1342 issue_id integer NOT NULL,
1343 user_id integer NOT NULL,
1344 details text NOT NULL,
1345 category character varying NOT NULL,
1346 created_at timestamp without time zone NOT NULL,
1347 updated_at timestamp without time zone NOT NULL
1352 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1355 CREATE SEQUENCE public.reports_id_seq
1365 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1368 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1372 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1375 CREATE TABLE public.schema_migrations (
1376 version character varying NOT NULL
1381 -- Name: social_links; Type: TABLE; Schema: public; Owner: -
1384 CREATE TABLE public.social_links (
1386 user_id bigint NOT NULL,
1387 url character varying NOT NULL,
1388 created_at timestamp(6) without time zone NOT NULL,
1389 updated_at timestamp(6) without time zone NOT NULL
1394 -- Name: social_links_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1397 CREATE SEQUENCE public.social_links_id_seq
1406 -- Name: social_links_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1409 ALTER SEQUENCE public.social_links_id_seq OWNED BY public.social_links.id;
1413 -- Name: spammy_phrases; Type: TABLE; Schema: public; Owner: -
1416 CREATE TABLE public.spammy_phrases (
1418 phrase character varying,
1419 created_at timestamp(6) without time zone NOT NULL,
1420 updated_at timestamp(6) without time zone NOT NULL
1425 -- Name: spammy_phrases_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1428 CREATE SEQUENCE public.spammy_phrases_id_seq
1437 -- Name: spammy_phrases_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1440 ALTER SEQUENCE public.spammy_phrases_id_seq OWNED BY public.spammy_phrases.id;
1444 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1447 CREATE TABLE public.user_blocks (
1448 id integer NOT NULL,
1449 user_id bigint NOT NULL,
1450 creator_id bigint NOT NULL,
1451 reason text NOT NULL,
1452 ends_at timestamp without time zone NOT NULL,
1453 needs_view boolean DEFAULT false NOT NULL,
1455 created_at timestamp without time zone,
1456 updated_at timestamp without time zone,
1457 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1458 deactivates_at timestamp without time zone
1463 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1466 CREATE SEQUENCE public.user_blocks_id_seq
1476 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1479 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1483 -- Name: user_mutes; Type: TABLE; Schema: public; Owner: -
1486 CREATE TABLE public.user_mutes (
1488 owner_id bigint NOT NULL,
1489 subject_id bigint NOT NULL,
1490 created_at timestamp(6) without time zone NOT NULL,
1491 updated_at timestamp(6) without time zone NOT NULL
1496 -- Name: user_mutes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1499 CREATE SEQUENCE public.user_mutes_id_seq
1508 -- Name: user_mutes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1511 ALTER SEQUENCE public.user_mutes_id_seq OWNED BY public.user_mutes.id;
1515 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1518 CREATE TABLE public.user_preferences (
1519 user_id bigint NOT NULL,
1520 k character varying NOT NULL,
1521 v character varying NOT NULL
1526 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1529 CREATE TABLE public.user_roles (
1530 id integer NOT NULL,
1531 user_id bigint NOT NULL,
1532 role public.user_role_enum NOT NULL,
1533 created_at timestamp without time zone,
1534 updated_at timestamp without time zone,
1535 granter_id bigint NOT NULL
1540 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1543 CREATE SEQUENCE public.user_roles_id_seq
1553 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1556 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1560 -- Name: users; Type: TABLE; Schema: public; Owner: -
1563 CREATE TABLE public.users (
1564 email character varying NOT NULL,
1566 pass_crypt character varying NOT NULL,
1567 creation_time timestamp without time zone NOT NULL,
1568 display_name character varying DEFAULT ''::character varying NOT NULL,
1569 data_public boolean DEFAULT false NOT NULL,
1570 description text DEFAULT ''::text NOT NULL,
1571 home_lat double precision,
1572 home_lon double precision,
1573 home_zoom smallint DEFAULT 3,
1574 pass_salt character varying,
1575 email_valid boolean DEFAULT false NOT NULL,
1576 new_email character varying,
1577 languages character varying,
1578 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1579 terms_agreed timestamp without time zone,
1580 consider_pd boolean DEFAULT false NOT NULL,
1581 auth_uid character varying,
1582 preferred_editor character varying,
1583 terms_seen boolean DEFAULT false NOT NULL,
1584 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1585 changesets_count integer DEFAULT 0 NOT NULL,
1586 traces_count integer DEFAULT 0 NOT NULL,
1587 diary_entries_count integer DEFAULT 0 NOT NULL,
1588 image_use_gravatar boolean DEFAULT false NOT NULL,
1589 auth_provider character varying,
1591 tou_agreed timestamp without time zone,
1592 diary_comments_count integer DEFAULT 0,
1593 note_comments_count integer DEFAULT 0,
1594 creation_address inet,
1595 home_location_name character varying,
1596 company character varying,
1597 public_heatmap boolean DEFAULT true NOT NULL
1602 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1605 CREATE SEQUENCE public.users_id_seq
1614 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1617 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1621 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1624 CREATE TABLE public.way_nodes (
1625 way_id bigint NOT NULL,
1626 node_id bigint NOT NULL,
1627 version bigint NOT NULL,
1628 sequence_id bigint NOT NULL
1633 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1636 CREATE TABLE public.way_tags (
1637 way_id bigint NOT NULL,
1638 k character varying NOT NULL,
1639 v character varying NOT NULL,
1640 version bigint NOT NULL
1645 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1648 CREATE TABLE public.ways (
1649 way_id bigint NOT NULL,
1650 changeset_id bigint NOT NULL,
1651 "timestamp" timestamp without time zone NOT NULL,
1652 version bigint NOT NULL,
1653 visible boolean DEFAULT true NOT NULL,
1654 redaction_id integer
1659 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1662 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1666 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1669 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1673 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1676 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1680 -- Name: active_storage_variant_records id; Type: DEFAULT; Schema: public; Owner: -
1683 ALTER TABLE ONLY public.active_storage_variant_records ALTER COLUMN id SET DEFAULT nextval('public.active_storage_variant_records_id_seq'::regclass);
1687 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1690 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1694 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1697 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1701 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1704 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1708 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1711 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1715 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1718 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1722 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1725 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1729 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1732 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1736 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1739 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1743 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1746 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1750 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1753 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1757 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1760 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1764 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1767 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1771 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1774 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1778 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1781 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1785 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1788 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1792 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1795 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1799 -- Name: oauth_access_grants id; Type: DEFAULT; Schema: public; Owner: -
1802 ALTER TABLE ONLY public.oauth_access_grants ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_grants_id_seq'::regclass);
1806 -- Name: oauth_access_tokens id; Type: DEFAULT; Schema: public; Owner: -
1809 ALTER TABLE ONLY public.oauth_access_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_tokens_id_seq'::regclass);
1813 -- Name: oauth_applications id; Type: DEFAULT; Schema: public; Owner: -
1816 ALTER TABLE ONLY public.oauth_applications ALTER COLUMN id SET DEFAULT nextval('public.oauth_applications_id_seq'::regclass);
1820 -- Name: oauth_openid_requests id; Type: DEFAULT; Schema: public; Owner: -
1823 ALTER TABLE ONLY public.oauth_openid_requests ALTER COLUMN id SET DEFAULT nextval('public.oauth_openid_requests_id_seq'::regclass);
1827 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1830 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1834 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1837 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1841 -- Name: social_links id; Type: DEFAULT; Schema: public; Owner: -
1844 ALTER TABLE ONLY public.social_links ALTER COLUMN id SET DEFAULT nextval('public.social_links_id_seq'::regclass);
1848 -- Name: spammy_phrases id; Type: DEFAULT; Schema: public; Owner: -
1851 ALTER TABLE ONLY public.spammy_phrases ALTER COLUMN id SET DEFAULT nextval('public.spammy_phrases_id_seq'::regclass);
1855 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1858 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1862 -- Name: user_mutes id; Type: DEFAULT; Schema: public; Owner: -
1865 ALTER TABLE ONLY public.user_mutes ALTER COLUMN id SET DEFAULT nextval('public.user_mutes_id_seq'::regclass);
1869 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1872 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1876 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1879 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1883 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1886 ALTER TABLE ONLY public.acls
1887 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1891 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1894 ALTER TABLE ONLY public.active_storage_attachments
1895 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1899 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1902 ALTER TABLE ONLY public.active_storage_blobs
1903 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1907 -- Name: active_storage_variant_records active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1910 ALTER TABLE ONLY public.active_storage_variant_records
1911 ADD CONSTRAINT active_storage_variant_records_pkey PRIMARY KEY (id);
1915 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1918 ALTER TABLE ONLY public.ar_internal_metadata
1919 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1923 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1926 ALTER TABLE ONLY public.changeset_comments
1927 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1931 -- Name: changeset_tags changeset_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1934 ALTER TABLE ONLY public.changeset_tags
1935 ADD CONSTRAINT changeset_tags_pkey PRIMARY KEY (changeset_id, k);
1939 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1942 ALTER TABLE ONLY public.changesets
1943 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1947 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1950 ALTER TABLE ONLY public.current_node_tags
1951 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1955 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1958 ALTER TABLE ONLY public.current_nodes
1959 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1963 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1966 ALTER TABLE ONLY public.current_relation_members
1967 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, sequence_id);
1971 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1974 ALTER TABLE ONLY public.current_relation_tags
1975 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1979 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1982 ALTER TABLE ONLY public.current_relations
1983 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1987 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1990 ALTER TABLE ONLY public.current_way_nodes
1991 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1995 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1998 ALTER TABLE ONLY public.current_way_tags
1999 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
2003 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2006 ALTER TABLE ONLY public.current_ways
2007 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
2011 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2014 ALTER TABLE ONLY public.delayed_jobs
2015 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
2019 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2022 ALTER TABLE ONLY public.diary_comments
2023 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
2027 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2030 ALTER TABLE ONLY public.diary_entries
2031 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
2035 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2038 ALTER TABLE ONLY public.diary_entry_subscriptions
2039 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
2043 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2046 ALTER TABLE ONLY public.friends
2047 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
2051 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2054 ALTER TABLE ONLY public.gpx_file_tags
2055 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
2059 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2062 ALTER TABLE ONLY public.gpx_files
2063 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
2067 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2070 ALTER TABLE ONLY public.issue_comments
2071 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
2075 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2078 ALTER TABLE ONLY public.issues
2079 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
2083 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2086 ALTER TABLE ONLY public.languages
2087 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
2091 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2094 ALTER TABLE ONLY public.messages
2095 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
2099 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2102 ALTER TABLE ONLY public.node_tags
2103 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
2107 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2110 ALTER TABLE ONLY public.nodes
2111 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
2115 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2118 ALTER TABLE ONLY public.note_comments
2119 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
2123 -- Name: note_subscriptions note_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2126 ALTER TABLE ONLY public.note_subscriptions
2127 ADD CONSTRAINT note_subscriptions_pkey PRIMARY KEY (user_id, note_id);
2131 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2134 ALTER TABLE ONLY public.notes
2135 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
2139 -- Name: oauth_access_grants oauth_access_grants_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2142 ALTER TABLE ONLY public.oauth_access_grants
2143 ADD CONSTRAINT oauth_access_grants_pkey PRIMARY KEY (id);
2147 -- Name: oauth_access_tokens oauth_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2150 ALTER TABLE ONLY public.oauth_access_tokens
2151 ADD CONSTRAINT oauth_access_tokens_pkey PRIMARY KEY (id);
2155 -- Name: oauth_applications oauth_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2158 ALTER TABLE ONLY public.oauth_applications
2159 ADD CONSTRAINT oauth_applications_pkey PRIMARY KEY (id);
2163 -- Name: oauth_openid_requests oauth_openid_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2166 ALTER TABLE ONLY public.oauth_openid_requests
2167 ADD CONSTRAINT oauth_openid_requests_pkey PRIMARY KEY (id);
2171 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2174 ALTER TABLE ONLY public.redactions
2175 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
2179 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2182 ALTER TABLE ONLY public.relation_members
2183 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, sequence_id);
2187 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2190 ALTER TABLE ONLY public.relation_tags
2191 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
2195 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2198 ALTER TABLE ONLY public.relations
2199 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
2203 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2206 ALTER TABLE ONLY public.reports
2207 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
2211 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2214 ALTER TABLE ONLY public.schema_migrations
2215 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
2219 -- Name: social_links social_links_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2222 ALTER TABLE ONLY public.social_links
2223 ADD CONSTRAINT social_links_pkey PRIMARY KEY (id);
2227 -- Name: spammy_phrases spammy_phrases_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2230 ALTER TABLE ONLY public.spammy_phrases
2231 ADD CONSTRAINT spammy_phrases_pkey PRIMARY KEY (id);
2235 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2238 ALTER TABLE ONLY public.user_blocks
2239 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
2243 -- Name: user_mutes user_mutes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2246 ALTER TABLE ONLY public.user_mutes
2247 ADD CONSTRAINT user_mutes_pkey PRIMARY KEY (id);
2251 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2254 ALTER TABLE ONLY public.user_preferences
2255 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
2259 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2262 ALTER TABLE ONLY public.user_roles
2263 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
2267 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2270 ALTER TABLE ONLY public.users
2271 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2275 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2278 ALTER TABLE ONLY public.way_nodes
2279 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2283 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2286 ALTER TABLE ONLY public.way_tags
2287 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2291 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2294 ALTER TABLE ONLY public.ways
2295 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2299 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2302 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2306 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2309 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2313 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2316 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2320 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2323 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2327 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2330 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2334 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2337 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2341 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2344 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2348 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2351 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2355 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2358 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2362 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2365 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2369 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2372 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2376 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2379 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2383 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2386 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2390 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2393 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2397 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2400 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2404 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2407 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2411 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2414 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2418 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2421 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2425 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2428 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2432 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2435 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2439 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2442 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2446 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2449 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2453 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2456 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2460 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2463 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2467 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2470 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2474 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2477 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2481 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2484 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2488 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2491 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2495 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2498 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2502 -- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
2505 CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest);
2509 -- Name: index_changeset_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2512 CREATE INDEX index_changeset_comments_on_author_id_and_created_at ON public.changeset_comments USING btree (author_id, created_at);
2516 -- Name: index_changeset_comments_on_author_id_and_id; Type: INDEX; Schema: public; Owner: -
2519 CREATE INDEX index_changeset_comments_on_author_id_and_id ON public.changeset_comments USING btree (author_id, id);
2523 -- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2526 CREATE INDEX index_changeset_comments_on_changeset_id_and_created_at ON public.changeset_comments USING btree (changeset_id, created_at);
2530 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2533 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2537 -- Name: index_changesets_on_user_id_and_closed_at; Type: INDEX; Schema: public; Owner: -
2540 CREATE INDEX index_changesets_on_user_id_and_closed_at ON public.changesets USING btree (user_id, closed_at);
2544 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2547 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2551 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2554 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2558 -- Name: index_diary_comments_on_user_id_and_id; Type: INDEX; Schema: public; Owner: -
2561 CREATE INDEX index_diary_comments_on_user_id_and_id ON public.diary_comments USING btree (user_id, id);
2565 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2568 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2572 -- Name: index_friends_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2575 CREATE INDEX index_friends_on_user_id_and_created_at ON public.friends USING btree (user_id, created_at);
2579 -- Name: index_gpx_files_on_user_id_and_id; Type: INDEX; Schema: public; Owner: -
2582 CREATE INDEX index_gpx_files_on_user_id_and_id ON public.gpx_files USING btree (user_id, id);
2586 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2589 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2593 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2596 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2600 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2603 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2607 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2610 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2614 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2617 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2621 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2624 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2628 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2631 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2635 -- Name: index_note_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2638 CREATE INDEX index_note_comments_on_author_id_and_created_at ON public.note_comments USING btree (author_id, created_at);
2642 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2645 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2649 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2652 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2656 -- Name: index_note_subscriptions_on_note_id; Type: INDEX; Schema: public; Owner: -
2659 CREATE INDEX index_note_subscriptions_on_note_id ON public.note_subscriptions USING btree (note_id);
2663 -- Name: index_notes_on_description; Type: INDEX; Schema: public; Owner: -
2666 CREATE INDEX index_notes_on_description ON public.notes USING gin (to_tsvector('english'::regconfig, description));
2670 -- Name: index_notes_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2673 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);
2677 -- Name: index_oauth_access_grants_on_application_id; Type: INDEX; Schema: public; Owner: -
2680 CREATE INDEX index_oauth_access_grants_on_application_id ON public.oauth_access_grants USING btree (application_id);
2684 -- Name: index_oauth_access_grants_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2687 CREATE INDEX index_oauth_access_grants_on_resource_owner_id ON public.oauth_access_grants USING btree (resource_owner_id);
2691 -- Name: index_oauth_access_grants_on_token; Type: INDEX; Schema: public; Owner: -
2694 CREATE UNIQUE INDEX index_oauth_access_grants_on_token ON public.oauth_access_grants USING btree (token);
2698 -- Name: index_oauth_access_tokens_on_application_id; Type: INDEX; Schema: public; Owner: -
2701 CREATE INDEX index_oauth_access_tokens_on_application_id ON public.oauth_access_tokens USING btree (application_id);
2705 -- Name: index_oauth_access_tokens_on_refresh_token; Type: INDEX; Schema: public; Owner: -
2708 CREATE UNIQUE INDEX index_oauth_access_tokens_on_refresh_token ON public.oauth_access_tokens USING btree (refresh_token);
2712 -- Name: index_oauth_access_tokens_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2715 CREATE INDEX index_oauth_access_tokens_on_resource_owner_id ON public.oauth_access_tokens USING btree (resource_owner_id);
2719 -- Name: index_oauth_access_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2722 CREATE UNIQUE INDEX index_oauth_access_tokens_on_token ON public.oauth_access_tokens USING btree (token);
2726 -- Name: index_oauth_applications_on_owner_type_and_owner_id; Type: INDEX; Schema: public; Owner: -
2729 CREATE INDEX index_oauth_applications_on_owner_type_and_owner_id ON public.oauth_applications USING btree (owner_type, owner_id);
2733 -- Name: index_oauth_applications_on_uid; Type: INDEX; Schema: public; Owner: -
2736 CREATE UNIQUE INDEX index_oauth_applications_on_uid ON public.oauth_applications USING btree (uid);
2740 -- Name: index_oauth_openid_requests_on_access_grant_id; Type: INDEX; Schema: public; Owner: -
2743 CREATE INDEX index_oauth_openid_requests_on_access_grant_id ON public.oauth_openid_requests USING btree (access_grant_id);
2747 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2750 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2754 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2757 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2761 -- Name: index_social_links_on_user_id; Type: INDEX; Schema: public; Owner: -
2764 CREATE INDEX index_social_links_on_user_id ON public.social_links USING btree (user_id);
2768 -- Name: index_user_blocks_on_creator_id_and_id; Type: INDEX; Schema: public; Owner: -
2771 CREATE INDEX index_user_blocks_on_creator_id_and_id ON public.user_blocks USING btree (creator_id, id);
2775 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2778 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2782 -- Name: index_user_mutes_on_owner_id_and_subject_id; Type: INDEX; Schema: public; Owner: -
2785 CREATE UNIQUE INDEX index_user_mutes_on_owner_id_and_subject_id ON public.user_mutes USING btree (owner_id, subject_id);
2789 -- Name: index_users_on_creation_address; Type: INDEX; Schema: public; Owner: -
2792 CREATE INDEX index_users_on_creation_address ON public.users USING gist (creation_address inet_ops);
2796 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2799 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2803 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2806 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2810 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2813 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2817 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2820 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2824 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2827 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2831 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2834 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2838 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2841 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2845 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2848 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2852 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2855 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2859 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2862 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2866 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2869 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2873 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2876 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2880 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2883 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2887 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2890 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2894 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2897 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2901 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2904 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2908 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2911 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2915 -- Name: users_display_name_canonical_idx; Type: INDEX; Schema: public; Owner: -
2918 CREATE INDEX users_display_name_canonical_idx ON public.users USING btree (lower(NORMALIZE(display_name, NFKC)));
2922 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2925 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2929 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2932 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2936 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2939 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2943 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2946 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2950 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2953 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2957 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2960 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2964 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2967 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2971 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2974 ALTER TABLE ONLY public.changeset_comments
2975 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2979 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2982 ALTER TABLE ONLY public.changeset_comments
2983 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2987 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2990 ALTER TABLE ONLY public.changeset_tags
2991 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2995 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2998 ALTER TABLE ONLY public.changesets_subscribers
2999 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3003 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3006 ALTER TABLE ONLY public.changesets_subscribers
3007 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
3011 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3014 ALTER TABLE ONLY public.changesets
3015 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3019 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3022 ALTER TABLE ONLY public.current_node_tags
3023 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
3027 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3030 ALTER TABLE ONLY public.current_nodes
3031 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3035 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3038 ALTER TABLE ONLY public.current_relation_members
3039 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
3043 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3046 ALTER TABLE ONLY public.current_relation_tags
3047 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
3051 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3054 ALTER TABLE ONLY public.current_relations
3055 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3059 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3062 ALTER TABLE ONLY public.current_way_nodes
3063 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
3067 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3070 ALTER TABLE ONLY public.current_way_nodes
3071 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
3075 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3078 ALTER TABLE ONLY public.current_way_tags
3079 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
3083 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3086 ALTER TABLE ONLY public.current_ways
3087 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3091 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3094 ALTER TABLE ONLY public.diary_comments
3095 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
3099 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3102 ALTER TABLE ONLY public.diary_comments
3103 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3107 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3110 ALTER TABLE ONLY public.diary_entries
3111 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
3115 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3118 ALTER TABLE ONLY public.diary_entries
3119 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3123 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3126 ALTER TABLE ONLY public.diary_entry_subscriptions
3127 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
3131 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3134 ALTER TABLE ONLY public.diary_entry_subscriptions
3135 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3139 -- Name: note_subscriptions fk_rails_2c1913f293; Type: FK CONSTRAINT; Schema: public; Owner: -
3142 ALTER TABLE ONLY public.note_subscriptions
3143 ADD CONSTRAINT fk_rails_2c1913f293 FOREIGN KEY (note_id) REFERENCES public.notes(id);
3147 -- Name: oauth_access_grants fk_rails_330c32d8d9; Type: FK CONSTRAINT; Schema: public; Owner: -
3150 ALTER TABLE ONLY public.oauth_access_grants
3151 ADD CONSTRAINT fk_rails_330c32d8d9 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3155 -- Name: user_mutes fk_rails_591dad3359; Type: FK CONSTRAINT; Schema: public; Owner: -
3158 ALTER TABLE ONLY public.user_mutes
3159 ADD CONSTRAINT fk_rails_591dad3359 FOREIGN KEY (owner_id) REFERENCES public.users(id);
3163 -- Name: social_links fk_rails_6034fd4f62; Type: FK CONSTRAINT; Schema: public; Owner: -
3166 ALTER TABLE ONLY public.social_links
3167 ADD CONSTRAINT fk_rails_6034fd4f62 FOREIGN KEY (user_id) REFERENCES public.users(id);
3171 -- Name: oauth_access_tokens fk_rails_732cb83ab7; Type: FK CONSTRAINT; Schema: public; Owner: -
3174 ALTER TABLE ONLY public.oauth_access_tokens
3175 ADD CONSTRAINT fk_rails_732cb83ab7 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3179 -- Name: oauth_openid_requests fk_rails_77114b3b09; Type: FK CONSTRAINT; Schema: public; Owner: -
3182 ALTER TABLE ONLY public.oauth_openid_requests
3183 ADD CONSTRAINT fk_rails_77114b3b09 FOREIGN KEY (access_grant_id) REFERENCES public.oauth_access_grants(id) ON DELETE CASCADE;
3187 -- Name: active_storage_variant_records fk_rails_993965df05; Type: FK CONSTRAINT; Schema: public; Owner: -
3190 ALTER TABLE ONLY public.active_storage_variant_records
3191 ADD CONSTRAINT fk_rails_993965df05 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3195 -- Name: note_subscriptions fk_rails_a352f4eced; Type: FK CONSTRAINT; Schema: public; Owner: -
3198 ALTER TABLE ONLY public.note_subscriptions
3199 ADD CONSTRAINT fk_rails_a352f4eced FOREIGN KEY (user_id) REFERENCES public.users(id);
3203 -- Name: oauth_access_grants fk_rails_b4b53e07b8; Type: FK CONSTRAINT; Schema: public; Owner: -
3206 ALTER TABLE ONLY public.oauth_access_grants
3207 ADD CONSTRAINT fk_rails_b4b53e07b8 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3211 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
3214 ALTER TABLE ONLY public.active_storage_attachments
3215 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3219 -- Name: oauth_applications fk_rails_cc886e315a; Type: FK CONSTRAINT; Schema: public; Owner: -
3222 ALTER TABLE ONLY public.oauth_applications
3223 ADD CONSTRAINT fk_rails_cc886e315a FOREIGN KEY (owner_id) REFERENCES public.users(id) NOT VALID;
3227 -- Name: user_mutes fk_rails_e9dd4fb6c3; Type: FK CONSTRAINT; Schema: public; Owner: -
3230 ALTER TABLE ONLY public.user_mutes
3231 ADD CONSTRAINT fk_rails_e9dd4fb6c3 FOREIGN KEY (subject_id) REFERENCES public.users(id);
3235 -- Name: oauth_access_tokens fk_rails_ee63f25419; Type: FK CONSTRAINT; Schema: public; Owner: -
3238 ALTER TABLE ONLY public.oauth_access_tokens
3239 ADD CONSTRAINT fk_rails_ee63f25419 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3243 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3246 ALTER TABLE ONLY public.friends
3247 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
3251 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3254 ALTER TABLE ONLY public.friends
3255 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3259 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3262 ALTER TABLE ONLY public.gps_points
3263 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3267 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3270 ALTER TABLE ONLY public.gpx_file_tags
3271 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3275 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3278 ALTER TABLE ONLY public.gpx_files
3279 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3283 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3286 ALTER TABLE ONLY public.issue_comments
3287 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3291 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3294 ALTER TABLE ONLY public.issue_comments
3295 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3299 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3302 ALTER TABLE ONLY public.issues
3303 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
3307 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3310 ALTER TABLE ONLY public.issues
3311 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
3315 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3318 ALTER TABLE ONLY public.issues
3319 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
3323 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3326 ALTER TABLE ONLY public.messages
3327 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
3331 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3334 ALTER TABLE ONLY public.messages
3335 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
3339 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3342 ALTER TABLE ONLY public.node_tags
3343 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
3347 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3350 ALTER TABLE ONLY public.nodes
3351 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3355 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3358 ALTER TABLE ONLY public.nodes
3359 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3363 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3366 ALTER TABLE ONLY public.note_comments
3367 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
3371 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3374 ALTER TABLE ONLY public.note_comments
3375 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
3379 -- Name: notes notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3382 ALTER TABLE ONLY public.notes
3383 ADD CONSTRAINT notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3387 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3390 ALTER TABLE ONLY public.redactions
3391 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3395 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3398 ALTER TABLE ONLY public.relation_members
3399 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3403 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3406 ALTER TABLE ONLY public.relation_tags
3407 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3411 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3414 ALTER TABLE ONLY public.relations
3415 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3419 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3422 ALTER TABLE ONLY public.relations
3423 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3427 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3430 ALTER TABLE ONLY public.reports
3431 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3435 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3438 ALTER TABLE ONLY public.reports
3439 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3443 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3446 ALTER TABLE ONLY public.user_blocks
3447 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
3451 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3454 ALTER TABLE ONLY public.user_blocks
3455 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
3459 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3462 ALTER TABLE ONLY public.user_blocks
3463 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3467 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3470 ALTER TABLE ONLY public.user_preferences
3471 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3475 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3478 ALTER TABLE ONLY public.user_roles
3479 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3483 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3486 ALTER TABLE ONLY public.user_roles
3487 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3491 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3494 ALTER TABLE ONLY public.way_nodes
3495 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3499 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3502 ALTER TABLE ONLY public.way_tags
3503 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3507 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3510 ALTER TABLE ONLY public.ways
3511 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3515 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3518 ALTER TABLE ONLY public.ways
3519 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3523 -- PostgreSQL database dump complete
3526 SET search_path TO "$user", public;
3528 INSERT INTO "schema_migrations" (version) VALUES