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
1496 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1499 CREATE SEQUENCE public.user_blocks_id_seq
1509 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1512 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1516 -- Name: user_mutes; Type: TABLE; Schema: public; Owner: -
1519 CREATE TABLE public.user_mutes (
1521 owner_id bigint NOT NULL,
1522 subject_id bigint NOT NULL,
1523 created_at timestamp(6) without time zone NOT NULL,
1524 updated_at timestamp(6) without time zone NOT NULL
1529 -- Name: user_mutes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1532 CREATE SEQUENCE public.user_mutes_id_seq
1541 -- Name: user_mutes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1544 ALTER SEQUENCE public.user_mutes_id_seq OWNED BY public.user_mutes.id;
1548 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1551 CREATE TABLE public.user_preferences (
1552 user_id bigint NOT NULL,
1553 k character varying NOT NULL,
1554 v character varying NOT NULL
1559 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1562 CREATE TABLE public.user_roles (
1563 id integer NOT NULL,
1564 user_id bigint NOT NULL,
1565 role public.user_role_enum NOT NULL,
1566 created_at timestamp without time zone,
1567 updated_at timestamp without time zone,
1568 granter_id bigint NOT NULL
1573 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1576 CREATE SEQUENCE public.user_roles_id_seq
1586 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1589 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1593 -- Name: users; Type: TABLE; Schema: public; Owner: -
1596 CREATE TABLE public.users (
1597 email character varying NOT NULL,
1599 pass_crypt character varying NOT NULL,
1600 creation_time timestamp without time zone NOT NULL,
1601 display_name character varying DEFAULT ''::character varying NOT NULL,
1602 data_public boolean DEFAULT false NOT NULL,
1603 description text DEFAULT ''::text NOT NULL,
1604 home_lat double precision,
1605 home_lon double precision,
1606 home_zoom smallint DEFAULT 3,
1607 pass_salt character varying,
1608 email_valid boolean DEFAULT false NOT NULL,
1609 new_email character varying,
1610 creation_ip character varying,
1611 languages character varying,
1612 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1613 terms_agreed timestamp without time zone,
1614 consider_pd boolean DEFAULT false NOT NULL,
1615 auth_uid character varying,
1616 preferred_editor character varying,
1617 terms_seen boolean DEFAULT false NOT NULL,
1618 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1619 changesets_count integer DEFAULT 0 NOT NULL,
1620 traces_count integer DEFAULT 0 NOT NULL,
1621 diary_entries_count integer DEFAULT 0 NOT NULL,
1622 image_use_gravatar boolean DEFAULT false NOT NULL,
1623 auth_provider character varying,
1625 tou_agreed timestamp without time zone,
1626 diary_comments_count integer DEFAULT 0,
1627 note_comments_count integer DEFAULT 0
1632 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1635 CREATE SEQUENCE public.users_id_seq
1644 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1647 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1651 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1654 CREATE TABLE public.way_nodes (
1655 way_id bigint NOT NULL,
1656 node_id bigint NOT NULL,
1657 version bigint NOT NULL,
1658 sequence_id bigint NOT NULL
1663 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1666 CREATE TABLE public.way_tags (
1667 way_id bigint NOT NULL,
1668 k character varying NOT NULL,
1669 v character varying NOT NULL,
1670 version bigint NOT NULL
1675 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1678 CREATE TABLE public.ways (
1679 way_id bigint NOT NULL,
1680 changeset_id bigint NOT NULL,
1681 "timestamp" timestamp without time zone NOT NULL,
1682 version bigint NOT NULL,
1683 visible boolean DEFAULT true NOT NULL,
1684 redaction_id integer
1689 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1692 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1696 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1699 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1703 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1706 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1710 -- Name: active_storage_variant_records id; Type: DEFAULT; Schema: public; Owner: -
1713 ALTER TABLE ONLY public.active_storage_variant_records ALTER COLUMN id SET DEFAULT nextval('public.active_storage_variant_records_id_seq'::regclass);
1717 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1720 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1724 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1727 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1731 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1734 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1738 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1741 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1745 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1748 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1752 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1755 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1759 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1762 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1766 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1769 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1773 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1776 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1780 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1783 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1787 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1790 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1794 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1797 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1801 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1804 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1808 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1811 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1815 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1818 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1822 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1825 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1829 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1832 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1836 -- Name: oauth_access_grants id; Type: DEFAULT; Schema: public; Owner: -
1839 ALTER TABLE ONLY public.oauth_access_grants ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_grants_id_seq'::regclass);
1843 -- Name: oauth_access_tokens id; Type: DEFAULT; Schema: public; Owner: -
1846 ALTER TABLE ONLY public.oauth_access_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_tokens_id_seq'::regclass);
1850 -- Name: oauth_applications id; Type: DEFAULT; Schema: public; Owner: -
1853 ALTER TABLE ONLY public.oauth_applications ALTER COLUMN id SET DEFAULT nextval('public.oauth_applications_id_seq'::regclass);
1857 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1860 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1864 -- Name: oauth_openid_requests id; Type: DEFAULT; Schema: public; Owner: -
1867 ALTER TABLE ONLY public.oauth_openid_requests ALTER COLUMN id SET DEFAULT nextval('public.oauth_openid_requests_id_seq'::regclass);
1871 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1874 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1878 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1881 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1885 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1888 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1892 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1895 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1899 -- Name: user_mutes id; Type: DEFAULT; Schema: public; Owner: -
1902 ALTER TABLE ONLY public.user_mutes ALTER COLUMN id SET DEFAULT nextval('public.user_mutes_id_seq'::regclass);
1906 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1909 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1913 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1916 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1920 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1923 ALTER TABLE ONLY public.acls
1924 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1928 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1931 ALTER TABLE ONLY public.active_storage_attachments
1932 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1936 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1939 ALTER TABLE ONLY public.active_storage_blobs
1940 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1944 -- Name: active_storage_variant_records active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1947 ALTER TABLE ONLY public.active_storage_variant_records
1948 ADD CONSTRAINT active_storage_variant_records_pkey PRIMARY KEY (id);
1952 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1955 ALTER TABLE ONLY public.ar_internal_metadata
1956 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1960 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1963 ALTER TABLE ONLY public.changeset_comments
1964 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1968 -- Name: changeset_tags changeset_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1971 ALTER TABLE ONLY public.changeset_tags
1972 ADD CONSTRAINT changeset_tags_pkey PRIMARY KEY (changeset_id, k);
1976 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1979 ALTER TABLE ONLY public.changesets
1980 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1984 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1987 ALTER TABLE ONLY public.client_applications
1988 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1992 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1995 ALTER TABLE ONLY public.current_node_tags
1996 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
2000 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
2003 ALTER TABLE ONLY public.current_nodes
2004 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
2008 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2011 ALTER TABLE ONLY public.current_relation_members
2012 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, sequence_id);
2016 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2019 ALTER TABLE ONLY public.current_relation_tags
2020 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
2024 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2027 ALTER TABLE ONLY public.current_relations
2028 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
2032 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2035 ALTER TABLE ONLY public.current_way_nodes
2036 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
2040 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2043 ALTER TABLE ONLY public.current_way_tags
2044 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
2048 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2051 ALTER TABLE ONLY public.current_ways
2052 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
2056 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2059 ALTER TABLE ONLY public.delayed_jobs
2060 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
2064 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2067 ALTER TABLE ONLY public.diary_comments
2068 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
2072 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2075 ALTER TABLE ONLY public.diary_entries
2076 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
2080 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2083 ALTER TABLE ONLY public.diary_entry_subscriptions
2084 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
2088 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2091 ALTER TABLE ONLY public.friends
2092 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
2096 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2099 ALTER TABLE ONLY public.gpx_file_tags
2100 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
2104 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2107 ALTER TABLE ONLY public.gpx_files
2108 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
2112 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2115 ALTER TABLE ONLY public.issue_comments
2116 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
2120 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2123 ALTER TABLE ONLY public.issues
2124 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
2128 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2131 ALTER TABLE ONLY public.languages
2132 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
2136 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2139 ALTER TABLE ONLY public.messages
2140 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
2144 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2147 ALTER TABLE ONLY public.node_tags
2148 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
2152 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2155 ALTER TABLE ONLY public.nodes
2156 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
2160 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2163 ALTER TABLE ONLY public.note_comments
2164 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
2168 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2171 ALTER TABLE ONLY public.notes
2172 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
2176 -- Name: oauth_access_grants oauth_access_grants_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2179 ALTER TABLE ONLY public.oauth_access_grants
2180 ADD CONSTRAINT oauth_access_grants_pkey PRIMARY KEY (id);
2184 -- Name: oauth_access_tokens oauth_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2187 ALTER TABLE ONLY public.oauth_access_tokens
2188 ADD CONSTRAINT oauth_access_tokens_pkey PRIMARY KEY (id);
2192 -- Name: oauth_applications oauth_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2195 ALTER TABLE ONLY public.oauth_applications
2196 ADD CONSTRAINT oauth_applications_pkey PRIMARY KEY (id);
2200 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2203 ALTER TABLE ONLY public.oauth_nonces
2204 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
2208 -- Name: oauth_openid_requests oauth_openid_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2211 ALTER TABLE ONLY public.oauth_openid_requests
2212 ADD CONSTRAINT oauth_openid_requests_pkey PRIMARY KEY (id);
2216 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2219 ALTER TABLE ONLY public.oauth_tokens
2220 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
2224 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2227 ALTER TABLE ONLY public.redactions
2228 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
2232 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2235 ALTER TABLE ONLY public.relation_members
2236 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, sequence_id);
2240 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2243 ALTER TABLE ONLY public.relation_tags
2244 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
2248 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2251 ALTER TABLE ONLY public.relations
2252 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
2256 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2259 ALTER TABLE ONLY public.reports
2260 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
2264 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2267 ALTER TABLE ONLY public.schema_migrations
2268 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
2272 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2275 ALTER TABLE ONLY public.user_blocks
2276 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
2280 -- Name: user_mutes user_mutes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2283 ALTER TABLE ONLY public.user_mutes
2284 ADD CONSTRAINT user_mutes_pkey PRIMARY KEY (id);
2288 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2291 ALTER TABLE ONLY public.user_preferences
2292 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
2296 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2299 ALTER TABLE ONLY public.user_roles
2300 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
2304 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2307 ALTER TABLE ONLY public.users
2308 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2312 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2315 ALTER TABLE ONLY public.way_nodes
2316 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2320 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2323 ALTER TABLE ONLY public.way_tags
2324 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2328 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2331 ALTER TABLE ONLY public.ways
2332 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2336 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2339 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2343 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2346 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2350 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2353 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2357 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2360 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2364 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2367 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2371 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2374 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2378 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2381 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2385 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2388 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2392 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2395 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2399 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2402 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2406 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2409 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2413 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2416 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2420 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2423 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2427 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2430 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2434 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2437 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2441 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2444 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2448 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2451 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2455 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2458 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2462 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2465 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2469 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2472 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2476 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2479 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2483 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2486 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2490 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2493 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2497 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2500 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2504 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2507 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2511 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2514 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2518 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2521 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2525 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2528 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2532 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2535 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2539 -- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
2542 CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest);
2546 -- Name: index_changeset_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2549 CREATE INDEX index_changeset_comments_on_author_id_and_created_at ON public.changeset_comments USING btree (author_id, created_at);
2553 -- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2556 CREATE INDEX index_changeset_comments_on_changeset_id_and_created_at ON public.changeset_comments USING btree (changeset_id, created_at);
2560 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2563 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2567 -- Name: index_changesets_on_user_id_and_closed_at; Type: INDEX; Schema: public; Owner: -
2570 CREATE INDEX index_changesets_on_user_id_and_closed_at ON public.changesets USING btree (user_id, closed_at);
2574 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2577 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2581 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2584 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2588 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2591 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2595 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2598 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2602 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2605 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2609 -- Name: index_friends_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2612 CREATE INDEX index_friends_on_user_id_and_created_at ON public.friends USING btree (user_id, created_at);
2616 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2619 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2623 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2626 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2630 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2633 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2637 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2640 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2644 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2647 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2651 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2654 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2658 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2661 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2665 -- Name: index_note_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2668 CREATE INDEX index_note_comments_on_author_id_and_created_at ON public.note_comments USING btree (author_id, created_at);
2672 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2675 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2679 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2682 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2686 -- Name: index_oauth_access_grants_on_application_id; Type: INDEX; Schema: public; Owner: -
2689 CREATE INDEX index_oauth_access_grants_on_application_id ON public.oauth_access_grants USING btree (application_id);
2693 -- Name: index_oauth_access_grants_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2696 CREATE INDEX index_oauth_access_grants_on_resource_owner_id ON public.oauth_access_grants USING btree (resource_owner_id);
2700 -- Name: index_oauth_access_grants_on_token; Type: INDEX; Schema: public; Owner: -
2703 CREATE UNIQUE INDEX index_oauth_access_grants_on_token ON public.oauth_access_grants USING btree (token);
2707 -- Name: index_oauth_access_tokens_on_application_id; Type: INDEX; Schema: public; Owner: -
2710 CREATE INDEX index_oauth_access_tokens_on_application_id ON public.oauth_access_tokens USING btree (application_id);
2714 -- Name: index_oauth_access_tokens_on_refresh_token; Type: INDEX; Schema: public; Owner: -
2717 CREATE UNIQUE INDEX index_oauth_access_tokens_on_refresh_token ON public.oauth_access_tokens USING btree (refresh_token);
2721 -- Name: index_oauth_access_tokens_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2724 CREATE INDEX index_oauth_access_tokens_on_resource_owner_id ON public.oauth_access_tokens USING btree (resource_owner_id);
2728 -- Name: index_oauth_access_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2731 CREATE UNIQUE INDEX index_oauth_access_tokens_on_token ON public.oauth_access_tokens USING btree (token);
2735 -- Name: index_oauth_applications_on_owner_type_and_owner_id; Type: INDEX; Schema: public; Owner: -
2738 CREATE INDEX index_oauth_applications_on_owner_type_and_owner_id ON public.oauth_applications USING btree (owner_type, owner_id);
2742 -- Name: index_oauth_applications_on_uid; Type: INDEX; Schema: public; Owner: -
2745 CREATE UNIQUE INDEX index_oauth_applications_on_uid ON public.oauth_applications USING btree (uid);
2749 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2752 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2756 -- Name: index_oauth_openid_requests_on_access_grant_id; Type: INDEX; Schema: public; Owner: -
2759 CREATE INDEX index_oauth_openid_requests_on_access_grant_id ON public.oauth_openid_requests USING btree (access_grant_id);
2763 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2766 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2770 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2773 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2777 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2780 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2784 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2787 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2791 -- Name: index_user_blocks_on_creator_id_and_id; Type: INDEX; Schema: public; Owner: -
2794 CREATE INDEX index_user_blocks_on_creator_id_and_id ON public.user_blocks USING btree (creator_id, id);
2798 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2801 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2805 -- Name: index_user_mutes_on_owner_id_and_subject_id; Type: INDEX; Schema: public; Owner: -
2808 CREATE UNIQUE INDEX index_user_mutes_on_owner_id_and_subject_id ON public.user_mutes USING btree (owner_id, subject_id);
2812 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2815 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2819 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2822 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2826 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2829 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2833 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2836 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2840 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2843 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2847 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2850 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2854 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2857 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2861 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2864 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2868 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2871 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2875 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2878 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2882 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2885 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2889 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2892 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2896 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2899 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2903 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2906 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2910 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2913 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2917 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2920 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2924 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2927 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2931 -- Name: users_display_name_canonical_idx; Type: INDEX; Schema: public; Owner: -
2934 CREATE INDEX users_display_name_canonical_idx ON public.users USING btree (lower(NORMALIZE(display_name, NFKC)));
2938 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2941 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2945 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2948 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2952 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2955 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2959 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2962 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2966 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2969 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2973 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2976 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2980 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2983 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2987 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2990 ALTER TABLE ONLY public.changeset_comments
2991 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2995 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2998 ALTER TABLE ONLY public.changeset_comments
2999 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3003 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3006 ALTER TABLE ONLY public.changeset_tags
3007 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3011 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3014 ALTER TABLE ONLY public.changesets_subscribers
3015 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3019 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3022 ALTER TABLE ONLY public.changesets_subscribers
3023 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
3027 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3030 ALTER TABLE ONLY public.changesets
3031 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3035 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3038 ALTER TABLE ONLY public.client_applications
3039 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3043 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3046 ALTER TABLE ONLY public.current_node_tags
3047 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
3051 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3054 ALTER TABLE ONLY public.current_nodes
3055 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3059 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3062 ALTER TABLE ONLY public.current_relation_members
3063 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
3067 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3070 ALTER TABLE ONLY public.current_relation_tags
3071 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
3075 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3078 ALTER TABLE ONLY public.current_relations
3079 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3083 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3086 ALTER TABLE ONLY public.current_way_nodes
3087 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
3091 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3094 ALTER TABLE ONLY public.current_way_nodes
3095 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
3099 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3102 ALTER TABLE ONLY public.current_way_tags
3103 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
3107 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3110 ALTER TABLE ONLY public.current_ways
3111 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3115 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3118 ALTER TABLE ONLY public.diary_comments
3119 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
3123 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3126 ALTER TABLE ONLY public.diary_comments
3127 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3131 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3134 ALTER TABLE ONLY public.diary_entries
3135 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
3139 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3142 ALTER TABLE ONLY public.diary_entries
3143 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3147 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3150 ALTER TABLE ONLY public.diary_entry_subscriptions
3151 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
3155 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3158 ALTER TABLE ONLY public.diary_entry_subscriptions
3159 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3163 -- Name: oauth_access_grants fk_rails_330c32d8d9; Type: FK CONSTRAINT; Schema: public; Owner: -
3166 ALTER TABLE ONLY public.oauth_access_grants
3167 ADD CONSTRAINT fk_rails_330c32d8d9 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3171 -- Name: user_mutes fk_rails_591dad3359; Type: FK CONSTRAINT; Schema: public; Owner: -
3174 ALTER TABLE ONLY public.user_mutes
3175 ADD CONSTRAINT fk_rails_591dad3359 FOREIGN KEY (owner_id) REFERENCES public.users(id);
3179 -- Name: oauth_access_tokens fk_rails_732cb83ab7; Type: FK CONSTRAINT; Schema: public; Owner: -
3182 ALTER TABLE ONLY public.oauth_access_tokens
3183 ADD CONSTRAINT fk_rails_732cb83ab7 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3187 -- Name: oauth_openid_requests fk_rails_77114b3b09; Type: FK CONSTRAINT; Schema: public; Owner: -
3190 ALTER TABLE ONLY public.oauth_openid_requests
3191 ADD CONSTRAINT fk_rails_77114b3b09 FOREIGN KEY (access_grant_id) REFERENCES public.oauth_access_grants(id) ON DELETE CASCADE;
3195 -- Name: active_storage_variant_records fk_rails_993965df05; Type: FK CONSTRAINT; Schema: public; Owner: -
3198 ALTER TABLE ONLY public.active_storage_variant_records
3199 ADD CONSTRAINT fk_rails_993965df05 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(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: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3382 ALTER TABLE ONLY public.oauth_tokens
3383 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
3387 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3390 ALTER TABLE ONLY public.oauth_tokens
3391 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3395 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3398 ALTER TABLE ONLY public.redactions
3399 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3403 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3406 ALTER TABLE ONLY public.relation_members
3407 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3411 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3414 ALTER TABLE ONLY public.relation_tags
3415 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3419 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3422 ALTER TABLE ONLY public.relations
3423 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3427 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3430 ALTER TABLE ONLY public.relations
3431 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3435 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3438 ALTER TABLE ONLY public.reports
3439 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3443 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3446 ALTER TABLE ONLY public.reports
3447 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3451 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3454 ALTER TABLE ONLY public.user_blocks
3455 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
3459 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3462 ALTER TABLE ONLY public.user_blocks
3463 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
3467 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3470 ALTER TABLE ONLY public.user_blocks
3471 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3475 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3478 ALTER TABLE ONLY public.user_preferences
3479 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3483 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3486 ALTER TABLE ONLY public.user_roles
3487 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3491 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3494 ALTER TABLE ONLY public.user_roles
3495 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3499 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3502 ALTER TABLE ONLY public.way_nodes
3503 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3507 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3510 ALTER TABLE ONLY public.way_tags
3511 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3515 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3518 ALTER TABLE ONLY public.ways
3519 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3523 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3526 ALTER TABLE ONLY public.ways
3527 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3531 -- PostgreSQL database dump complete
3534 SET search_path TO "$user", public;
3536 INSERT INTO "schema_migrations" (version) VALUES