1 SET statement_timeout = 0;
3 SET idle_in_transaction_session_timeout = 0;
4 SET client_encoding = 'UTF8';
5 SET standard_conforming_strings = on;
6 SELECT pg_catalog.set_config('search_path', '', false);
7 SET check_function_bodies = false;
8 SET xmloption = content;
9 SET client_min_messages = warning;
10 SET row_security = off;
13 -- Name: public; Type: SCHEMA; Schema: -; Owner: -
16 -- *not* creating schema, since initdb creates it
20 -- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: -
23 CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public;
27 -- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: -
30 COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST';
34 -- Name: postgis; Type: EXTENSION; Schema: -; Owner: -
37 CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA public;
41 -- Name: EXTENSION postgis; Type: COMMENT; Schema: -; Owner: -
44 COMMENT ON EXTENSION postgis IS 'PostGIS geometry and geography spatial types and functions';
48 -- Name: format_enum; Type: TYPE; Schema: public; Owner: -
51 CREATE TYPE public.format_enum AS ENUM (
59 -- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: -
62 CREATE TYPE public.gpx_visibility_enum AS ENUM (
71 -- Name: issue_status_enum; Type: TYPE; Schema: public; Owner: -
74 CREATE TYPE public.issue_status_enum AS ENUM (
82 -- Name: note_event_enum; Type: TYPE; Schema: public; Owner: -
85 CREATE TYPE public.note_event_enum AS ENUM (
95 -- Name: note_status_enum; Type: TYPE; Schema: public; Owner: -
98 CREATE TYPE public.note_status_enum AS ENUM (
106 -- Name: nwr_enum; Type: TYPE; Schema: public; Owner: -
109 CREATE TYPE public.nwr_enum AS ENUM (
117 -- Name: user_role_enum; Type: TYPE; Schema: public; Owner: -
120 CREATE TYPE public.user_role_enum AS ENUM (
128 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
131 CREATE TYPE public.user_status_enum AS ENUM (
141 -- Name: api_rate_limit(bigint); Type: FUNCTION; Schema: public; Owner: -
144 CREATE FUNCTION public.api_rate_limit(user_id bigint) RETURNS integer
145 LANGUAGE plpgsql STABLE
148 min_changes_per_hour int4 := 100;
149 initial_changes_per_hour int4 := 1000;
150 max_changes_per_hour int4 := 100000;
151 days_to_max_changes int4 := 7;
152 importer_changes_per_hour int4 := 1000000;
153 moderator_changes_per_hour int4 := 1000000;
155 last_block timestamp without time zone;
156 first_change timestamp without time zone;
158 time_since_first_change double precision;
159 max_changes double precision;
162 SELECT ARRAY_AGG(user_roles.role) INTO STRICT roles FROM user_roles WHERE user_roles.user_id = api_rate_limit.user_id;
164 IF 'moderator' = ANY(roles) THEN
165 max_changes := moderator_changes_per_hour;
166 ELSIF 'importer' = ANY(roles) THEN
167 max_changes := importer_changes_per_hour;
169 SELECT user_blocks.created_at INTO last_block FROM user_blocks WHERE user_blocks.user_id = api_rate_limit.user_id ORDER BY user_blocks.created_at DESC LIMIT 1;
172 SELECT changesets.created_at INTO first_change FROM changesets WHERE changesets.user_id = api_rate_limit.user_id AND changesets.created_at > last_block ORDER BY changesets.created_at LIMIT 1;
174 SELECT changesets.created_at INTO first_change FROM changesets WHERE changesets.user_id = api_rate_limit.user_id ORDER BY changesets.created_at LIMIT 1;
178 first_change := CURRENT_TIMESTAMP AT TIME ZONE 'UTC';
181 SELECT COUNT(*) INTO STRICT active_reports
182 FROM issues INNER JOIN reports ON reports.issue_id = issues.id
183 WHERE issues.reported_user_id = api_rate_limit.user_id AND issues.status = 'open' AND reports.updated_at >= COALESCE(issues.resolved_at, '1970-01-01');
185 time_since_first_change := EXTRACT(EPOCH FROM CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - first_change);
187 max_changes := max_changes_per_hour * POWER(time_since_first_change, 2) / POWER(days_to_max_changes * 24 * 60 * 60, 2);
188 max_changes := GREATEST(initial_changes_per_hour, LEAST(max_changes_per_hour, FLOOR(max_changes)));
189 max_changes := max_changes / POWER(2, active_reports);
190 max_changes := GREATEST(min_changes_per_hour, LEAST(max_changes_per_hour, max_changes));
193 SELECT COALESCE(SUM(changesets.num_changes), 0) INTO STRICT recent_changes FROM changesets WHERE changesets.user_id = api_rate_limit.user_id AND changesets.created_at >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - '1 hour'::interval;
195 RETURN max_changes - recent_changes;
201 -- Name: api_size_limit(bigint); Type: FUNCTION; Schema: public; Owner: -
204 CREATE FUNCTION public.api_size_limit(user_id bigint) RETURNS bigint
205 LANGUAGE plpgsql STABLE
208 min_size_limit int8 := 10000000;
209 initial_size_limit int8 := 30000000;
210 max_size_limit int8 := 5400000000;
211 days_to_max_size_limit int4 := 28;
212 importer_size_limit int8 := 5400000000;
213 moderator_size_limit int8 := 5400000000;
215 last_block timestamp without time zone;
216 first_change timestamp without time zone;
218 time_since_first_change double precision;
221 SELECT ARRAY_AGG(user_roles.role) INTO STRICT roles FROM user_roles WHERE user_roles.user_id = api_size_limit.user_id;
223 IF 'moderator' = ANY(roles) THEN
224 size_limit := moderator_size_limit;
225 ELSIF 'importer' = ANY(roles) THEN
226 size_limit := importer_size_limit;
228 SELECT user_blocks.created_at INTO last_block FROM user_blocks WHERE user_blocks.user_id = api_size_limit.user_id ORDER BY user_blocks.created_at DESC LIMIT 1;
231 SELECT changesets.created_at INTO first_change FROM changesets WHERE changesets.user_id = api_size_limit.user_id AND changesets.created_at > last_block ORDER BY changesets.created_at LIMIT 1;
233 SELECT changesets.created_at INTO first_change FROM changesets WHERE changesets.user_id = api_size_limit.user_id ORDER BY changesets.created_at LIMIT 1;
237 first_change := CURRENT_TIMESTAMP AT TIME ZONE 'UTC';
240 SELECT COUNT(*) INTO STRICT active_reports
241 FROM issues INNER JOIN reports ON reports.issue_id = issues.id
242 WHERE issues.reported_user_id = api_size_limit.user_id AND issues.status = 'open' AND reports.updated_at >= COALESCE(issues.resolved_at, '1970-01-01');
244 time_since_first_change := EXTRACT(EPOCH FROM CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - first_change);
246 size_limit := max_size_limit * POWER(time_since_first_change, 2) / POWER(days_to_max_size_limit * 24 * 60 * 60, 2);
247 size_limit := GREATEST(initial_size_limit, LEAST(max_size_limit, FLOOR(size_limit)));
248 size_limit := size_limit / POWER(2, active_reports);
249 size_limit := GREATEST(min_size_limit, LEAST(max_size_limit, size_limit));
257 SET default_tablespace = '';
259 SET default_table_access_method = heap;
262 -- Name: acls; Type: TABLE; Schema: public; Owner: -
265 CREATE TABLE public.acls (
268 k character varying NOT NULL,
270 domain character varying,
276 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
279 CREATE SEQUENCE public.acls_id_seq
288 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
291 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
295 -- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
298 CREATE TABLE public.active_storage_attachments (
300 name character varying NOT NULL,
301 record_type character varying NOT NULL,
302 record_id bigint NOT NULL,
303 blob_id bigint NOT NULL,
304 created_at timestamp without time zone NOT NULL
309 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
312 CREATE SEQUENCE public.active_storage_attachments_id_seq
321 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
324 ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
328 -- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
331 CREATE TABLE public.active_storage_blobs (
333 key character varying NOT NULL,
334 filename character varying NOT NULL,
335 content_type character varying,
337 byte_size bigint NOT NULL,
338 checksum character varying,
339 created_at timestamp without time zone NOT NULL,
340 service_name character varying NOT NULL
345 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
348 CREATE SEQUENCE public.active_storage_blobs_id_seq
357 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
360 ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
364 -- Name: active_storage_variant_records; Type: TABLE; Schema: public; Owner: -
367 CREATE TABLE public.active_storage_variant_records (
369 blob_id bigint NOT NULL,
370 variation_digest character varying NOT NULL
375 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE; Schema: public; Owner: -
378 CREATE SEQUENCE public.active_storage_variant_records_id_seq
387 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
390 ALTER SEQUENCE public.active_storage_variant_records_id_seq OWNED BY public.active_storage_variant_records.id;
394 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
397 CREATE TABLE public.ar_internal_metadata (
398 key character varying NOT NULL,
399 value character varying,
400 created_at timestamp(6) without time zone NOT NULL,
401 updated_at timestamp(6) without time zone NOT NULL
406 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
409 CREATE TABLE public.changeset_comments (
411 changeset_id bigint NOT NULL,
412 author_id bigint NOT NULL,
414 created_at timestamp without time zone NOT NULL,
415 visible boolean NOT NULL
420 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
423 CREATE SEQUENCE public.changeset_comments_id_seq
433 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
436 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
440 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
443 CREATE TABLE public.changeset_tags (
444 changeset_id bigint NOT NULL,
445 k character varying DEFAULT ''::character varying NOT NULL,
446 v character varying DEFAULT ''::character varying NOT NULL
451 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
454 CREATE TABLE public.changesets (
456 user_id bigint NOT NULL,
457 created_at timestamp without time zone NOT NULL,
462 closed_at timestamp without time zone NOT NULL,
463 num_changes integer DEFAULT 0 NOT NULL,
464 num_created_nodes integer DEFAULT 0 NOT NULL,
465 num_modified_nodes integer DEFAULT 0 NOT NULL,
466 num_deleted_nodes integer DEFAULT 0 NOT NULL,
467 num_created_ways integer DEFAULT 0 NOT NULL,
468 num_modified_ways integer DEFAULT 0 NOT NULL,
469 num_deleted_ways integer DEFAULT 0 NOT NULL,
470 num_created_relations integer DEFAULT 0 NOT NULL,
471 num_modified_relations integer DEFAULT 0 NOT NULL,
472 num_deleted_relations integer DEFAULT 0 NOT NULL
477 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
480 CREATE SEQUENCE public.changesets_id_seq
489 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
492 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
496 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
499 CREATE TABLE public.changesets_subscribers (
500 subscriber_id bigint NOT NULL,
501 changeset_id bigint NOT NULL
506 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
509 CREATE TABLE public.current_node_tags (
510 node_id bigint NOT NULL,
511 k character varying DEFAULT ''::character varying NOT NULL,
512 v character varying DEFAULT ''::character varying NOT NULL
517 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
520 CREATE TABLE public.current_nodes (
522 latitude integer NOT NULL,
523 longitude integer NOT NULL,
524 changeset_id bigint NOT NULL,
525 visible boolean NOT NULL,
526 "timestamp" timestamp without time zone NOT NULL,
527 tile bigint NOT NULL,
528 version bigint NOT NULL
533 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
536 CREATE SEQUENCE public.current_nodes_id_seq
545 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
548 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
552 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
555 CREATE TABLE public.current_relation_members (
556 relation_id bigint NOT NULL,
557 member_type public.nwr_enum NOT NULL,
558 member_id bigint NOT NULL,
559 member_role character varying NOT NULL,
560 sequence_id integer DEFAULT 0 NOT NULL
565 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
568 CREATE TABLE public.current_relation_tags (
569 relation_id bigint NOT NULL,
570 k character varying DEFAULT ''::character varying NOT NULL,
571 v character varying DEFAULT ''::character varying NOT NULL
576 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
579 CREATE TABLE public.current_relations (
581 changeset_id bigint NOT NULL,
582 "timestamp" timestamp without time zone NOT NULL,
583 visible boolean NOT NULL,
584 version bigint NOT NULL
589 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
592 CREATE SEQUENCE public.current_relations_id_seq
601 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
604 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
608 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
611 CREATE TABLE public.current_way_nodes (
612 way_id bigint NOT NULL,
613 node_id bigint NOT NULL,
614 sequence_id bigint NOT NULL
619 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
622 CREATE TABLE public.current_way_tags (
623 way_id bigint NOT NULL,
624 k character varying DEFAULT ''::character varying NOT NULL,
625 v character varying DEFAULT ''::character varying NOT NULL
630 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
633 CREATE TABLE public.current_ways (
635 changeset_id bigint NOT NULL,
636 "timestamp" timestamp without time zone NOT NULL,
637 visible boolean NOT NULL,
638 version bigint NOT NULL
643 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
646 CREATE SEQUENCE public.current_ways_id_seq
655 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
658 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
662 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
665 CREATE TABLE public.delayed_jobs (
667 priority integer DEFAULT 0 NOT NULL,
668 attempts integer DEFAULT 0 NOT NULL,
669 handler text NOT NULL,
671 run_at timestamp without time zone,
672 locked_at timestamp without time zone,
673 failed_at timestamp without time zone,
674 locked_by character varying,
675 queue character varying,
676 created_at timestamp without time zone,
677 updated_at timestamp without time zone
682 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
685 CREATE SEQUENCE public.delayed_jobs_id_seq
694 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
697 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
701 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
704 CREATE TABLE public.diary_comments (
706 diary_entry_id bigint NOT NULL,
707 user_id bigint NOT NULL,
709 created_at timestamp without time zone NOT NULL,
710 updated_at timestamp without time zone NOT NULL,
711 visible boolean DEFAULT true NOT NULL,
712 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
717 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
720 CREATE SEQUENCE public.diary_comments_id_seq
729 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
732 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
736 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
739 CREATE TABLE public.diary_entries (
741 user_id bigint NOT NULL,
742 title character varying NOT NULL,
744 created_at timestamp without time zone NOT NULL,
745 updated_at timestamp without time zone NOT NULL,
746 latitude double precision,
747 longitude double precision,
748 language_code character varying DEFAULT 'en'::character varying NOT NULL,
749 visible boolean DEFAULT true NOT NULL,
750 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
755 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
758 CREATE SEQUENCE public.diary_entries_id_seq
767 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
770 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
774 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
777 CREATE TABLE public.diary_entry_subscriptions (
778 user_id bigint NOT NULL,
779 diary_entry_id bigint NOT NULL
784 -- Name: friends; Type: TABLE; Schema: public; Owner: -
787 CREATE TABLE public.friends (
789 user_id bigint NOT NULL,
790 friend_user_id bigint NOT NULL,
791 created_at timestamp without time zone
796 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
799 CREATE SEQUENCE public.friends_id_seq
808 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
811 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
815 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
818 CREATE TABLE public.gps_points (
819 altitude double precision,
820 trackid integer NOT NULL,
821 latitude integer NOT NULL,
822 longitude integer NOT NULL,
823 gpx_id bigint NOT NULL,
824 "timestamp" timestamp without time zone,
830 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
833 CREATE TABLE public.gpx_file_tags (
834 gpx_id bigint NOT NULL,
835 tag character varying NOT NULL,
841 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
844 CREATE SEQUENCE public.gpx_file_tags_id_seq
853 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
856 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
860 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
863 CREATE TABLE public.gpx_files (
865 user_id bigint NOT NULL,
866 visible boolean DEFAULT true NOT NULL,
867 name character varying DEFAULT ''::character varying NOT NULL,
869 latitude double precision,
870 longitude double precision,
871 "timestamp" timestamp without time zone NOT NULL,
872 description character varying DEFAULT ''::character varying NOT NULL,
873 inserted boolean NOT NULL,
874 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
879 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
882 CREATE SEQUENCE public.gpx_files_id_seq
891 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
894 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
898 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
901 CREATE TABLE public.issue_comments (
903 issue_id integer NOT NULL,
904 user_id integer NOT NULL,
906 created_at timestamp without time zone NOT NULL,
907 updated_at timestamp without time zone NOT NULL
912 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
915 CREATE SEQUENCE public.issue_comments_id_seq
925 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
928 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
932 -- Name: issues; Type: TABLE; Schema: public; Owner: -
935 CREATE TABLE public.issues (
937 reportable_type character varying NOT NULL,
938 reportable_id integer NOT NULL,
939 reported_user_id integer,
940 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
941 assigned_role public.user_role_enum NOT NULL,
942 resolved_at timestamp without time zone,
945 reports_count integer DEFAULT 0,
946 created_at timestamp without time zone NOT NULL,
947 updated_at timestamp without time zone NOT NULL
952 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
955 CREATE SEQUENCE public.issues_id_seq
965 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
968 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
972 -- Name: languages; Type: TABLE; Schema: public; Owner: -
975 CREATE TABLE public.languages (
976 code character varying NOT NULL,
977 english_name character varying NOT NULL,
978 native_name character varying
983 -- Name: messages; Type: TABLE; Schema: public; Owner: -
986 CREATE TABLE public.messages (
988 from_user_id bigint NOT NULL,
989 title character varying NOT NULL,
991 sent_on timestamp without time zone NOT NULL,
992 message_read boolean DEFAULT false NOT NULL,
993 to_user_id bigint NOT NULL,
994 to_user_visible boolean DEFAULT true NOT NULL,
995 from_user_visible boolean DEFAULT true NOT NULL,
996 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
997 muted boolean DEFAULT false NOT NULL
1002 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1005 CREATE SEQUENCE public.messages_id_seq
1014 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1017 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
1021 -- Name: moderation_zones; Type: TABLE; Schema: public; Owner: -
1024 CREATE TABLE public.moderation_zones (
1026 name character varying NOT NULL,
1027 reason character varying NOT NULL,
1028 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum,
1029 zone public.geometry(Polygon,4326) NOT NULL,
1030 ends_at timestamp(6) without time zone,
1031 creator_id bigint NOT NULL,
1033 created_at timestamp(6) without time zone NOT NULL,
1034 updated_at timestamp(6) without time zone NOT NULL
1039 -- Name: moderation_zones_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1042 CREATE SEQUENCE public.moderation_zones_id_seq
1051 -- Name: moderation_zones_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1054 ALTER SEQUENCE public.moderation_zones_id_seq OWNED BY public.moderation_zones.id;
1058 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
1061 CREATE TABLE public.node_tags (
1062 node_id bigint NOT NULL,
1063 version bigint NOT NULL,
1064 k character varying DEFAULT ''::character varying NOT NULL,
1065 v character varying DEFAULT ''::character varying NOT NULL
1070 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
1073 CREATE TABLE public.nodes (
1074 node_id bigint NOT NULL,
1075 latitude integer NOT NULL,
1076 longitude integer NOT NULL,
1077 changeset_id bigint NOT NULL,
1078 visible boolean NOT NULL,
1079 "timestamp" timestamp without time zone NOT NULL,
1080 tile bigint NOT NULL,
1081 version bigint NOT NULL,
1082 redaction_id integer
1087 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
1090 CREATE TABLE public.note_comments (
1092 note_id bigint NOT NULL,
1093 visible boolean NOT NULL,
1094 created_at timestamp without time zone NOT NULL,
1098 event public.note_event_enum
1103 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1106 CREATE SEQUENCE public.note_comments_id_seq
1115 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1118 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
1122 -- Name: note_subscriptions; Type: TABLE; Schema: public; Owner: -
1125 CREATE TABLE public.note_subscriptions (
1126 user_id bigint NOT NULL,
1127 note_id bigint NOT NULL
1132 -- Name: notes; Type: TABLE; Schema: public; Owner: -
1135 CREATE TABLE public.notes (
1137 latitude integer NOT NULL,
1138 longitude integer NOT NULL,
1139 tile bigint NOT NULL,
1140 updated_at timestamp without time zone NOT NULL,
1141 created_at timestamp without time zone NOT NULL,
1142 status public.note_status_enum NOT NULL,
1143 closed_at timestamp without time zone,
1144 description text DEFAULT ''::text NOT NULL,
1151 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1154 CREATE SEQUENCE public.notes_id_seq
1163 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1166 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
1170 -- Name: noticed_events; Type: TABLE; Schema: public; Owner: -
1173 CREATE TABLE public.noticed_events (
1175 type character varying,
1176 record_type character varying,
1178 notifications_count integer,
1180 created_at timestamp(6) without time zone NOT NULL,
1181 updated_at timestamp(6) without time zone NOT NULL
1186 -- Name: noticed_events_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1189 CREATE SEQUENCE public.noticed_events_id_seq
1198 -- Name: noticed_events_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1201 ALTER SEQUENCE public.noticed_events_id_seq OWNED BY public.noticed_events.id;
1205 -- Name: noticed_notifications; Type: TABLE; Schema: public; Owner: -
1208 CREATE TABLE public.noticed_notifications (
1210 type character varying,
1211 event_id bigint NOT NULL,
1212 recipient_type character varying NOT NULL,
1213 recipient_id bigint NOT NULL,
1214 read_at timestamp(6) without time zone,
1215 seen_at timestamp(6) without time zone,
1216 created_at timestamp(6) without time zone NOT NULL,
1217 updated_at timestamp(6) without time zone NOT NULL
1222 -- Name: noticed_notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1225 CREATE SEQUENCE public.noticed_notifications_id_seq
1234 -- Name: noticed_notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1237 ALTER SEQUENCE public.noticed_notifications_id_seq OWNED BY public.noticed_notifications.id;
1241 -- Name: oauth_access_grants; Type: TABLE; Schema: public; Owner: -
1244 CREATE TABLE public.oauth_access_grants (
1246 resource_owner_id bigint NOT NULL,
1247 application_id bigint NOT NULL,
1248 token character varying NOT NULL,
1249 expires_in integer NOT NULL,
1250 redirect_uri text NOT NULL,
1251 created_at timestamp without time zone NOT NULL,
1252 revoked_at timestamp without time zone,
1253 scopes character varying DEFAULT ''::character varying NOT NULL,
1254 code_challenge character varying,
1255 code_challenge_method character varying
1260 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1263 CREATE SEQUENCE public.oauth_access_grants_id_seq
1272 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1275 ALTER SEQUENCE public.oauth_access_grants_id_seq OWNED BY public.oauth_access_grants.id;
1279 -- Name: oauth_access_tokens; Type: TABLE; Schema: public; Owner: -
1282 CREATE TABLE public.oauth_access_tokens (
1284 resource_owner_id bigint,
1285 application_id bigint NOT NULL,
1286 token character varying NOT NULL,
1287 refresh_token character varying,
1289 revoked_at timestamp without time zone,
1290 created_at timestamp without time zone NOT NULL,
1291 scopes character varying,
1292 previous_refresh_token character varying DEFAULT ''::character varying NOT NULL
1297 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1300 CREATE SEQUENCE public.oauth_access_tokens_id_seq
1309 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1312 ALTER SEQUENCE public.oauth_access_tokens_id_seq OWNED BY public.oauth_access_tokens.id;
1316 -- Name: oauth_applications; Type: TABLE; Schema: public; Owner: -
1319 CREATE TABLE public.oauth_applications (
1321 owner_type character varying NOT NULL,
1322 owner_id bigint NOT NULL,
1323 name character varying NOT NULL,
1324 uid character varying NOT NULL,
1325 secret character varying NOT NULL,
1326 redirect_uri text NOT NULL,
1327 scopes character varying DEFAULT ''::character varying NOT NULL,
1328 confidential boolean DEFAULT true NOT NULL,
1329 created_at timestamp(6) without time zone NOT NULL,
1330 updated_at timestamp(6) without time zone NOT NULL
1335 -- Name: oauth_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1338 CREATE SEQUENCE public.oauth_applications_id_seq
1347 -- Name: oauth_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1350 ALTER SEQUENCE public.oauth_applications_id_seq OWNED BY public.oauth_applications.id;
1354 -- Name: oauth_openid_requests; Type: TABLE; Schema: public; Owner: -
1357 CREATE TABLE public.oauth_openid_requests (
1359 access_grant_id bigint NOT NULL,
1360 nonce character varying NOT NULL
1365 -- Name: oauth_openid_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1368 CREATE SEQUENCE public.oauth_openid_requests_id_seq
1377 -- Name: oauth_openid_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1380 ALTER SEQUENCE public.oauth_openid_requests_id_seq OWNED BY public.oauth_openid_requests.id;
1384 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1387 CREATE TABLE public.redactions (
1388 id integer NOT NULL,
1389 title character varying NOT NULL,
1390 description text NOT NULL,
1391 created_at timestamp without time zone,
1392 updated_at timestamp without time zone,
1393 user_id bigint NOT NULL,
1394 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1399 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1402 CREATE SEQUENCE public.redactions_id_seq
1412 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1415 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1419 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1422 CREATE TABLE public.relation_members (
1423 relation_id bigint NOT NULL,
1424 member_type public.nwr_enum NOT NULL,
1425 member_id bigint NOT NULL,
1426 member_role character varying NOT NULL,
1427 version bigint DEFAULT 0 NOT NULL,
1428 sequence_id integer DEFAULT 0 NOT NULL
1433 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1436 CREATE TABLE public.relation_tags (
1437 relation_id bigint NOT NULL,
1438 k character varying DEFAULT ''::character varying NOT NULL,
1439 v character varying DEFAULT ''::character varying NOT NULL,
1440 version bigint NOT NULL
1445 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1448 CREATE TABLE public.relations (
1449 relation_id bigint NOT NULL,
1450 changeset_id bigint NOT NULL,
1451 "timestamp" timestamp without time zone NOT NULL,
1452 version bigint NOT NULL,
1453 visible boolean DEFAULT true NOT NULL,
1454 redaction_id integer
1459 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1462 CREATE TABLE public.reports (
1463 id integer NOT NULL,
1464 issue_id integer NOT NULL,
1465 user_id integer NOT NULL,
1466 details text NOT NULL,
1467 category character varying NOT NULL,
1468 created_at timestamp without time zone NOT NULL,
1469 updated_at timestamp without time zone NOT NULL
1474 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1477 CREATE SEQUENCE public.reports_id_seq
1487 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1490 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1494 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1497 CREATE TABLE public.schema_migrations (
1498 version character varying NOT NULL
1503 -- Name: social_links; Type: TABLE; Schema: public; Owner: -
1506 CREATE TABLE public.social_links (
1508 user_id bigint NOT NULL,
1509 url character varying NOT NULL,
1510 created_at timestamp(6) without time zone NOT NULL,
1511 updated_at timestamp(6) without time zone NOT NULL
1516 -- Name: social_links_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1519 CREATE SEQUENCE public.social_links_id_seq
1528 -- Name: social_links_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1531 ALTER SEQUENCE public.social_links_id_seq OWNED BY public.social_links.id;
1535 -- Name: spammy_phrases; Type: TABLE; Schema: public; Owner: -
1538 CREATE TABLE public.spammy_phrases (
1540 phrase character varying,
1541 created_at timestamp(6) without time zone NOT NULL,
1542 updated_at timestamp(6) without time zone NOT NULL
1547 -- Name: spammy_phrases_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1550 CREATE SEQUENCE public.spammy_phrases_id_seq
1559 -- Name: spammy_phrases_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1562 ALTER SEQUENCE public.spammy_phrases_id_seq OWNED BY public.spammy_phrases.id;
1566 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1569 CREATE TABLE public.user_blocks (
1570 id integer NOT NULL,
1571 user_id bigint NOT NULL,
1572 creator_id bigint NOT NULL,
1573 reason text NOT NULL,
1574 ends_at timestamp without time zone NOT NULL,
1575 needs_view boolean DEFAULT false NOT NULL,
1577 created_at timestamp without time zone,
1578 updated_at timestamp without time zone,
1579 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1580 deactivates_at timestamp without time zone
1585 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1588 CREATE SEQUENCE public.user_blocks_id_seq
1598 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1601 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1605 -- Name: user_mutes; Type: TABLE; Schema: public; Owner: -
1608 CREATE TABLE public.user_mutes (
1610 owner_id bigint NOT NULL,
1611 subject_id bigint NOT NULL,
1612 created_at timestamp(6) without time zone NOT NULL,
1613 updated_at timestamp(6) without time zone NOT NULL
1618 -- Name: user_mutes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1621 CREATE SEQUENCE public.user_mutes_id_seq
1630 -- Name: user_mutes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1633 ALTER SEQUENCE public.user_mutes_id_seq OWNED BY public.user_mutes.id;
1637 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1640 CREATE TABLE public.user_preferences (
1641 user_id bigint NOT NULL,
1642 k character varying NOT NULL,
1643 v character varying NOT NULL
1648 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1651 CREATE TABLE public.user_roles (
1652 id integer NOT NULL,
1653 user_id bigint NOT NULL,
1654 role public.user_role_enum NOT NULL,
1655 created_at timestamp without time zone,
1656 updated_at timestamp without time zone,
1657 granter_id bigint NOT NULL
1662 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1665 CREATE SEQUENCE public.user_roles_id_seq
1675 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1678 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1682 -- Name: users; Type: TABLE; Schema: public; Owner: -
1685 CREATE TABLE public.users (
1686 email character varying NOT NULL,
1688 pass_crypt character varying NOT NULL,
1689 creation_time timestamp without time zone NOT NULL,
1690 display_name character varying DEFAULT ''::character varying NOT NULL,
1691 data_public boolean DEFAULT false NOT NULL,
1692 description text DEFAULT ''::text NOT NULL,
1693 home_lat double precision,
1694 home_lon double precision,
1695 home_zoom smallint DEFAULT 3,
1696 pass_salt character varying,
1697 email_valid boolean DEFAULT false NOT NULL,
1698 new_email character varying,
1699 languages character varying,
1700 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1701 terms_agreed timestamp without time zone,
1702 consider_pd boolean DEFAULT false NOT NULL,
1703 auth_uid character varying,
1704 preferred_editor character varying,
1705 terms_seen boolean DEFAULT false NOT NULL,
1706 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1707 changesets_count integer DEFAULT 0 NOT NULL,
1708 traces_count integer DEFAULT 0 NOT NULL,
1709 diary_entries_count integer DEFAULT 0 NOT NULL,
1710 image_use_gravatar boolean DEFAULT false NOT NULL,
1711 auth_provider character varying,
1713 tou_agreed timestamp without time zone,
1714 diary_comments_count integer DEFAULT 0,
1715 note_comments_count integer DEFAULT 0,
1716 creation_address inet,
1717 home_location_name character varying,
1718 company character varying,
1719 public_heatmap boolean DEFAULT true NOT NULL
1724 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1727 CREATE SEQUENCE public.users_id_seq
1736 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1739 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1743 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1746 CREATE TABLE public.way_nodes (
1747 way_id bigint NOT NULL,
1748 node_id bigint NOT NULL,
1749 version bigint NOT NULL,
1750 sequence_id bigint NOT NULL
1755 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1758 CREATE TABLE public.way_tags (
1759 way_id bigint NOT NULL,
1760 k character varying NOT NULL,
1761 v character varying NOT NULL,
1762 version bigint NOT NULL
1767 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1770 CREATE TABLE public.ways (
1771 way_id bigint NOT NULL,
1772 changeset_id bigint NOT NULL,
1773 "timestamp" timestamp without time zone NOT NULL,
1774 version bigint NOT NULL,
1775 visible boolean DEFAULT true NOT NULL,
1776 redaction_id integer
1781 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1784 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1788 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1791 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1795 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1798 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1802 -- Name: active_storage_variant_records id; Type: DEFAULT; Schema: public; Owner: -
1805 ALTER TABLE ONLY public.active_storage_variant_records ALTER COLUMN id SET DEFAULT nextval('public.active_storage_variant_records_id_seq'::regclass);
1809 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1812 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1816 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1819 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1823 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1826 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1830 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1833 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1837 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1840 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1844 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1847 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1851 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1854 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1858 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1861 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1865 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1868 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1872 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1875 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1879 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1882 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1886 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1889 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1893 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1896 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1900 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1903 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1907 -- Name: moderation_zones id; Type: DEFAULT; Schema: public; Owner: -
1910 ALTER TABLE ONLY public.moderation_zones ALTER COLUMN id SET DEFAULT nextval('public.moderation_zones_id_seq'::regclass);
1914 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1917 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1921 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1924 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1928 -- Name: noticed_events id; Type: DEFAULT; Schema: public; Owner: -
1931 ALTER TABLE ONLY public.noticed_events ALTER COLUMN id SET DEFAULT nextval('public.noticed_events_id_seq'::regclass);
1935 -- Name: noticed_notifications id; Type: DEFAULT; Schema: public; Owner: -
1938 ALTER TABLE ONLY public.noticed_notifications ALTER COLUMN id SET DEFAULT nextval('public.noticed_notifications_id_seq'::regclass);
1942 -- Name: oauth_access_grants id; Type: DEFAULT; Schema: public; Owner: -
1945 ALTER TABLE ONLY public.oauth_access_grants ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_grants_id_seq'::regclass);
1949 -- Name: oauth_access_tokens id; Type: DEFAULT; Schema: public; Owner: -
1952 ALTER TABLE ONLY public.oauth_access_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_tokens_id_seq'::regclass);
1956 -- Name: oauth_applications id; Type: DEFAULT; Schema: public; Owner: -
1959 ALTER TABLE ONLY public.oauth_applications ALTER COLUMN id SET DEFAULT nextval('public.oauth_applications_id_seq'::regclass);
1963 -- Name: oauth_openid_requests id; Type: DEFAULT; Schema: public; Owner: -
1966 ALTER TABLE ONLY public.oauth_openid_requests ALTER COLUMN id SET DEFAULT nextval('public.oauth_openid_requests_id_seq'::regclass);
1970 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1973 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1977 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1980 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1984 -- Name: social_links id; Type: DEFAULT; Schema: public; Owner: -
1987 ALTER TABLE ONLY public.social_links ALTER COLUMN id SET DEFAULT nextval('public.social_links_id_seq'::regclass);
1991 -- Name: spammy_phrases id; Type: DEFAULT; Schema: public; Owner: -
1994 ALTER TABLE ONLY public.spammy_phrases ALTER COLUMN id SET DEFAULT nextval('public.spammy_phrases_id_seq'::regclass);
1998 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
2001 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
2005 -- Name: user_mutes id; Type: DEFAULT; Schema: public; Owner: -
2008 ALTER TABLE ONLY public.user_mutes ALTER COLUMN id SET DEFAULT nextval('public.user_mutes_id_seq'::regclass);
2012 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
2015 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
2019 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
2022 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
2026 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2029 ALTER TABLE ONLY public.acls
2030 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
2034 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2037 ALTER TABLE ONLY public.active_storage_attachments
2038 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
2042 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2045 ALTER TABLE ONLY public.active_storage_blobs
2046 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
2050 -- Name: active_storage_variant_records active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2053 ALTER TABLE ONLY public.active_storage_variant_records
2054 ADD CONSTRAINT active_storage_variant_records_pkey PRIMARY KEY (id);
2058 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2061 ALTER TABLE ONLY public.ar_internal_metadata
2062 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
2066 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2069 ALTER TABLE ONLY public.changeset_comments
2070 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
2074 -- Name: changeset_tags changeset_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2077 ALTER TABLE ONLY public.changeset_tags
2078 ADD CONSTRAINT changeset_tags_pkey PRIMARY KEY (changeset_id, k);
2082 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2085 ALTER TABLE ONLY public.changesets
2086 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
2090 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2093 ALTER TABLE ONLY public.current_node_tags
2094 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
2098 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
2101 ALTER TABLE ONLY public.current_nodes
2102 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
2106 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2109 ALTER TABLE ONLY public.current_relation_members
2110 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, sequence_id);
2114 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2117 ALTER TABLE ONLY public.current_relation_tags
2118 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
2122 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2125 ALTER TABLE ONLY public.current_relations
2126 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
2130 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2133 ALTER TABLE ONLY public.current_way_nodes
2134 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
2138 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2141 ALTER TABLE ONLY public.current_way_tags
2142 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
2146 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2149 ALTER TABLE ONLY public.current_ways
2150 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
2154 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2157 ALTER TABLE ONLY public.delayed_jobs
2158 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
2162 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2165 ALTER TABLE ONLY public.diary_comments
2166 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
2170 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2173 ALTER TABLE ONLY public.diary_entries
2174 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
2178 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2181 ALTER TABLE ONLY public.diary_entry_subscriptions
2182 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
2186 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2189 ALTER TABLE ONLY public.friends
2190 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
2194 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2197 ALTER TABLE ONLY public.gpx_file_tags
2198 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
2202 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2205 ALTER TABLE ONLY public.gpx_files
2206 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
2210 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2213 ALTER TABLE ONLY public.issue_comments
2214 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
2218 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2221 ALTER TABLE ONLY public.issues
2222 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
2226 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2229 ALTER TABLE ONLY public.languages
2230 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
2234 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2237 ALTER TABLE ONLY public.messages
2238 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
2242 -- Name: moderation_zones moderation_zones_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2245 ALTER TABLE ONLY public.moderation_zones
2246 ADD CONSTRAINT moderation_zones_pkey PRIMARY KEY (id);
2250 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2253 ALTER TABLE ONLY public.node_tags
2254 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
2258 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2261 ALTER TABLE ONLY public.nodes
2262 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
2266 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2269 ALTER TABLE ONLY public.note_comments
2270 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
2274 -- Name: note_subscriptions note_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2277 ALTER TABLE ONLY public.note_subscriptions
2278 ADD CONSTRAINT note_subscriptions_pkey PRIMARY KEY (user_id, note_id);
2282 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2285 ALTER TABLE ONLY public.notes
2286 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
2290 -- Name: noticed_events noticed_events_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2293 ALTER TABLE ONLY public.noticed_events
2294 ADD CONSTRAINT noticed_events_pkey PRIMARY KEY (id);
2298 -- Name: noticed_notifications noticed_notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2301 ALTER TABLE ONLY public.noticed_notifications
2302 ADD CONSTRAINT noticed_notifications_pkey PRIMARY KEY (id);
2306 -- Name: oauth_access_grants oauth_access_grants_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2309 ALTER TABLE ONLY public.oauth_access_grants
2310 ADD CONSTRAINT oauth_access_grants_pkey PRIMARY KEY (id);
2314 -- Name: oauth_access_tokens oauth_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2317 ALTER TABLE ONLY public.oauth_access_tokens
2318 ADD CONSTRAINT oauth_access_tokens_pkey PRIMARY KEY (id);
2322 -- Name: oauth_applications oauth_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2325 ALTER TABLE ONLY public.oauth_applications
2326 ADD CONSTRAINT oauth_applications_pkey PRIMARY KEY (id);
2330 -- Name: oauth_openid_requests oauth_openid_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2333 ALTER TABLE ONLY public.oauth_openid_requests
2334 ADD CONSTRAINT oauth_openid_requests_pkey PRIMARY KEY (id);
2338 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2341 ALTER TABLE ONLY public.redactions
2342 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
2346 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2349 ALTER TABLE ONLY public.relation_members
2350 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, sequence_id);
2354 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2357 ALTER TABLE ONLY public.relation_tags
2358 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
2362 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2365 ALTER TABLE ONLY public.relations
2366 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
2370 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2373 ALTER TABLE ONLY public.reports
2374 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
2378 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2381 ALTER TABLE ONLY public.schema_migrations
2382 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
2386 -- Name: social_links social_links_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2389 ALTER TABLE ONLY public.social_links
2390 ADD CONSTRAINT social_links_pkey PRIMARY KEY (id);
2394 -- Name: spammy_phrases spammy_phrases_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2397 ALTER TABLE ONLY public.spammy_phrases
2398 ADD CONSTRAINT spammy_phrases_pkey PRIMARY KEY (id);
2402 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2405 ALTER TABLE ONLY public.user_blocks
2406 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
2410 -- Name: user_mutes user_mutes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2413 ALTER TABLE ONLY public.user_mutes
2414 ADD CONSTRAINT user_mutes_pkey PRIMARY KEY (id);
2418 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2421 ALTER TABLE ONLY public.user_preferences
2422 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
2426 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2429 ALTER TABLE ONLY public.user_roles
2430 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
2434 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2437 ALTER TABLE ONLY public.users
2438 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2442 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2445 ALTER TABLE ONLY public.way_nodes
2446 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2450 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2453 ALTER TABLE ONLY public.way_tags
2454 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2458 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2461 ALTER TABLE ONLY public.ways
2462 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2466 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2469 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2473 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2476 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2480 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2483 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2487 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2490 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2494 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2497 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2501 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2504 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2508 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2511 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2515 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2518 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2522 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2525 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2529 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2532 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2536 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2539 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2543 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2546 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2550 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2553 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2557 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2560 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2564 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2567 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2571 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2574 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2578 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2581 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2585 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2588 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2592 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2595 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2599 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2602 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2606 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2609 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2613 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2616 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2620 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2623 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2627 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2630 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2634 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2637 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2641 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2644 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2648 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2651 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2655 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2658 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2662 -- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
2665 CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest);
2669 -- Name: index_changeset_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2672 CREATE INDEX index_changeset_comments_on_author_id_and_created_at ON public.changeset_comments USING btree (author_id, created_at);
2676 -- Name: index_changeset_comments_on_author_id_and_id; Type: INDEX; Schema: public; Owner: -
2679 CREATE INDEX index_changeset_comments_on_author_id_and_id ON public.changeset_comments USING btree (author_id, id);
2683 -- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2686 CREATE INDEX index_changeset_comments_on_changeset_id_and_created_at ON public.changeset_comments USING btree (changeset_id, created_at);
2690 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2693 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2697 -- Name: index_changesets_on_user_id_and_closed_at; Type: INDEX; Schema: public; Owner: -
2700 CREATE INDEX index_changesets_on_user_id_and_closed_at ON public.changesets USING btree (user_id, closed_at);
2704 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2707 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2711 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2714 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2718 -- Name: index_diary_comments_on_user_id_and_id; Type: INDEX; Schema: public; Owner: -
2721 CREATE INDEX index_diary_comments_on_user_id_and_id ON public.diary_comments USING btree (user_id, id);
2725 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2728 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2732 -- Name: index_friends_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2735 CREATE INDEX index_friends_on_user_id_and_created_at ON public.friends USING btree (user_id, created_at);
2739 -- Name: index_gpx_files_on_user_id_and_id; Type: INDEX; Schema: public; Owner: -
2742 CREATE INDEX index_gpx_files_on_user_id_and_id ON public.gpx_files USING btree (user_id, id);
2746 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2749 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2753 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2756 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2760 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2763 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2767 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2770 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2774 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2777 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2781 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2784 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2788 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2791 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2795 -- Name: index_moderation_zones_on_creator_id; Type: INDEX; Schema: public; Owner: -
2798 CREATE INDEX index_moderation_zones_on_creator_id ON public.moderation_zones USING btree (creator_id);
2802 -- Name: index_moderation_zones_on_revoker_id; Type: INDEX; Schema: public; Owner: -
2805 CREATE INDEX index_moderation_zones_on_revoker_id ON public.moderation_zones USING btree (revoker_id);
2809 -- Name: index_note_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2812 CREATE INDEX index_note_comments_on_author_id_and_created_at ON public.note_comments USING btree (author_id, created_at);
2816 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2819 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2823 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2826 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2830 -- Name: index_note_subscriptions_on_note_id; Type: INDEX; Schema: public; Owner: -
2833 CREATE INDEX index_note_subscriptions_on_note_id ON public.note_subscriptions USING btree (note_id);
2837 -- Name: index_notes_on_description; Type: INDEX; Schema: public; Owner: -
2840 CREATE INDEX index_notes_on_description ON public.notes USING gin (to_tsvector('english'::regconfig, description));
2844 -- Name: index_notes_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2847 CREATE INDEX index_notes_on_user_id_and_created_at ON public.notes USING btree (user_id, created_at) WHERE (user_id IS NOT NULL);
2851 -- Name: index_noticed_events_on_record; Type: INDEX; Schema: public; Owner: -
2854 CREATE INDEX index_noticed_events_on_record ON public.noticed_events USING btree (record_type, record_id);
2858 -- Name: index_noticed_notifications_on_event_id; Type: INDEX; Schema: public; Owner: -
2861 CREATE INDEX index_noticed_notifications_on_event_id ON public.noticed_notifications USING btree (event_id);
2865 -- Name: index_noticed_notifications_on_recipient; Type: INDEX; Schema: public; Owner: -
2868 CREATE INDEX index_noticed_notifications_on_recipient ON public.noticed_notifications USING btree (recipient_type, recipient_id);
2872 -- Name: index_oauth_access_grants_on_application_id; Type: INDEX; Schema: public; Owner: -
2875 CREATE INDEX index_oauth_access_grants_on_application_id ON public.oauth_access_grants USING btree (application_id);
2879 -- Name: index_oauth_access_grants_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2882 CREATE INDEX index_oauth_access_grants_on_resource_owner_id ON public.oauth_access_grants USING btree (resource_owner_id);
2886 -- Name: index_oauth_access_grants_on_token; Type: INDEX; Schema: public; Owner: -
2889 CREATE UNIQUE INDEX index_oauth_access_grants_on_token ON public.oauth_access_grants USING btree (token);
2893 -- Name: index_oauth_access_tokens_on_application_id; Type: INDEX; Schema: public; Owner: -
2896 CREATE INDEX index_oauth_access_tokens_on_application_id ON public.oauth_access_tokens USING btree (application_id);
2900 -- Name: index_oauth_access_tokens_on_refresh_token; Type: INDEX; Schema: public; Owner: -
2903 CREATE UNIQUE INDEX index_oauth_access_tokens_on_refresh_token ON public.oauth_access_tokens USING btree (refresh_token);
2907 -- Name: index_oauth_access_tokens_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2910 CREATE INDEX index_oauth_access_tokens_on_resource_owner_id ON public.oauth_access_tokens USING btree (resource_owner_id);
2914 -- Name: index_oauth_access_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2917 CREATE UNIQUE INDEX index_oauth_access_tokens_on_token ON public.oauth_access_tokens USING btree (token);
2921 -- Name: index_oauth_applications_on_owner_type_and_owner_id; Type: INDEX; Schema: public; Owner: -
2924 CREATE INDEX index_oauth_applications_on_owner_type_and_owner_id ON public.oauth_applications USING btree (owner_type, owner_id);
2928 -- Name: index_oauth_applications_on_uid; Type: INDEX; Schema: public; Owner: -
2931 CREATE UNIQUE INDEX index_oauth_applications_on_uid ON public.oauth_applications USING btree (uid);
2935 -- Name: index_oauth_openid_requests_on_access_grant_id; Type: INDEX; Schema: public; Owner: -
2938 CREATE INDEX index_oauth_openid_requests_on_access_grant_id ON public.oauth_openid_requests USING btree (access_grant_id);
2942 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2945 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2949 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2952 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2956 -- Name: index_social_links_on_user_id; Type: INDEX; Schema: public; Owner: -
2959 CREATE INDEX index_social_links_on_user_id ON public.social_links USING btree (user_id);
2963 -- Name: index_user_blocks_on_creator_id_and_id; Type: INDEX; Schema: public; Owner: -
2966 CREATE INDEX index_user_blocks_on_creator_id_and_id ON public.user_blocks USING btree (creator_id, id);
2970 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2973 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2977 -- Name: index_user_mutes_on_owner_id_and_subject_id; Type: INDEX; Schema: public; Owner: -
2980 CREATE UNIQUE INDEX index_user_mutes_on_owner_id_and_subject_id ON public.user_mutes USING btree (owner_id, subject_id);
2984 -- Name: index_users_on_creation_address; Type: INDEX; Schema: public; Owner: -
2987 CREATE INDEX index_users_on_creation_address ON public.users USING gist (creation_address inet_ops);
2991 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2994 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2998 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
3001 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
3005 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
3008 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
3012 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
3015 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
3019 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
3022 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
3026 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
3029 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
3033 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
3036 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
3040 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
3043 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
3047 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
3050 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
3054 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
3057 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
3061 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
3064 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
3068 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
3071 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
3075 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
3078 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
3082 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
3085 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
3089 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
3092 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
3096 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
3099 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
3103 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
3106 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
3110 -- Name: users_display_name_canonical_idx; Type: INDEX; Schema: public; Owner: -
3113 CREATE INDEX users_display_name_canonical_idx ON public.users USING btree (lower(NORMALIZE(display_name, NFKC)));
3117 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
3120 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
3124 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
3127 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
3131 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
3134 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
3138 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
3141 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
3145 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
3148 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
3152 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
3155 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
3159 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
3162 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
3166 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3169 ALTER TABLE ONLY public.changeset_comments
3170 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
3174 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3177 ALTER TABLE ONLY public.changeset_comments
3178 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3182 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3185 ALTER TABLE ONLY public.changeset_tags
3186 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3190 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3193 ALTER TABLE ONLY public.changesets_subscribers
3194 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3198 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3201 ALTER TABLE ONLY public.changesets_subscribers
3202 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
3206 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3209 ALTER TABLE ONLY public.changesets
3210 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3214 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3217 ALTER TABLE ONLY public.current_node_tags
3218 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
3222 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3225 ALTER TABLE ONLY public.current_nodes
3226 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3230 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3233 ALTER TABLE ONLY public.current_relation_members
3234 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
3238 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3241 ALTER TABLE ONLY public.current_relation_tags
3242 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
3246 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3249 ALTER TABLE ONLY public.current_relations
3250 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3254 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3257 ALTER TABLE ONLY public.current_way_nodes
3258 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
3262 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3265 ALTER TABLE ONLY public.current_way_nodes
3266 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
3270 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3273 ALTER TABLE ONLY public.current_way_tags
3274 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
3278 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3281 ALTER TABLE ONLY public.current_ways
3282 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3286 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3289 ALTER TABLE ONLY public.diary_comments
3290 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
3294 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3297 ALTER TABLE ONLY public.diary_comments
3298 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3302 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3305 ALTER TABLE ONLY public.diary_entries
3306 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
3310 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3313 ALTER TABLE ONLY public.diary_entries
3314 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3318 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3321 ALTER TABLE ONLY public.diary_entry_subscriptions
3322 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
3326 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3329 ALTER TABLE ONLY public.diary_entry_subscriptions
3330 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3334 -- Name: note_subscriptions fk_rails_2c1913f293; Type: FK CONSTRAINT; Schema: public; Owner: -
3337 ALTER TABLE ONLY public.note_subscriptions
3338 ADD CONSTRAINT fk_rails_2c1913f293 FOREIGN KEY (note_id) REFERENCES public.notes(id);
3342 -- Name: oauth_access_grants fk_rails_330c32d8d9; Type: FK CONSTRAINT; Schema: public; Owner: -
3345 ALTER TABLE ONLY public.oauth_access_grants
3346 ADD CONSTRAINT fk_rails_330c32d8d9 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3350 -- Name: user_mutes fk_rails_591dad3359; Type: FK CONSTRAINT; Schema: public; Owner: -
3353 ALTER TABLE ONLY public.user_mutes
3354 ADD CONSTRAINT fk_rails_591dad3359 FOREIGN KEY (owner_id) REFERENCES public.users(id);
3358 -- Name: social_links fk_rails_6034fd4f62; Type: FK CONSTRAINT; Schema: public; Owner: -
3361 ALTER TABLE ONLY public.social_links
3362 ADD CONSTRAINT fk_rails_6034fd4f62 FOREIGN KEY (user_id) REFERENCES public.users(id);
3366 -- Name: moderation_zones fk_rails_6a0b70e3da; Type: FK CONSTRAINT; Schema: public; Owner: -
3369 ALTER TABLE ONLY public.moderation_zones
3370 ADD CONSTRAINT fk_rails_6a0b70e3da FOREIGN KEY (creator_id) REFERENCES public.users(id);
3374 -- Name: oauth_access_tokens fk_rails_732cb83ab7; Type: FK CONSTRAINT; Schema: public; Owner: -
3377 ALTER TABLE ONLY public.oauth_access_tokens
3378 ADD CONSTRAINT fk_rails_732cb83ab7 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3382 -- Name: oauth_openid_requests fk_rails_77114b3b09; Type: FK CONSTRAINT; Schema: public; Owner: -
3385 ALTER TABLE ONLY public.oauth_openid_requests
3386 ADD CONSTRAINT fk_rails_77114b3b09 FOREIGN KEY (access_grant_id) REFERENCES public.oauth_access_grants(id) ON DELETE CASCADE;
3390 -- Name: active_storage_variant_records fk_rails_993965df05; Type: FK CONSTRAINT; Schema: public; Owner: -
3393 ALTER TABLE ONLY public.active_storage_variant_records
3394 ADD CONSTRAINT fk_rails_993965df05 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3398 -- Name: note_subscriptions fk_rails_a352f4eced; Type: FK CONSTRAINT; Schema: public; Owner: -
3401 ALTER TABLE ONLY public.note_subscriptions
3402 ADD CONSTRAINT fk_rails_a352f4eced FOREIGN KEY (user_id) REFERENCES public.users(id);
3406 -- Name: oauth_access_grants fk_rails_b4b53e07b8; Type: FK CONSTRAINT; Schema: public; Owner: -
3409 ALTER TABLE ONLY public.oauth_access_grants
3410 ADD CONSTRAINT fk_rails_b4b53e07b8 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3414 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
3417 ALTER TABLE ONLY public.active_storage_attachments
3418 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3422 -- Name: oauth_applications fk_rails_cc886e315a; Type: FK CONSTRAINT; Schema: public; Owner: -
3425 ALTER TABLE ONLY public.oauth_applications
3426 ADD CONSTRAINT fk_rails_cc886e315a FOREIGN KEY (owner_id) REFERENCES public.users(id) NOT VALID;
3430 -- Name: user_mutes fk_rails_e9dd4fb6c3; Type: FK CONSTRAINT; Schema: public; Owner: -
3433 ALTER TABLE ONLY public.user_mutes
3434 ADD CONSTRAINT fk_rails_e9dd4fb6c3 FOREIGN KEY (subject_id) REFERENCES public.users(id);
3438 -- Name: oauth_access_tokens fk_rails_ee63f25419; Type: FK CONSTRAINT; Schema: public; Owner: -
3441 ALTER TABLE ONLY public.oauth_access_tokens
3442 ADD CONSTRAINT fk_rails_ee63f25419 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3446 -- Name: moderation_zones fk_rails_f2132b7340; Type: FK CONSTRAINT; Schema: public; Owner: -
3449 ALTER TABLE ONLY public.moderation_zones
3450 ADD CONSTRAINT fk_rails_f2132b7340 FOREIGN KEY (revoker_id) REFERENCES public.users(id);
3454 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3457 ALTER TABLE ONLY public.friends
3458 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
3462 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3465 ALTER TABLE ONLY public.friends
3466 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3470 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3473 ALTER TABLE ONLY public.gps_points
3474 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3478 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3481 ALTER TABLE ONLY public.gpx_file_tags
3482 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3486 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3489 ALTER TABLE ONLY public.gpx_files
3490 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3494 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3497 ALTER TABLE ONLY public.issue_comments
3498 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3502 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3505 ALTER TABLE ONLY public.issue_comments
3506 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3510 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3513 ALTER TABLE ONLY public.issues
3514 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
3518 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3521 ALTER TABLE ONLY public.issues
3522 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
3526 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3529 ALTER TABLE ONLY public.issues
3530 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
3534 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3537 ALTER TABLE ONLY public.messages
3538 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
3542 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3545 ALTER TABLE ONLY public.messages
3546 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
3550 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3553 ALTER TABLE ONLY public.node_tags
3554 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
3558 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3561 ALTER TABLE ONLY public.nodes
3562 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3566 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3569 ALTER TABLE ONLY public.nodes
3570 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3574 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3577 ALTER TABLE ONLY public.note_comments
3578 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
3582 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3585 ALTER TABLE ONLY public.note_comments
3586 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
3590 -- Name: notes notes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3593 ALTER TABLE ONLY public.notes
3594 ADD CONSTRAINT notes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3598 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3601 ALTER TABLE ONLY public.redactions
3602 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3606 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3609 ALTER TABLE ONLY public.relation_members
3610 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3614 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3617 ALTER TABLE ONLY public.relation_tags
3618 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3622 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3625 ALTER TABLE ONLY public.relations
3626 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3630 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3633 ALTER TABLE ONLY public.relations
3634 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3638 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3641 ALTER TABLE ONLY public.reports
3642 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3646 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3649 ALTER TABLE ONLY public.reports
3650 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3654 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3657 ALTER TABLE ONLY public.user_blocks
3658 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
3662 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3665 ALTER TABLE ONLY public.user_blocks
3666 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
3670 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3673 ALTER TABLE ONLY public.user_blocks
3674 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3678 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3681 ALTER TABLE ONLY public.user_preferences
3682 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3686 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3689 ALTER TABLE ONLY public.user_roles
3690 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3694 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3697 ALTER TABLE ONLY public.user_roles
3698 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3702 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3705 ALTER TABLE ONLY public.way_nodes
3706 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3710 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3713 ALTER TABLE ONLY public.way_tags
3714 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3718 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3721 ALTER TABLE ONLY public.ways
3722 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3726 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3729 ALTER TABLE ONLY public.ways
3730 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3734 -- PostgreSQL database dump complete
3737 SET search_path TO "$user", public;
3739 INSERT INTO "schema_migrations" (version) VALUES