1 SET statement_timeout = 0;
3 SET idle_in_transaction_session_timeout = 0;
4 SET client_encoding = 'UTF8';
5 SET standard_conforming_strings = on;
6 SELECT pg_catalog.set_config('search_path', '', false);
7 SET check_function_bodies = false;
8 SET xmloption = content;
9 SET client_min_messages = warning;
10 SET row_security = off;
13 -- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: -
16 CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public;
20 -- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: -
23 COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST';
27 -- Name: format_enum; Type: TYPE; Schema: public; Owner: -
30 CREATE TYPE public.format_enum AS ENUM (
38 -- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: -
41 CREATE TYPE public.gpx_visibility_enum AS ENUM (
50 -- Name: issue_status_enum; Type: TYPE; Schema: public; Owner: -
53 CREATE TYPE public.issue_status_enum AS ENUM (
61 -- Name: note_event_enum; Type: TYPE; Schema: public; Owner: -
64 CREATE TYPE public.note_event_enum AS ENUM (
74 -- Name: note_status_enum; Type: TYPE; Schema: public; Owner: -
77 CREATE TYPE public.note_status_enum AS ENUM (
85 -- Name: nwr_enum; Type: TYPE; Schema: public; Owner: -
88 CREATE TYPE public.nwr_enum AS ENUM (
96 -- Name: user_role_enum; Type: TYPE; Schema: public; Owner: -
99 CREATE TYPE public.user_role_enum AS ENUM (
107 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
110 CREATE TYPE public.user_status_enum AS ENUM (
120 -- Name: api_rate_limit(bigint); Type: FUNCTION; Schema: public; Owner: -
123 CREATE FUNCTION public.api_rate_limit(user_id bigint) RETURNS integer
124 LANGUAGE plpgsql STABLE
127 min_changes_per_hour int4 := 100;
128 initial_changes_per_hour int4 := 1000;
129 max_changes_per_hour int4 := 100000;
130 days_to_max_changes int4 := 7;
131 importer_changes_per_hour int4 := 1000000;
132 moderator_changes_per_hour int4 := 1000000;
134 last_block timestamp without time zone;
135 first_change timestamp without time zone;
137 time_since_first_change double precision;
138 max_changes double precision;
141 SELECT ARRAY_AGG(user_roles.role) INTO STRICT roles FROM user_roles WHERE user_roles.user_id = api_rate_limit.user_id;
143 IF 'moderator' = ANY(roles) THEN
144 max_changes := moderator_changes_per_hour;
145 ELSIF 'importer' = ANY(roles) THEN
146 max_changes := importer_changes_per_hour;
148 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;
151 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;
153 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;
157 first_change := CURRENT_TIMESTAMP AT TIME ZONE 'UTC';
160 SELECT COUNT(*) INTO STRICT active_reports
161 FROM issues INNER JOIN reports ON reports.issue_id = issues.id
162 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');
164 time_since_first_change := EXTRACT(EPOCH FROM CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - first_change);
166 max_changes := max_changes_per_hour * POWER(time_since_first_change, 2) / POWER(days_to_max_changes * 24 * 60 * 60, 2);
167 max_changes := GREATEST(initial_changes_per_hour, LEAST(max_changes_per_hour, FLOOR(max_changes)));
168 max_changes := max_changes / POWER(2, active_reports);
169 max_changes := GREATEST(min_changes_per_hour, LEAST(max_changes_per_hour, max_changes));
172 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;
174 RETURN max_changes - recent_changes;
180 -- Name: api_size_limit(bigint); Type: FUNCTION; Schema: public; Owner: -
183 CREATE FUNCTION public.api_size_limit(user_id bigint) RETURNS bigint
184 LANGUAGE plpgsql STABLE
187 min_size_limit int8 := 10000000;
188 initial_size_limit int8 := 30000000;
189 max_size_limit int8 := 5400000000;
190 days_to_max_size_limit int4 := 28;
191 importer_size_limit int8 := 5400000000;
192 moderator_size_limit int8 := 5400000000;
194 last_block timestamp without time zone;
195 first_change timestamp without time zone;
197 time_since_first_change double precision;
200 SELECT ARRAY_AGG(user_roles.role) INTO STRICT roles FROM user_roles WHERE user_roles.user_id = api_size_limit.user_id;
202 IF 'moderator' = ANY(roles) THEN
203 size_limit := moderator_size_limit;
204 ELSIF 'importer' = ANY(roles) THEN
205 size_limit := importer_size_limit;
207 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;
210 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;
212 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;
216 first_change := CURRENT_TIMESTAMP AT TIME ZONE 'UTC';
219 SELECT COUNT(*) INTO STRICT active_reports
220 FROM issues INNER JOIN reports ON reports.issue_id = issues.id
221 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');
223 time_since_first_change := EXTRACT(EPOCH FROM CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - first_change);
225 size_limit := max_size_limit * POWER(time_since_first_change, 2) / POWER(days_to_max_size_limit * 24 * 60 * 60, 2);
226 size_limit := GREATEST(initial_size_limit, LEAST(max_size_limit, FLOOR(size_limit)));
227 size_limit := size_limit / POWER(2, active_reports);
228 size_limit := GREATEST(min_size_limit, LEAST(max_size_limit, size_limit));
236 SET default_tablespace = '';
238 SET default_table_access_method = heap;
241 -- Name: acls; Type: TABLE; Schema: public; Owner: -
244 CREATE TABLE public.acls (
247 k character varying NOT NULL,
249 domain character varying,
255 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
258 CREATE SEQUENCE public.acls_id_seq
267 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
270 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
274 -- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
277 CREATE TABLE public.active_storage_attachments (
279 name character varying NOT NULL,
280 record_type character varying NOT NULL,
281 record_id bigint NOT NULL,
282 blob_id bigint NOT NULL,
283 created_at timestamp without time zone NOT NULL
288 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
291 CREATE SEQUENCE public.active_storage_attachments_id_seq
300 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
303 ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
307 -- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
310 CREATE TABLE public.active_storage_blobs (
312 key character varying NOT NULL,
313 filename character varying NOT NULL,
314 content_type character varying,
316 byte_size bigint NOT NULL,
317 checksum character varying,
318 created_at timestamp without time zone NOT NULL,
319 service_name character varying NOT NULL
324 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
327 CREATE SEQUENCE public.active_storage_blobs_id_seq
336 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
339 ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
343 -- Name: active_storage_variant_records; Type: TABLE; Schema: public; Owner: -
346 CREATE TABLE public.active_storage_variant_records (
348 blob_id bigint NOT NULL,
349 variation_digest character varying NOT NULL
354 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE; Schema: public; Owner: -
357 CREATE SEQUENCE public.active_storage_variant_records_id_seq
366 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
369 ALTER SEQUENCE public.active_storage_variant_records_id_seq OWNED BY public.active_storage_variant_records.id;
373 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
376 CREATE TABLE public.ar_internal_metadata (
377 key character varying NOT NULL,
378 value character varying,
379 created_at timestamp(6) without time zone NOT NULL,
380 updated_at timestamp(6) without time zone NOT NULL
385 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
388 CREATE TABLE public.changeset_comments (
390 changeset_id bigint NOT NULL,
391 author_id bigint NOT NULL,
393 created_at timestamp without time zone NOT NULL,
394 visible boolean NOT NULL
399 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
402 CREATE SEQUENCE public.changeset_comments_id_seq
412 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
415 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
419 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
422 CREATE TABLE public.changeset_tags (
423 changeset_id bigint NOT NULL,
424 k character varying DEFAULT ''::character varying NOT NULL,
425 v character varying DEFAULT ''::character varying NOT NULL
430 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
433 CREATE TABLE public.changesets (
435 user_id bigint NOT NULL,
436 created_at timestamp without time zone NOT NULL,
441 closed_at timestamp without time zone NOT NULL,
442 num_changes integer DEFAULT 0 NOT NULL
447 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
450 CREATE SEQUENCE public.changesets_id_seq
459 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
462 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
466 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
469 CREATE TABLE public.changesets_subscribers (
470 subscriber_id bigint NOT NULL,
471 changeset_id bigint NOT NULL
476 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
479 CREATE TABLE public.client_applications (
481 name character varying,
482 url character varying,
483 support_url character varying,
484 callback_url character varying,
485 key character varying(50),
486 secret character varying(50),
488 created_at timestamp without time zone,
489 updated_at timestamp without time zone,
490 allow_read_prefs boolean DEFAULT false NOT NULL,
491 allow_write_prefs boolean DEFAULT false NOT NULL,
492 allow_write_diary boolean DEFAULT false NOT NULL,
493 allow_write_api boolean DEFAULT false NOT NULL,
494 allow_read_gpx boolean DEFAULT false NOT NULL,
495 allow_write_gpx boolean DEFAULT false NOT NULL,
496 allow_write_notes boolean DEFAULT false NOT NULL
501 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
504 CREATE SEQUENCE public.client_applications_id_seq
514 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
517 ALTER SEQUENCE public.client_applications_id_seq OWNED BY public.client_applications.id;
521 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
524 CREATE TABLE public.current_node_tags (
525 node_id bigint NOT NULL,
526 k character varying DEFAULT ''::character varying NOT NULL,
527 v character varying DEFAULT ''::character varying NOT NULL
532 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
535 CREATE TABLE public.current_nodes (
537 latitude integer NOT NULL,
538 longitude integer NOT NULL,
539 changeset_id bigint NOT NULL,
540 visible boolean NOT NULL,
541 "timestamp" timestamp without time zone NOT NULL,
542 tile bigint NOT NULL,
543 version bigint NOT NULL
548 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
551 CREATE SEQUENCE public.current_nodes_id_seq
560 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
563 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
567 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
570 CREATE TABLE public.current_relation_members (
571 relation_id bigint NOT NULL,
572 member_type public.nwr_enum NOT NULL,
573 member_id bigint NOT NULL,
574 member_role character varying NOT NULL,
575 sequence_id integer DEFAULT 0 NOT NULL
580 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
583 CREATE TABLE public.current_relation_tags (
584 relation_id bigint NOT NULL,
585 k character varying DEFAULT ''::character varying NOT NULL,
586 v character varying DEFAULT ''::character varying NOT NULL
591 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
594 CREATE TABLE public.current_relations (
596 changeset_id bigint NOT NULL,
597 "timestamp" timestamp without time zone NOT NULL,
598 visible boolean NOT NULL,
599 version bigint NOT NULL
604 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
607 CREATE SEQUENCE public.current_relations_id_seq
616 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
619 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
623 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
626 CREATE TABLE public.current_way_nodes (
627 way_id bigint NOT NULL,
628 node_id bigint NOT NULL,
629 sequence_id bigint NOT NULL
634 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
637 CREATE TABLE public.current_way_tags (
638 way_id bigint NOT NULL,
639 k character varying DEFAULT ''::character varying NOT NULL,
640 v character varying DEFAULT ''::character varying NOT NULL
645 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
648 CREATE TABLE public.current_ways (
650 changeset_id bigint NOT NULL,
651 "timestamp" timestamp without time zone NOT NULL,
652 visible boolean NOT NULL,
653 version bigint NOT NULL
658 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
661 CREATE SEQUENCE public.current_ways_id_seq
670 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
673 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
677 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
680 CREATE TABLE public.delayed_jobs (
682 priority integer DEFAULT 0 NOT NULL,
683 attempts integer DEFAULT 0 NOT NULL,
684 handler text NOT NULL,
686 run_at timestamp without time zone,
687 locked_at timestamp without time zone,
688 failed_at timestamp without time zone,
689 locked_by character varying,
690 queue character varying,
691 created_at timestamp without time zone,
692 updated_at timestamp without time zone
697 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
700 CREATE SEQUENCE public.delayed_jobs_id_seq
709 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
712 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
716 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
719 CREATE TABLE public.diary_comments (
721 diary_entry_id bigint NOT NULL,
722 user_id bigint NOT NULL,
724 created_at timestamp without time zone NOT NULL,
725 updated_at timestamp without time zone NOT NULL,
726 visible boolean DEFAULT true NOT NULL,
727 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
732 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
735 CREATE SEQUENCE public.diary_comments_id_seq
744 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
747 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
751 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
754 CREATE TABLE public.diary_entries (
756 user_id bigint NOT NULL,
757 title character varying NOT NULL,
759 created_at timestamp without time zone NOT NULL,
760 updated_at timestamp without time zone NOT NULL,
761 latitude double precision,
762 longitude double precision,
763 language_code character varying DEFAULT 'en'::character varying NOT NULL,
764 visible boolean DEFAULT true NOT NULL,
765 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
770 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
773 CREATE SEQUENCE public.diary_entries_id_seq
782 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
785 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
789 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
792 CREATE TABLE public.diary_entry_subscriptions (
793 user_id bigint NOT NULL,
794 diary_entry_id bigint NOT NULL
799 -- Name: friends; Type: TABLE; Schema: public; Owner: -
802 CREATE TABLE public.friends (
804 user_id bigint NOT NULL,
805 friend_user_id bigint NOT NULL,
806 created_at timestamp without time zone
811 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
814 CREATE SEQUENCE public.friends_id_seq
823 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
826 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
830 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
833 CREATE TABLE public.gps_points (
834 altitude double precision,
835 trackid integer NOT NULL,
836 latitude integer NOT NULL,
837 longitude integer NOT NULL,
838 gpx_id bigint NOT NULL,
839 "timestamp" timestamp without time zone,
845 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
848 CREATE TABLE public.gpx_file_tags (
849 gpx_id bigint NOT NULL,
850 tag character varying NOT NULL,
856 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
859 CREATE SEQUENCE public.gpx_file_tags_id_seq
868 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
871 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
875 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
878 CREATE TABLE public.gpx_files (
880 user_id bigint NOT NULL,
881 visible boolean DEFAULT true NOT NULL,
882 name character varying DEFAULT ''::character varying NOT NULL,
884 latitude double precision,
885 longitude double precision,
886 "timestamp" timestamp without time zone NOT NULL,
887 description character varying DEFAULT ''::character varying NOT NULL,
888 inserted boolean NOT NULL,
889 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
894 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
897 CREATE SEQUENCE public.gpx_files_id_seq
906 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
909 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
913 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
916 CREATE TABLE public.issue_comments (
918 issue_id integer NOT NULL,
919 user_id integer NOT NULL,
921 created_at timestamp without time zone NOT NULL,
922 updated_at timestamp without time zone NOT NULL
927 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
930 CREATE SEQUENCE public.issue_comments_id_seq
940 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
943 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
947 -- Name: issues; Type: TABLE; Schema: public; Owner: -
950 CREATE TABLE public.issues (
952 reportable_type character varying NOT NULL,
953 reportable_id integer NOT NULL,
954 reported_user_id integer,
955 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
956 assigned_role public.user_role_enum NOT NULL,
957 resolved_at timestamp without time zone,
960 reports_count integer DEFAULT 0,
961 created_at timestamp without time zone NOT NULL,
962 updated_at timestamp without time zone NOT NULL
967 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
970 CREATE SEQUENCE public.issues_id_seq
980 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
983 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
987 -- Name: languages; Type: TABLE; Schema: public; Owner: -
990 CREATE TABLE public.languages (
991 code character varying NOT NULL,
992 english_name character varying NOT NULL,
993 native_name character varying
998 -- Name: messages; Type: TABLE; Schema: public; Owner: -
1001 CREATE TABLE public.messages (
1003 from_user_id bigint NOT NULL,
1004 title character varying NOT NULL,
1006 sent_on timestamp without time zone NOT NULL,
1007 message_read boolean DEFAULT false NOT NULL,
1008 to_user_id bigint NOT NULL,
1009 to_user_visible boolean DEFAULT true NOT NULL,
1010 from_user_visible boolean DEFAULT true NOT NULL,
1011 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1012 muted boolean DEFAULT false NOT NULL
1017 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1020 CREATE SEQUENCE public.messages_id_seq
1029 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1032 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
1036 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
1039 CREATE TABLE public.node_tags (
1040 node_id bigint NOT NULL,
1041 version bigint NOT NULL,
1042 k character varying DEFAULT ''::character varying NOT NULL,
1043 v character varying DEFAULT ''::character varying NOT NULL
1048 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
1051 CREATE TABLE public.nodes (
1052 node_id bigint NOT NULL,
1053 latitude integer NOT NULL,
1054 longitude integer NOT NULL,
1055 changeset_id bigint NOT NULL,
1056 visible boolean NOT NULL,
1057 "timestamp" timestamp without time zone NOT NULL,
1058 tile bigint NOT NULL,
1059 version bigint NOT NULL,
1060 redaction_id integer
1065 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
1068 CREATE TABLE public.note_comments (
1070 note_id bigint NOT NULL,
1071 visible boolean NOT NULL,
1072 created_at timestamp without time zone NOT NULL,
1076 event public.note_event_enum
1081 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1084 CREATE SEQUENCE public.note_comments_id_seq
1093 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1096 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
1100 -- Name: notes; Type: TABLE; Schema: public; Owner: -
1103 CREATE TABLE public.notes (
1105 latitude integer NOT NULL,
1106 longitude integer NOT NULL,
1107 tile bigint NOT NULL,
1108 updated_at timestamp without time zone NOT NULL,
1109 created_at timestamp without time zone NOT NULL,
1110 status public.note_status_enum NOT NULL,
1111 closed_at timestamp without time zone
1116 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1119 CREATE SEQUENCE public.notes_id_seq
1128 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1131 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
1135 -- Name: oauth_access_grants; Type: TABLE; Schema: public; Owner: -
1138 CREATE TABLE public.oauth_access_grants (
1140 resource_owner_id bigint NOT NULL,
1141 application_id bigint NOT NULL,
1142 token character varying NOT NULL,
1143 expires_in integer NOT NULL,
1144 redirect_uri text NOT NULL,
1145 created_at timestamp without time zone NOT NULL,
1146 revoked_at timestamp without time zone,
1147 scopes character varying DEFAULT ''::character varying NOT NULL,
1148 code_challenge character varying,
1149 code_challenge_method character varying
1154 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1157 CREATE SEQUENCE public.oauth_access_grants_id_seq
1166 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1169 ALTER SEQUENCE public.oauth_access_grants_id_seq OWNED BY public.oauth_access_grants.id;
1173 -- Name: oauth_access_tokens; Type: TABLE; Schema: public; Owner: -
1176 CREATE TABLE public.oauth_access_tokens (
1178 resource_owner_id bigint,
1179 application_id bigint NOT NULL,
1180 token character varying NOT NULL,
1181 refresh_token character varying,
1183 revoked_at timestamp without time zone,
1184 created_at timestamp without time zone NOT NULL,
1185 scopes character varying,
1186 previous_refresh_token character varying DEFAULT ''::character varying NOT NULL
1191 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1194 CREATE SEQUENCE public.oauth_access_tokens_id_seq
1203 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1206 ALTER SEQUENCE public.oauth_access_tokens_id_seq OWNED BY public.oauth_access_tokens.id;
1210 -- Name: oauth_applications; Type: TABLE; Schema: public; Owner: -
1213 CREATE TABLE public.oauth_applications (
1215 owner_type character varying NOT NULL,
1216 owner_id bigint NOT NULL,
1217 name character varying NOT NULL,
1218 uid character varying NOT NULL,
1219 secret character varying NOT NULL,
1220 redirect_uri text NOT NULL,
1221 scopes character varying DEFAULT ''::character varying NOT NULL,
1222 confidential boolean DEFAULT true NOT NULL,
1223 created_at timestamp(6) without time zone NOT NULL,
1224 updated_at timestamp(6) without time zone NOT NULL
1229 -- Name: oauth_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1232 CREATE SEQUENCE public.oauth_applications_id_seq
1241 -- Name: oauth_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1244 ALTER SEQUENCE public.oauth_applications_id_seq OWNED BY public.oauth_applications.id;
1248 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
1251 CREATE TABLE public.oauth_nonces (
1253 nonce character varying,
1254 "timestamp" integer,
1255 created_at timestamp without time zone,
1256 updated_at timestamp without time zone
1261 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1264 CREATE SEQUENCE public.oauth_nonces_id_seq
1273 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1276 ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id;
1280 -- Name: oauth_openid_requests; Type: TABLE; Schema: public; Owner: -
1283 CREATE TABLE public.oauth_openid_requests (
1285 access_grant_id bigint NOT NULL,
1286 nonce character varying NOT NULL
1291 -- Name: oauth_openid_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1294 CREATE SEQUENCE public.oauth_openid_requests_id_seq
1303 -- Name: oauth_openid_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1306 ALTER SEQUENCE public.oauth_openid_requests_id_seq OWNED BY public.oauth_openid_requests.id;
1310 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
1313 CREATE TABLE public.oauth_tokens (
1314 id integer NOT NULL,
1316 type character varying(20),
1317 client_application_id integer,
1318 token character varying(50),
1319 secret character varying(50),
1320 authorized_at timestamp without time zone,
1321 invalidated_at timestamp without time zone,
1322 created_at timestamp without time zone,
1323 updated_at timestamp without time zone,
1324 allow_read_prefs boolean DEFAULT false NOT NULL,
1325 allow_write_prefs boolean DEFAULT false NOT NULL,
1326 allow_write_diary boolean DEFAULT false NOT NULL,
1327 allow_write_api boolean DEFAULT false NOT NULL,
1328 allow_read_gpx boolean DEFAULT false NOT NULL,
1329 allow_write_gpx boolean DEFAULT false NOT NULL,
1330 callback_url character varying,
1331 verifier character varying(20),
1332 scope character varying,
1333 valid_to timestamp without time zone,
1334 allow_write_notes boolean DEFAULT false NOT NULL
1339 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1342 CREATE SEQUENCE public.oauth_tokens_id_seq
1352 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1355 ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
1359 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1362 CREATE TABLE public.redactions (
1363 id integer NOT NULL,
1364 title character varying NOT NULL,
1365 description text NOT NULL,
1366 created_at timestamp without time zone,
1367 updated_at timestamp without time zone,
1368 user_id bigint NOT NULL,
1369 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1374 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1377 CREATE SEQUENCE public.redactions_id_seq
1387 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1390 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1394 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1397 CREATE TABLE public.relation_members (
1398 relation_id bigint NOT NULL,
1399 member_type public.nwr_enum NOT NULL,
1400 member_id bigint NOT NULL,
1401 member_role character varying NOT NULL,
1402 version bigint DEFAULT 0 NOT NULL,
1403 sequence_id integer DEFAULT 0 NOT NULL
1408 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1411 CREATE TABLE public.relation_tags (
1412 relation_id bigint NOT NULL,
1413 k character varying DEFAULT ''::character varying NOT NULL,
1414 v character varying DEFAULT ''::character varying NOT NULL,
1415 version bigint NOT NULL
1420 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1423 CREATE TABLE public.relations (
1424 relation_id bigint NOT NULL,
1425 changeset_id bigint NOT NULL,
1426 "timestamp" timestamp without time zone NOT NULL,
1427 version bigint NOT NULL,
1428 visible boolean DEFAULT true NOT NULL,
1429 redaction_id integer
1434 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1437 CREATE TABLE public.reports (
1438 id integer NOT NULL,
1439 issue_id integer NOT NULL,
1440 user_id integer NOT NULL,
1441 details text NOT NULL,
1442 category character varying NOT NULL,
1443 created_at timestamp without time zone NOT NULL,
1444 updated_at timestamp without time zone NOT NULL
1449 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1452 CREATE SEQUENCE public.reports_id_seq
1462 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1465 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1469 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1472 CREATE TABLE public.schema_migrations (
1473 version character varying NOT NULL
1478 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1481 CREATE TABLE public.user_blocks (
1482 id integer NOT NULL,
1483 user_id bigint NOT NULL,
1484 creator_id bigint NOT NULL,
1485 reason text NOT NULL,
1486 ends_at timestamp without time zone NOT NULL,
1487 needs_view boolean DEFAULT false NOT NULL,
1489 created_at timestamp without time zone,
1490 updated_at timestamp without time zone,
1491 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1492 deactivates_at timestamp without time zone
1497 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1500 CREATE SEQUENCE public.user_blocks_id_seq
1510 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1513 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1517 -- Name: user_mutes; Type: TABLE; Schema: public; Owner: -
1520 CREATE TABLE public.user_mutes (
1522 owner_id bigint NOT NULL,
1523 subject_id bigint NOT NULL,
1524 created_at timestamp(6) without time zone NOT NULL,
1525 updated_at timestamp(6) without time zone NOT NULL
1530 -- Name: user_mutes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1533 CREATE SEQUENCE public.user_mutes_id_seq
1542 -- Name: user_mutes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1545 ALTER SEQUENCE public.user_mutes_id_seq OWNED BY public.user_mutes.id;
1549 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1552 CREATE TABLE public.user_preferences (
1553 user_id bigint NOT NULL,
1554 k character varying NOT NULL,
1555 v character varying NOT NULL
1560 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1563 CREATE TABLE public.user_roles (
1564 id integer NOT NULL,
1565 user_id bigint NOT NULL,
1566 role public.user_role_enum NOT NULL,
1567 created_at timestamp without time zone,
1568 updated_at timestamp without time zone,
1569 granter_id bigint NOT NULL
1574 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1577 CREATE SEQUENCE public.user_roles_id_seq
1587 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1590 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1594 -- Name: users; Type: TABLE; Schema: public; Owner: -
1597 CREATE TABLE public.users (
1598 email character varying NOT NULL,
1600 pass_crypt character varying NOT NULL,
1601 creation_time timestamp without time zone NOT NULL,
1602 display_name character varying DEFAULT ''::character varying NOT NULL,
1603 data_public boolean DEFAULT false NOT NULL,
1604 description text DEFAULT ''::text NOT NULL,
1605 home_lat double precision,
1606 home_lon double precision,
1607 home_zoom smallint DEFAULT 3,
1608 pass_salt character varying,
1609 email_valid boolean DEFAULT false NOT NULL,
1610 new_email character varying,
1611 creation_ip character varying,
1612 languages character varying,
1613 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1614 terms_agreed timestamp without time zone,
1615 consider_pd boolean DEFAULT false NOT NULL,
1616 auth_uid character varying,
1617 preferred_editor character varying,
1618 terms_seen boolean DEFAULT false NOT NULL,
1619 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1620 changesets_count integer DEFAULT 0 NOT NULL,
1621 traces_count integer DEFAULT 0 NOT NULL,
1622 diary_entries_count integer DEFAULT 0 NOT NULL,
1623 image_use_gravatar boolean DEFAULT false NOT NULL,
1624 auth_provider character varying,
1626 tou_agreed timestamp without time zone,
1627 diary_comments_count integer DEFAULT 0,
1628 note_comments_count integer DEFAULT 0
1633 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1636 CREATE SEQUENCE public.users_id_seq
1645 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1648 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1652 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1655 CREATE TABLE public.way_nodes (
1656 way_id bigint NOT NULL,
1657 node_id bigint NOT NULL,
1658 version bigint NOT NULL,
1659 sequence_id bigint NOT NULL
1664 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1667 CREATE TABLE public.way_tags (
1668 way_id bigint NOT NULL,
1669 k character varying NOT NULL,
1670 v character varying NOT NULL,
1671 version bigint NOT NULL
1676 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1679 CREATE TABLE public.ways (
1680 way_id bigint NOT NULL,
1681 changeset_id bigint NOT NULL,
1682 "timestamp" timestamp without time zone NOT NULL,
1683 version bigint NOT NULL,
1684 visible boolean DEFAULT true NOT NULL,
1685 redaction_id integer
1690 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1693 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1697 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1700 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1704 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1707 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1711 -- Name: active_storage_variant_records id; Type: DEFAULT; Schema: public; Owner: -
1714 ALTER TABLE ONLY public.active_storage_variant_records ALTER COLUMN id SET DEFAULT nextval('public.active_storage_variant_records_id_seq'::regclass);
1718 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1721 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1725 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1728 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1732 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1735 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1739 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1742 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1746 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1749 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1753 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1756 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1760 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1763 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1767 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1770 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1774 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1777 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1781 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1784 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1788 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1791 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1795 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1798 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1802 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1805 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1809 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1812 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1816 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1819 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1823 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1826 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1830 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1833 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1837 -- Name: oauth_access_grants id; Type: DEFAULT; Schema: public; Owner: -
1840 ALTER TABLE ONLY public.oauth_access_grants ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_grants_id_seq'::regclass);
1844 -- Name: oauth_access_tokens id; Type: DEFAULT; Schema: public; Owner: -
1847 ALTER TABLE ONLY public.oauth_access_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_tokens_id_seq'::regclass);
1851 -- Name: oauth_applications id; Type: DEFAULT; Schema: public; Owner: -
1854 ALTER TABLE ONLY public.oauth_applications ALTER COLUMN id SET DEFAULT nextval('public.oauth_applications_id_seq'::regclass);
1858 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1861 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1865 -- Name: oauth_openid_requests id; Type: DEFAULT; Schema: public; Owner: -
1868 ALTER TABLE ONLY public.oauth_openid_requests ALTER COLUMN id SET DEFAULT nextval('public.oauth_openid_requests_id_seq'::regclass);
1872 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1875 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1879 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1882 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1886 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1889 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1893 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1896 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1900 -- Name: user_mutes id; Type: DEFAULT; Schema: public; Owner: -
1903 ALTER TABLE ONLY public.user_mutes ALTER COLUMN id SET DEFAULT nextval('public.user_mutes_id_seq'::regclass);
1907 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1910 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1914 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1917 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1921 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1924 ALTER TABLE ONLY public.acls
1925 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1929 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1932 ALTER TABLE ONLY public.active_storage_attachments
1933 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1937 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1940 ALTER TABLE ONLY public.active_storage_blobs
1941 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1945 -- Name: active_storage_variant_records active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1948 ALTER TABLE ONLY public.active_storage_variant_records
1949 ADD CONSTRAINT active_storage_variant_records_pkey PRIMARY KEY (id);
1953 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1956 ALTER TABLE ONLY public.ar_internal_metadata
1957 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1961 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1964 ALTER TABLE ONLY public.changeset_comments
1965 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1969 -- Name: changeset_tags changeset_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1972 ALTER TABLE ONLY public.changeset_tags
1973 ADD CONSTRAINT changeset_tags_pkey PRIMARY KEY (changeset_id, k);
1977 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1980 ALTER TABLE ONLY public.changesets
1981 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1985 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1988 ALTER TABLE ONLY public.client_applications
1989 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1993 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1996 ALTER TABLE ONLY public.current_node_tags
1997 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
2001 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
2004 ALTER TABLE ONLY public.current_nodes
2005 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
2009 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2012 ALTER TABLE ONLY public.current_relation_members
2013 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, sequence_id);
2017 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2020 ALTER TABLE ONLY public.current_relation_tags
2021 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
2025 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2028 ALTER TABLE ONLY public.current_relations
2029 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
2033 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2036 ALTER TABLE ONLY public.current_way_nodes
2037 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
2041 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2044 ALTER TABLE ONLY public.current_way_tags
2045 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
2049 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2052 ALTER TABLE ONLY public.current_ways
2053 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
2057 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2060 ALTER TABLE ONLY public.delayed_jobs
2061 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
2065 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2068 ALTER TABLE ONLY public.diary_comments
2069 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
2073 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2076 ALTER TABLE ONLY public.diary_entries
2077 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
2081 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2084 ALTER TABLE ONLY public.diary_entry_subscriptions
2085 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
2089 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2092 ALTER TABLE ONLY public.friends
2093 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
2097 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2100 ALTER TABLE ONLY public.gpx_file_tags
2101 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
2105 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2108 ALTER TABLE ONLY public.gpx_files
2109 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
2113 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2116 ALTER TABLE ONLY public.issue_comments
2117 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
2121 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2124 ALTER TABLE ONLY public.issues
2125 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
2129 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2132 ALTER TABLE ONLY public.languages
2133 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
2137 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2140 ALTER TABLE ONLY public.messages
2141 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
2145 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2148 ALTER TABLE ONLY public.node_tags
2149 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
2153 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2156 ALTER TABLE ONLY public.nodes
2157 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
2161 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2164 ALTER TABLE ONLY public.note_comments
2165 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
2169 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2172 ALTER TABLE ONLY public.notes
2173 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
2177 -- Name: oauth_access_grants oauth_access_grants_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2180 ALTER TABLE ONLY public.oauth_access_grants
2181 ADD CONSTRAINT oauth_access_grants_pkey PRIMARY KEY (id);
2185 -- Name: oauth_access_tokens oauth_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2188 ALTER TABLE ONLY public.oauth_access_tokens
2189 ADD CONSTRAINT oauth_access_tokens_pkey PRIMARY KEY (id);
2193 -- Name: oauth_applications oauth_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2196 ALTER TABLE ONLY public.oauth_applications
2197 ADD CONSTRAINT oauth_applications_pkey PRIMARY KEY (id);
2201 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2204 ALTER TABLE ONLY public.oauth_nonces
2205 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
2209 -- Name: oauth_openid_requests oauth_openid_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2212 ALTER TABLE ONLY public.oauth_openid_requests
2213 ADD CONSTRAINT oauth_openid_requests_pkey PRIMARY KEY (id);
2217 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2220 ALTER TABLE ONLY public.oauth_tokens
2221 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
2225 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2228 ALTER TABLE ONLY public.redactions
2229 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
2233 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2236 ALTER TABLE ONLY public.relation_members
2237 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, sequence_id);
2241 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2244 ALTER TABLE ONLY public.relation_tags
2245 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
2249 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2252 ALTER TABLE ONLY public.relations
2253 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
2257 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2260 ALTER TABLE ONLY public.reports
2261 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
2265 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2268 ALTER TABLE ONLY public.schema_migrations
2269 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
2273 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2276 ALTER TABLE ONLY public.user_blocks
2277 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
2281 -- Name: user_mutes user_mutes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2284 ALTER TABLE ONLY public.user_mutes
2285 ADD CONSTRAINT user_mutes_pkey PRIMARY KEY (id);
2289 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2292 ALTER TABLE ONLY public.user_preferences
2293 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
2297 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2300 ALTER TABLE ONLY public.user_roles
2301 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
2305 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2308 ALTER TABLE ONLY public.users
2309 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2313 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2316 ALTER TABLE ONLY public.way_nodes
2317 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2321 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2324 ALTER TABLE ONLY public.way_tags
2325 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2329 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2332 ALTER TABLE ONLY public.ways
2333 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2337 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2340 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2344 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2347 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2351 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2354 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2358 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2361 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2365 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2368 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2372 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2375 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2379 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2382 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2386 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2389 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2393 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2396 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2400 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2403 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2407 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2410 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2414 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2417 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2421 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2424 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2428 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2431 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2435 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2438 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2442 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2445 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2449 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2452 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2456 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2459 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2463 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2466 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2470 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2473 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2477 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2480 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2484 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2487 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2491 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2494 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2498 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2501 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2505 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2508 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2512 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2515 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2519 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2522 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2526 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2529 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2533 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2536 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2540 -- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
2543 CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest);
2547 -- Name: index_changeset_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2550 CREATE INDEX index_changeset_comments_on_author_id_and_created_at ON public.changeset_comments USING btree (author_id, created_at);
2554 -- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2557 CREATE INDEX index_changeset_comments_on_changeset_id_and_created_at ON public.changeset_comments USING btree (changeset_id, created_at);
2561 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2564 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2568 -- Name: index_changesets_on_user_id_and_closed_at; Type: INDEX; Schema: public; Owner: -
2571 CREATE INDEX index_changesets_on_user_id_and_closed_at ON public.changesets USING btree (user_id, closed_at);
2575 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2578 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2582 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2585 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2589 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2592 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2596 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2599 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2603 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2606 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2610 -- Name: index_friends_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2613 CREATE INDEX index_friends_on_user_id_and_created_at ON public.friends USING btree (user_id, created_at);
2617 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2620 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2624 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2627 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2631 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2634 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2638 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2641 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2645 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2648 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2652 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2655 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2659 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2662 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2666 -- Name: index_note_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2669 CREATE INDEX index_note_comments_on_author_id_and_created_at ON public.note_comments USING btree (author_id, created_at);
2673 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2676 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2680 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2683 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2687 -- Name: index_oauth_access_grants_on_application_id; Type: INDEX; Schema: public; Owner: -
2690 CREATE INDEX index_oauth_access_grants_on_application_id ON public.oauth_access_grants USING btree (application_id);
2694 -- Name: index_oauth_access_grants_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2697 CREATE INDEX index_oauth_access_grants_on_resource_owner_id ON public.oauth_access_grants USING btree (resource_owner_id);
2701 -- Name: index_oauth_access_grants_on_token; Type: INDEX; Schema: public; Owner: -
2704 CREATE UNIQUE INDEX index_oauth_access_grants_on_token ON public.oauth_access_grants USING btree (token);
2708 -- Name: index_oauth_access_tokens_on_application_id; Type: INDEX; Schema: public; Owner: -
2711 CREATE INDEX index_oauth_access_tokens_on_application_id ON public.oauth_access_tokens USING btree (application_id);
2715 -- Name: index_oauth_access_tokens_on_refresh_token; Type: INDEX; Schema: public; Owner: -
2718 CREATE UNIQUE INDEX index_oauth_access_tokens_on_refresh_token ON public.oauth_access_tokens USING btree (refresh_token);
2722 -- Name: index_oauth_access_tokens_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2725 CREATE INDEX index_oauth_access_tokens_on_resource_owner_id ON public.oauth_access_tokens USING btree (resource_owner_id);
2729 -- Name: index_oauth_access_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2732 CREATE UNIQUE INDEX index_oauth_access_tokens_on_token ON public.oauth_access_tokens USING btree (token);
2736 -- Name: index_oauth_applications_on_owner_type_and_owner_id; Type: INDEX; Schema: public; Owner: -
2739 CREATE INDEX index_oauth_applications_on_owner_type_and_owner_id ON public.oauth_applications USING btree (owner_type, owner_id);
2743 -- Name: index_oauth_applications_on_uid; Type: INDEX; Schema: public; Owner: -
2746 CREATE UNIQUE INDEX index_oauth_applications_on_uid ON public.oauth_applications USING btree (uid);
2750 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2753 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2757 -- Name: index_oauth_openid_requests_on_access_grant_id; Type: INDEX; Schema: public; Owner: -
2760 CREATE INDEX index_oauth_openid_requests_on_access_grant_id ON public.oauth_openid_requests USING btree (access_grant_id);
2764 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2767 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2771 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2774 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2778 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2781 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2785 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2788 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2792 -- Name: index_user_blocks_on_creator_id_and_id; Type: INDEX; Schema: public; Owner: -
2795 CREATE INDEX index_user_blocks_on_creator_id_and_id ON public.user_blocks USING btree (creator_id, id);
2799 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2802 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2806 -- Name: index_user_mutes_on_owner_id_and_subject_id; Type: INDEX; Schema: public; Owner: -
2809 CREATE UNIQUE INDEX index_user_mutes_on_owner_id_and_subject_id ON public.user_mutes USING btree (owner_id, subject_id);
2813 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2816 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2820 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2823 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2827 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2830 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2834 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2837 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2841 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2844 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2848 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2851 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2855 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2858 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2862 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2865 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2869 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2872 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2876 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2879 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2883 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2886 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2890 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2893 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2897 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2900 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2904 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2907 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2911 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2914 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2918 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2921 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2925 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2928 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2932 -- Name: users_display_name_canonical_idx; Type: INDEX; Schema: public; Owner: -
2935 CREATE INDEX users_display_name_canonical_idx ON public.users USING btree (lower(NORMALIZE(display_name, NFKC)));
2939 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2942 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2946 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2949 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2953 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2956 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2960 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2963 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2967 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2970 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2974 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2977 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2981 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2984 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2988 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2991 ALTER TABLE ONLY public.changeset_comments
2992 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2996 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2999 ALTER TABLE ONLY public.changeset_comments
3000 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3004 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3007 ALTER TABLE ONLY public.changeset_tags
3008 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3012 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3015 ALTER TABLE ONLY public.changesets_subscribers
3016 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3020 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3023 ALTER TABLE ONLY public.changesets_subscribers
3024 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
3028 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3031 ALTER TABLE ONLY public.changesets
3032 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3036 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3039 ALTER TABLE ONLY public.client_applications
3040 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3044 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3047 ALTER TABLE ONLY public.current_node_tags
3048 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
3052 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3055 ALTER TABLE ONLY public.current_nodes
3056 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3060 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3063 ALTER TABLE ONLY public.current_relation_members
3064 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
3068 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3071 ALTER TABLE ONLY public.current_relation_tags
3072 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
3076 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3079 ALTER TABLE ONLY public.current_relations
3080 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3084 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3087 ALTER TABLE ONLY public.current_way_nodes
3088 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
3092 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3095 ALTER TABLE ONLY public.current_way_nodes
3096 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
3100 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3103 ALTER TABLE ONLY public.current_way_tags
3104 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
3108 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3111 ALTER TABLE ONLY public.current_ways
3112 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3116 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3119 ALTER TABLE ONLY public.diary_comments
3120 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
3124 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3127 ALTER TABLE ONLY public.diary_comments
3128 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3132 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3135 ALTER TABLE ONLY public.diary_entries
3136 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
3140 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3143 ALTER TABLE ONLY public.diary_entries
3144 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3148 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3151 ALTER TABLE ONLY public.diary_entry_subscriptions
3152 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
3156 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3159 ALTER TABLE ONLY public.diary_entry_subscriptions
3160 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3164 -- Name: oauth_access_grants fk_rails_330c32d8d9; Type: FK CONSTRAINT; Schema: public; Owner: -
3167 ALTER TABLE ONLY public.oauth_access_grants
3168 ADD CONSTRAINT fk_rails_330c32d8d9 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3172 -- Name: user_mutes fk_rails_591dad3359; Type: FK CONSTRAINT; Schema: public; Owner: -
3175 ALTER TABLE ONLY public.user_mutes
3176 ADD CONSTRAINT fk_rails_591dad3359 FOREIGN KEY (owner_id) REFERENCES public.users(id);
3180 -- Name: oauth_access_tokens fk_rails_732cb83ab7; Type: FK CONSTRAINT; Schema: public; Owner: -
3183 ALTER TABLE ONLY public.oauth_access_tokens
3184 ADD CONSTRAINT fk_rails_732cb83ab7 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3188 -- Name: oauth_openid_requests fk_rails_77114b3b09; Type: FK CONSTRAINT; Schema: public; Owner: -
3191 ALTER TABLE ONLY public.oauth_openid_requests
3192 ADD CONSTRAINT fk_rails_77114b3b09 FOREIGN KEY (access_grant_id) REFERENCES public.oauth_access_grants(id) ON DELETE CASCADE;
3196 -- Name: active_storage_variant_records fk_rails_993965df05; Type: FK CONSTRAINT; Schema: public; Owner: -
3199 ALTER TABLE ONLY public.active_storage_variant_records
3200 ADD CONSTRAINT fk_rails_993965df05 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3204 -- Name: oauth_access_grants fk_rails_b4b53e07b8; Type: FK CONSTRAINT; Schema: public; Owner: -
3207 ALTER TABLE ONLY public.oauth_access_grants
3208 ADD CONSTRAINT fk_rails_b4b53e07b8 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3212 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
3215 ALTER TABLE ONLY public.active_storage_attachments
3216 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3220 -- Name: oauth_applications fk_rails_cc886e315a; Type: FK CONSTRAINT; Schema: public; Owner: -
3223 ALTER TABLE ONLY public.oauth_applications
3224 ADD CONSTRAINT fk_rails_cc886e315a FOREIGN KEY (owner_id) REFERENCES public.users(id) NOT VALID;
3228 -- Name: user_mutes fk_rails_e9dd4fb6c3; Type: FK CONSTRAINT; Schema: public; Owner: -
3231 ALTER TABLE ONLY public.user_mutes
3232 ADD CONSTRAINT fk_rails_e9dd4fb6c3 FOREIGN KEY (subject_id) REFERENCES public.users(id);
3236 -- Name: oauth_access_tokens fk_rails_ee63f25419; Type: FK CONSTRAINT; Schema: public; Owner: -
3239 ALTER TABLE ONLY public.oauth_access_tokens
3240 ADD CONSTRAINT fk_rails_ee63f25419 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3244 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3247 ALTER TABLE ONLY public.friends
3248 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
3252 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3255 ALTER TABLE ONLY public.friends
3256 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3260 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3263 ALTER TABLE ONLY public.gps_points
3264 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3268 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3271 ALTER TABLE ONLY public.gpx_file_tags
3272 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3276 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3279 ALTER TABLE ONLY public.gpx_files
3280 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3284 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3287 ALTER TABLE ONLY public.issue_comments
3288 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3292 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3295 ALTER TABLE ONLY public.issue_comments
3296 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3300 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3303 ALTER TABLE ONLY public.issues
3304 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
3308 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3311 ALTER TABLE ONLY public.issues
3312 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
3316 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3319 ALTER TABLE ONLY public.issues
3320 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
3324 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3327 ALTER TABLE ONLY public.messages
3328 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
3332 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3335 ALTER TABLE ONLY public.messages
3336 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
3340 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3343 ALTER TABLE ONLY public.node_tags
3344 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
3348 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3351 ALTER TABLE ONLY public.nodes
3352 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3356 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3359 ALTER TABLE ONLY public.nodes
3360 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3364 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3367 ALTER TABLE ONLY public.note_comments
3368 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
3372 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3375 ALTER TABLE ONLY public.note_comments
3376 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
3380 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3383 ALTER TABLE ONLY public.oauth_tokens
3384 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
3388 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3391 ALTER TABLE ONLY public.oauth_tokens
3392 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3396 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3399 ALTER TABLE ONLY public.redactions
3400 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3404 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3407 ALTER TABLE ONLY public.relation_members
3408 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3412 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3415 ALTER TABLE ONLY public.relation_tags
3416 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3420 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3423 ALTER TABLE ONLY public.relations
3424 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3428 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3431 ALTER TABLE ONLY public.relations
3432 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3436 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3439 ALTER TABLE ONLY public.reports
3440 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3444 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3447 ALTER TABLE ONLY public.reports
3448 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3452 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3455 ALTER TABLE ONLY public.user_blocks
3456 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
3460 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3463 ALTER TABLE ONLY public.user_blocks
3464 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
3468 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3471 ALTER TABLE ONLY public.user_blocks
3472 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3476 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3479 ALTER TABLE ONLY public.user_preferences
3480 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3484 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3487 ALTER TABLE ONLY public.user_roles
3488 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3492 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3495 ALTER TABLE ONLY public.user_roles
3496 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3500 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3503 ALTER TABLE ONLY public.way_nodes
3504 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3508 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3511 ALTER TABLE ONLY public.way_tags
3512 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3516 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3519 ALTER TABLE ONLY public.ways
3520 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3524 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3527 ALTER TABLE ONLY public.ways
3528 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3532 -- PostgreSQL database dump complete
3535 SET search_path TO "$user", public;
3537 INSERT INTO "schema_migrations" (version) VALUES