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;
179 SET default_tablespace = '';
181 SET default_table_access_method = heap;
184 -- Name: acls; Type: TABLE; Schema: public; Owner: -
187 CREATE TABLE public.acls (
190 k character varying NOT NULL,
192 domain character varying,
198 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
201 CREATE SEQUENCE public.acls_id_seq
210 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
213 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
217 -- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
220 CREATE TABLE public.active_storage_attachments (
222 name character varying NOT NULL,
223 record_type character varying NOT NULL,
224 record_id bigint NOT NULL,
225 blob_id bigint NOT NULL,
226 created_at timestamp without time zone NOT NULL
231 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
234 CREATE SEQUENCE public.active_storage_attachments_id_seq
243 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
246 ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
250 -- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
253 CREATE TABLE public.active_storage_blobs (
255 key character varying NOT NULL,
256 filename character varying NOT NULL,
257 content_type character varying,
259 byte_size bigint NOT NULL,
260 checksum character varying,
261 created_at timestamp without time zone NOT NULL,
262 service_name character varying NOT NULL
267 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
270 CREATE SEQUENCE public.active_storage_blobs_id_seq
279 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
282 ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
286 -- Name: active_storage_variant_records; Type: TABLE; Schema: public; Owner: -
289 CREATE TABLE public.active_storage_variant_records (
291 blob_id bigint NOT NULL,
292 variation_digest character varying NOT NULL
297 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE; Schema: public; Owner: -
300 CREATE SEQUENCE public.active_storage_variant_records_id_seq
309 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
312 ALTER SEQUENCE public.active_storage_variant_records_id_seq OWNED BY public.active_storage_variant_records.id;
316 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
319 CREATE TABLE public.ar_internal_metadata (
320 key character varying NOT NULL,
321 value character varying,
322 created_at timestamp(6) without time zone NOT NULL,
323 updated_at timestamp(6) without time zone NOT NULL
328 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
331 CREATE TABLE public.changeset_comments (
333 changeset_id bigint NOT NULL,
334 author_id bigint NOT NULL,
336 created_at timestamp without time zone NOT NULL,
337 visible boolean NOT NULL
342 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
345 CREATE SEQUENCE public.changeset_comments_id_seq
355 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
358 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
362 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
365 CREATE TABLE public.changeset_tags (
366 changeset_id bigint NOT NULL,
367 k character varying DEFAULT ''::character varying NOT NULL,
368 v character varying DEFAULT ''::character varying NOT NULL
373 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
376 CREATE TABLE public.changesets (
378 user_id bigint NOT NULL,
379 created_at timestamp without time zone NOT NULL,
384 closed_at timestamp without time zone NOT NULL,
385 num_changes integer DEFAULT 0 NOT NULL
390 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
393 CREATE SEQUENCE public.changesets_id_seq
402 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
405 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
409 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
412 CREATE TABLE public.changesets_subscribers (
413 subscriber_id bigint NOT NULL,
414 changeset_id bigint NOT NULL
419 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
422 CREATE TABLE public.client_applications (
424 name character varying,
425 url character varying,
426 support_url character varying,
427 callback_url character varying,
428 key character varying(50),
429 secret character varying(50),
431 created_at timestamp without time zone,
432 updated_at timestamp without time zone,
433 allow_read_prefs boolean DEFAULT false NOT NULL,
434 allow_write_prefs boolean DEFAULT false NOT NULL,
435 allow_write_diary boolean DEFAULT false NOT NULL,
436 allow_write_api boolean DEFAULT false NOT NULL,
437 allow_read_gpx boolean DEFAULT false NOT NULL,
438 allow_write_gpx boolean DEFAULT false NOT NULL,
439 allow_write_notes boolean DEFAULT false NOT NULL
444 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
447 CREATE SEQUENCE public.client_applications_id_seq
457 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
460 ALTER SEQUENCE public.client_applications_id_seq OWNED BY public.client_applications.id;
464 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
467 CREATE TABLE public.current_node_tags (
468 node_id bigint NOT NULL,
469 k character varying DEFAULT ''::character varying NOT NULL,
470 v character varying DEFAULT ''::character varying NOT NULL
475 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
478 CREATE TABLE public.current_nodes (
480 latitude integer NOT NULL,
481 longitude integer NOT NULL,
482 changeset_id bigint NOT NULL,
483 visible boolean NOT NULL,
484 "timestamp" timestamp without time zone NOT NULL,
485 tile bigint NOT NULL,
486 version bigint NOT NULL
491 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
494 CREATE SEQUENCE public.current_nodes_id_seq
503 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
506 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
510 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
513 CREATE TABLE public.current_relation_members (
514 relation_id bigint NOT NULL,
515 member_type public.nwr_enum NOT NULL,
516 member_id bigint NOT NULL,
517 member_role character varying NOT NULL,
518 sequence_id integer DEFAULT 0 NOT NULL
523 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
526 CREATE TABLE public.current_relation_tags (
527 relation_id bigint NOT NULL,
528 k character varying DEFAULT ''::character varying NOT NULL,
529 v character varying DEFAULT ''::character varying NOT NULL
534 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
537 CREATE TABLE public.current_relations (
539 changeset_id bigint NOT NULL,
540 "timestamp" timestamp without time zone NOT NULL,
541 visible boolean NOT NULL,
542 version bigint NOT NULL
547 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
550 CREATE SEQUENCE public.current_relations_id_seq
559 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
562 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
566 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
569 CREATE TABLE public.current_way_nodes (
570 way_id bigint NOT NULL,
571 node_id bigint NOT NULL,
572 sequence_id bigint NOT NULL
577 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
580 CREATE TABLE public.current_way_tags (
581 way_id bigint NOT NULL,
582 k character varying DEFAULT ''::character varying NOT NULL,
583 v character varying DEFAULT ''::character varying NOT NULL
588 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
591 CREATE TABLE public.current_ways (
593 changeset_id bigint NOT NULL,
594 "timestamp" timestamp without time zone NOT NULL,
595 visible boolean NOT NULL,
596 version bigint NOT NULL
601 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
604 CREATE SEQUENCE public.current_ways_id_seq
613 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
616 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
620 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
623 CREATE TABLE public.delayed_jobs (
625 priority integer DEFAULT 0 NOT NULL,
626 attempts integer DEFAULT 0 NOT NULL,
627 handler text NOT NULL,
629 run_at timestamp without time zone,
630 locked_at timestamp without time zone,
631 failed_at timestamp without time zone,
632 locked_by character varying,
633 queue character varying,
634 created_at timestamp without time zone,
635 updated_at timestamp without time zone
640 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
643 CREATE SEQUENCE public.delayed_jobs_id_seq
652 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
655 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
659 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
662 CREATE TABLE public.diary_comments (
664 diary_entry_id bigint NOT NULL,
665 user_id bigint NOT NULL,
667 created_at timestamp without time zone NOT NULL,
668 updated_at timestamp without time zone NOT NULL,
669 visible boolean DEFAULT true NOT NULL,
670 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
675 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
678 CREATE SEQUENCE public.diary_comments_id_seq
687 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
690 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
694 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
697 CREATE TABLE public.diary_entries (
699 user_id bigint NOT NULL,
700 title character varying NOT NULL,
702 created_at timestamp without time zone NOT NULL,
703 updated_at timestamp without time zone NOT NULL,
704 latitude double precision,
705 longitude double precision,
706 language_code character varying DEFAULT 'en'::character varying NOT NULL,
707 visible boolean DEFAULT true NOT NULL,
708 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
713 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
716 CREATE SEQUENCE public.diary_entries_id_seq
725 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
728 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
732 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
735 CREATE TABLE public.diary_entry_subscriptions (
736 user_id bigint NOT NULL,
737 diary_entry_id bigint NOT NULL
742 -- Name: friends; Type: TABLE; Schema: public; Owner: -
745 CREATE TABLE public.friends (
747 user_id bigint NOT NULL,
748 friend_user_id bigint NOT NULL,
749 created_at timestamp without time zone
754 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
757 CREATE SEQUENCE public.friends_id_seq
766 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
769 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
773 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
776 CREATE TABLE public.gps_points (
777 altitude double precision,
778 trackid integer NOT NULL,
779 latitude integer NOT NULL,
780 longitude integer NOT NULL,
781 gpx_id bigint NOT NULL,
782 "timestamp" timestamp without time zone,
788 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
791 CREATE TABLE public.gpx_file_tags (
792 gpx_id bigint NOT NULL,
793 tag character varying NOT NULL,
799 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
802 CREATE SEQUENCE public.gpx_file_tags_id_seq
811 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
814 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
818 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
821 CREATE TABLE public.gpx_files (
823 user_id bigint NOT NULL,
824 visible boolean DEFAULT true NOT NULL,
825 name character varying DEFAULT ''::character varying NOT NULL,
827 latitude double precision,
828 longitude double precision,
829 "timestamp" timestamp without time zone NOT NULL,
830 description character varying DEFAULT ''::character varying NOT NULL,
831 inserted boolean NOT NULL,
832 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
837 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
840 CREATE SEQUENCE public.gpx_files_id_seq
849 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
852 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
856 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
859 CREATE TABLE public.issue_comments (
861 issue_id integer NOT NULL,
862 user_id integer NOT NULL,
864 created_at timestamp without time zone NOT NULL,
865 updated_at timestamp without time zone NOT NULL
870 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
873 CREATE SEQUENCE public.issue_comments_id_seq
883 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
886 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
890 -- Name: issues; Type: TABLE; Schema: public; Owner: -
893 CREATE TABLE public.issues (
895 reportable_type character varying NOT NULL,
896 reportable_id integer NOT NULL,
897 reported_user_id integer,
898 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
899 assigned_role public.user_role_enum NOT NULL,
900 resolved_at timestamp without time zone,
903 reports_count integer DEFAULT 0,
904 created_at timestamp without time zone NOT NULL,
905 updated_at timestamp without time zone NOT NULL
910 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
913 CREATE SEQUENCE public.issues_id_seq
923 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
926 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
930 -- Name: languages; Type: TABLE; Schema: public; Owner: -
933 CREATE TABLE public.languages (
934 code character varying NOT NULL,
935 english_name character varying NOT NULL,
936 native_name character varying
941 -- Name: messages; Type: TABLE; Schema: public; Owner: -
944 CREATE TABLE public.messages (
946 from_user_id bigint NOT NULL,
947 title character varying NOT NULL,
949 sent_on timestamp without time zone NOT NULL,
950 message_read boolean DEFAULT false NOT NULL,
951 to_user_id bigint NOT NULL,
952 to_user_visible boolean DEFAULT true NOT NULL,
953 from_user_visible boolean DEFAULT true NOT NULL,
954 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
955 muted boolean DEFAULT false NOT NULL
960 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
963 CREATE SEQUENCE public.messages_id_seq
972 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
975 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
979 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
982 CREATE TABLE public.node_tags (
983 node_id bigint NOT NULL,
984 version bigint NOT NULL,
985 k character varying DEFAULT ''::character varying NOT NULL,
986 v character varying DEFAULT ''::character varying NOT NULL
991 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
994 CREATE TABLE public.nodes (
995 node_id bigint NOT NULL,
996 latitude integer NOT NULL,
997 longitude integer NOT NULL,
998 changeset_id bigint NOT NULL,
999 visible boolean NOT NULL,
1000 "timestamp" timestamp without time zone NOT NULL,
1001 tile bigint NOT NULL,
1002 version bigint NOT NULL,
1003 redaction_id integer
1008 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
1011 CREATE TABLE public.note_comments (
1013 note_id bigint NOT NULL,
1014 visible boolean NOT NULL,
1015 created_at timestamp without time zone NOT NULL,
1019 event public.note_event_enum
1024 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1027 CREATE SEQUENCE public.note_comments_id_seq
1036 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1039 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
1043 -- Name: notes; Type: TABLE; Schema: public; Owner: -
1046 CREATE TABLE public.notes (
1048 latitude integer NOT NULL,
1049 longitude integer NOT NULL,
1050 tile bigint NOT NULL,
1051 updated_at timestamp without time zone NOT NULL,
1052 created_at timestamp without time zone NOT NULL,
1053 status public.note_status_enum NOT NULL,
1054 closed_at timestamp without time zone
1059 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1062 CREATE SEQUENCE public.notes_id_seq
1071 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1074 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
1078 -- Name: oauth_access_grants; Type: TABLE; Schema: public; Owner: -
1081 CREATE TABLE public.oauth_access_grants (
1083 resource_owner_id bigint NOT NULL,
1084 application_id bigint NOT NULL,
1085 token character varying NOT NULL,
1086 expires_in integer NOT NULL,
1087 redirect_uri text NOT NULL,
1088 created_at timestamp without time zone NOT NULL,
1089 revoked_at timestamp without time zone,
1090 scopes character varying DEFAULT ''::character varying NOT NULL,
1091 code_challenge character varying,
1092 code_challenge_method character varying
1097 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1100 CREATE SEQUENCE public.oauth_access_grants_id_seq
1109 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1112 ALTER SEQUENCE public.oauth_access_grants_id_seq OWNED BY public.oauth_access_grants.id;
1116 -- Name: oauth_access_tokens; Type: TABLE; Schema: public; Owner: -
1119 CREATE TABLE public.oauth_access_tokens (
1121 resource_owner_id bigint,
1122 application_id bigint NOT NULL,
1123 token character varying NOT NULL,
1124 refresh_token character varying,
1126 revoked_at timestamp without time zone,
1127 created_at timestamp without time zone NOT NULL,
1128 scopes character varying,
1129 previous_refresh_token character varying DEFAULT ''::character varying NOT NULL
1134 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1137 CREATE SEQUENCE public.oauth_access_tokens_id_seq
1146 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1149 ALTER SEQUENCE public.oauth_access_tokens_id_seq OWNED BY public.oauth_access_tokens.id;
1153 -- Name: oauth_applications; Type: TABLE; Schema: public; Owner: -
1156 CREATE TABLE public.oauth_applications (
1158 owner_type character varying NOT NULL,
1159 owner_id bigint NOT NULL,
1160 name character varying NOT NULL,
1161 uid character varying NOT NULL,
1162 secret character varying NOT NULL,
1163 redirect_uri text NOT NULL,
1164 scopes character varying DEFAULT ''::character varying NOT NULL,
1165 confidential boolean DEFAULT true NOT NULL,
1166 created_at timestamp(6) without time zone NOT NULL,
1167 updated_at timestamp(6) without time zone NOT NULL
1172 -- Name: oauth_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1175 CREATE SEQUENCE public.oauth_applications_id_seq
1184 -- Name: oauth_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1187 ALTER SEQUENCE public.oauth_applications_id_seq OWNED BY public.oauth_applications.id;
1191 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
1194 CREATE TABLE public.oauth_nonces (
1196 nonce character varying,
1197 "timestamp" integer,
1198 created_at timestamp without time zone,
1199 updated_at timestamp without time zone
1204 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1207 CREATE SEQUENCE public.oauth_nonces_id_seq
1216 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1219 ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id;
1223 -- Name: oauth_openid_requests; Type: TABLE; Schema: public; Owner: -
1226 CREATE TABLE public.oauth_openid_requests (
1228 access_grant_id bigint NOT NULL,
1229 nonce character varying NOT NULL
1234 -- Name: oauth_openid_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1237 CREATE SEQUENCE public.oauth_openid_requests_id_seq
1246 -- Name: oauth_openid_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1249 ALTER SEQUENCE public.oauth_openid_requests_id_seq OWNED BY public.oauth_openid_requests.id;
1253 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
1256 CREATE TABLE public.oauth_tokens (
1257 id integer NOT NULL,
1259 type character varying(20),
1260 client_application_id integer,
1261 token character varying(50),
1262 secret character varying(50),
1263 authorized_at timestamp without time zone,
1264 invalidated_at timestamp without time zone,
1265 created_at timestamp without time zone,
1266 updated_at timestamp without time zone,
1267 allow_read_prefs boolean DEFAULT false NOT NULL,
1268 allow_write_prefs boolean DEFAULT false NOT NULL,
1269 allow_write_diary boolean DEFAULT false NOT NULL,
1270 allow_write_api boolean DEFAULT false NOT NULL,
1271 allow_read_gpx boolean DEFAULT false NOT NULL,
1272 allow_write_gpx boolean DEFAULT false NOT NULL,
1273 callback_url character varying,
1274 verifier character varying(20),
1275 scope character varying,
1276 valid_to timestamp without time zone,
1277 allow_write_notes boolean DEFAULT false NOT NULL
1282 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1285 CREATE SEQUENCE public.oauth_tokens_id_seq
1295 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1298 ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
1302 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1305 CREATE TABLE public.redactions (
1306 id integer NOT NULL,
1307 title character varying NOT NULL,
1308 description text NOT NULL,
1309 created_at timestamp without time zone,
1310 updated_at timestamp without time zone,
1311 user_id bigint NOT NULL,
1312 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1317 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1320 CREATE SEQUENCE public.redactions_id_seq
1330 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1333 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1337 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1340 CREATE TABLE public.relation_members (
1341 relation_id bigint NOT NULL,
1342 member_type public.nwr_enum NOT NULL,
1343 member_id bigint NOT NULL,
1344 member_role character varying NOT NULL,
1345 version bigint DEFAULT 0 NOT NULL,
1346 sequence_id integer DEFAULT 0 NOT NULL
1351 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1354 CREATE TABLE public.relation_tags (
1355 relation_id bigint NOT NULL,
1356 k character varying DEFAULT ''::character varying NOT NULL,
1357 v character varying DEFAULT ''::character varying NOT NULL,
1358 version bigint NOT NULL
1363 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1366 CREATE TABLE public.relations (
1367 relation_id bigint NOT NULL,
1368 changeset_id bigint NOT NULL,
1369 "timestamp" timestamp without time zone NOT NULL,
1370 version bigint NOT NULL,
1371 visible boolean DEFAULT true NOT NULL,
1372 redaction_id integer
1377 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1380 CREATE TABLE public.reports (
1381 id integer NOT NULL,
1382 issue_id integer NOT NULL,
1383 user_id integer NOT NULL,
1384 details text NOT NULL,
1385 category character varying NOT NULL,
1386 created_at timestamp without time zone NOT NULL,
1387 updated_at timestamp without time zone NOT NULL
1392 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1395 CREATE SEQUENCE public.reports_id_seq
1405 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1408 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1412 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1415 CREATE TABLE public.schema_migrations (
1416 version character varying NOT NULL
1421 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1424 CREATE TABLE public.user_blocks (
1425 id integer NOT NULL,
1426 user_id bigint NOT NULL,
1427 creator_id bigint NOT NULL,
1428 reason text NOT NULL,
1429 ends_at timestamp without time zone NOT NULL,
1430 needs_view boolean DEFAULT false NOT NULL,
1432 created_at timestamp without time zone,
1433 updated_at timestamp without time zone,
1434 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1439 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1442 CREATE SEQUENCE public.user_blocks_id_seq
1452 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1455 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1459 -- Name: user_mutes; Type: TABLE; Schema: public; Owner: -
1462 CREATE TABLE public.user_mutes (
1464 owner_id bigint NOT NULL,
1465 subject_id bigint NOT NULL,
1466 created_at timestamp(6) without time zone NOT NULL,
1467 updated_at timestamp(6) without time zone NOT NULL
1472 -- Name: user_mutes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1475 CREATE SEQUENCE public.user_mutes_id_seq
1484 -- Name: user_mutes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1487 ALTER SEQUENCE public.user_mutes_id_seq OWNED BY public.user_mutes.id;
1491 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1494 CREATE TABLE public.user_preferences (
1495 user_id bigint NOT NULL,
1496 k character varying NOT NULL,
1497 v character varying NOT NULL
1502 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1505 CREATE TABLE public.user_roles (
1506 id integer NOT NULL,
1507 user_id bigint NOT NULL,
1508 role public.user_role_enum NOT NULL,
1509 created_at timestamp without time zone,
1510 updated_at timestamp without time zone,
1511 granter_id bigint NOT NULL
1516 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1519 CREATE SEQUENCE public.user_roles_id_seq
1529 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1532 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1536 -- Name: users; Type: TABLE; Schema: public; Owner: -
1539 CREATE TABLE public.users (
1540 email character varying NOT NULL,
1542 pass_crypt character varying NOT NULL,
1543 creation_time timestamp without time zone NOT NULL,
1544 display_name character varying DEFAULT ''::character varying NOT NULL,
1545 data_public boolean DEFAULT false NOT NULL,
1546 description text DEFAULT ''::text NOT NULL,
1547 home_lat double precision,
1548 home_lon double precision,
1549 home_zoom smallint DEFAULT 3,
1550 pass_salt character varying,
1551 email_valid boolean DEFAULT false NOT NULL,
1552 new_email character varying,
1553 creation_ip character varying,
1554 languages character varying,
1555 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1556 terms_agreed timestamp without time zone,
1557 consider_pd boolean DEFAULT false NOT NULL,
1558 auth_uid character varying,
1559 preferred_editor character varying,
1560 terms_seen boolean DEFAULT false NOT NULL,
1561 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1562 changesets_count integer DEFAULT 0 NOT NULL,
1563 traces_count integer DEFAULT 0 NOT NULL,
1564 diary_entries_count integer DEFAULT 0 NOT NULL,
1565 image_use_gravatar boolean DEFAULT false NOT NULL,
1566 auth_provider character varying,
1568 tou_agreed timestamp without time zone,
1569 diary_comments_count integer DEFAULT 0,
1570 note_comments_count integer DEFAULT 0
1575 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1578 CREATE SEQUENCE public.users_id_seq
1587 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1590 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1594 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1597 CREATE TABLE public.way_nodes (
1598 way_id bigint NOT NULL,
1599 node_id bigint NOT NULL,
1600 version bigint NOT NULL,
1601 sequence_id bigint NOT NULL
1606 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1609 CREATE TABLE public.way_tags (
1610 way_id bigint NOT NULL,
1611 k character varying NOT NULL,
1612 v character varying NOT NULL,
1613 version bigint NOT NULL
1618 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1621 CREATE TABLE public.ways (
1622 way_id bigint NOT NULL,
1623 changeset_id bigint NOT NULL,
1624 "timestamp" timestamp without time zone NOT NULL,
1625 version bigint NOT NULL,
1626 visible boolean DEFAULT true NOT NULL,
1627 redaction_id integer
1632 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1635 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1639 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1642 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1646 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1649 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1653 -- Name: active_storage_variant_records id; Type: DEFAULT; Schema: public; Owner: -
1656 ALTER TABLE ONLY public.active_storage_variant_records ALTER COLUMN id SET DEFAULT nextval('public.active_storage_variant_records_id_seq'::regclass);
1660 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1663 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1667 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1670 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1674 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1677 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1681 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1684 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1688 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1691 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1695 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1698 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1702 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1705 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1709 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1712 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1716 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1719 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1723 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1726 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1730 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1733 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1737 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1740 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1744 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1747 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1751 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1754 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1758 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1761 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1765 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1768 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1772 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1775 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1779 -- Name: oauth_access_grants id; Type: DEFAULT; Schema: public; Owner: -
1782 ALTER TABLE ONLY public.oauth_access_grants ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_grants_id_seq'::regclass);
1786 -- Name: oauth_access_tokens id; Type: DEFAULT; Schema: public; Owner: -
1789 ALTER TABLE ONLY public.oauth_access_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_tokens_id_seq'::regclass);
1793 -- Name: oauth_applications id; Type: DEFAULT; Schema: public; Owner: -
1796 ALTER TABLE ONLY public.oauth_applications ALTER COLUMN id SET DEFAULT nextval('public.oauth_applications_id_seq'::regclass);
1800 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1803 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1807 -- Name: oauth_openid_requests id; Type: DEFAULT; Schema: public; Owner: -
1810 ALTER TABLE ONLY public.oauth_openid_requests ALTER COLUMN id SET DEFAULT nextval('public.oauth_openid_requests_id_seq'::regclass);
1814 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1817 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1821 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1824 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1828 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1831 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1835 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1838 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1842 -- Name: user_mutes id; Type: DEFAULT; Schema: public; Owner: -
1845 ALTER TABLE ONLY public.user_mutes ALTER COLUMN id SET DEFAULT nextval('public.user_mutes_id_seq'::regclass);
1849 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1852 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1856 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1859 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1863 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1866 ALTER TABLE ONLY public.acls
1867 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1871 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1874 ALTER TABLE ONLY public.active_storage_attachments
1875 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1879 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1882 ALTER TABLE ONLY public.active_storage_blobs
1883 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1887 -- Name: active_storage_variant_records active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1890 ALTER TABLE ONLY public.active_storage_variant_records
1891 ADD CONSTRAINT active_storage_variant_records_pkey PRIMARY KEY (id);
1895 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1898 ALTER TABLE ONLY public.ar_internal_metadata
1899 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1903 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1906 ALTER TABLE ONLY public.changeset_comments
1907 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1911 -- Name: changeset_tags changeset_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1914 ALTER TABLE ONLY public.changeset_tags
1915 ADD CONSTRAINT changeset_tags_pkey PRIMARY KEY (changeset_id, k);
1919 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1922 ALTER TABLE ONLY public.changesets
1923 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1927 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1930 ALTER TABLE ONLY public.client_applications
1931 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1935 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1938 ALTER TABLE ONLY public.current_node_tags
1939 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1943 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1946 ALTER TABLE ONLY public.current_nodes
1947 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1951 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1954 ALTER TABLE ONLY public.current_relation_members
1955 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, sequence_id);
1959 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1962 ALTER TABLE ONLY public.current_relation_tags
1963 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1967 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1970 ALTER TABLE ONLY public.current_relations
1971 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1975 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1978 ALTER TABLE ONLY public.current_way_nodes
1979 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1983 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1986 ALTER TABLE ONLY public.current_way_tags
1987 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1991 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1994 ALTER TABLE ONLY public.current_ways
1995 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1999 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2002 ALTER TABLE ONLY public.delayed_jobs
2003 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
2007 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2010 ALTER TABLE ONLY public.diary_comments
2011 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
2015 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2018 ALTER TABLE ONLY public.diary_entries
2019 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
2023 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2026 ALTER TABLE ONLY public.diary_entry_subscriptions
2027 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
2031 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2034 ALTER TABLE ONLY public.friends
2035 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
2039 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2042 ALTER TABLE ONLY public.gpx_file_tags
2043 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
2047 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2050 ALTER TABLE ONLY public.gpx_files
2051 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
2055 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2058 ALTER TABLE ONLY public.issue_comments
2059 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
2063 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2066 ALTER TABLE ONLY public.issues
2067 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
2071 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2074 ALTER TABLE ONLY public.languages
2075 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
2079 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2082 ALTER TABLE ONLY public.messages
2083 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
2087 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2090 ALTER TABLE ONLY public.node_tags
2091 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
2095 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2098 ALTER TABLE ONLY public.nodes
2099 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
2103 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2106 ALTER TABLE ONLY public.note_comments
2107 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
2111 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2114 ALTER TABLE ONLY public.notes
2115 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
2119 -- Name: oauth_access_grants oauth_access_grants_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2122 ALTER TABLE ONLY public.oauth_access_grants
2123 ADD CONSTRAINT oauth_access_grants_pkey PRIMARY KEY (id);
2127 -- Name: oauth_access_tokens oauth_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2130 ALTER TABLE ONLY public.oauth_access_tokens
2131 ADD CONSTRAINT oauth_access_tokens_pkey PRIMARY KEY (id);
2135 -- Name: oauth_applications oauth_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2138 ALTER TABLE ONLY public.oauth_applications
2139 ADD CONSTRAINT oauth_applications_pkey PRIMARY KEY (id);
2143 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2146 ALTER TABLE ONLY public.oauth_nonces
2147 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
2151 -- Name: oauth_openid_requests oauth_openid_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2154 ALTER TABLE ONLY public.oauth_openid_requests
2155 ADD CONSTRAINT oauth_openid_requests_pkey PRIMARY KEY (id);
2159 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2162 ALTER TABLE ONLY public.oauth_tokens
2163 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
2167 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2170 ALTER TABLE ONLY public.redactions
2171 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
2175 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2178 ALTER TABLE ONLY public.relation_members
2179 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, sequence_id);
2183 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2186 ALTER TABLE ONLY public.relation_tags
2187 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
2191 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2194 ALTER TABLE ONLY public.relations
2195 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
2199 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2202 ALTER TABLE ONLY public.reports
2203 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
2207 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2210 ALTER TABLE ONLY public.schema_migrations
2211 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
2215 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2218 ALTER TABLE ONLY public.user_blocks
2219 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
2223 -- Name: user_mutes user_mutes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2226 ALTER TABLE ONLY public.user_mutes
2227 ADD CONSTRAINT user_mutes_pkey PRIMARY KEY (id);
2231 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2234 ALTER TABLE ONLY public.user_preferences
2235 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
2239 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2242 ALTER TABLE ONLY public.user_roles
2243 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
2247 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2250 ALTER TABLE ONLY public.users
2251 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2255 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2258 ALTER TABLE ONLY public.way_nodes
2259 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2263 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2266 ALTER TABLE ONLY public.way_tags
2267 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2271 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2274 ALTER TABLE ONLY public.ways
2275 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2279 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2282 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2286 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2289 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2293 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2296 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2300 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2303 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2307 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2310 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2314 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2317 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2321 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2324 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2328 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2331 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2335 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2338 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2342 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2345 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2349 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2352 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2356 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2359 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2363 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2366 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2370 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2373 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2377 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2380 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2384 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2387 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2391 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2394 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2398 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2401 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2405 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2408 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2412 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2415 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2419 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2422 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2426 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2429 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2433 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2436 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2440 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2443 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2447 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2450 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2454 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2457 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2461 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2464 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2468 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2471 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2475 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2478 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2482 -- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
2485 CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest);
2489 -- Name: index_changeset_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2492 CREATE INDEX index_changeset_comments_on_author_id_and_created_at ON public.changeset_comments USING btree (author_id, created_at);
2496 -- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2499 CREATE INDEX index_changeset_comments_on_changeset_id_and_created_at ON public.changeset_comments USING btree (changeset_id, created_at);
2503 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2506 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2510 -- Name: index_changesets_on_user_id_and_closed_at; Type: INDEX; Schema: public; Owner: -
2513 CREATE INDEX index_changesets_on_user_id_and_closed_at ON public.changesets USING btree (user_id, closed_at);
2517 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2520 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2524 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2527 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2531 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2534 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2538 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2541 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2545 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2548 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2552 -- Name: index_friends_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2555 CREATE INDEX index_friends_on_user_id_and_created_at ON public.friends USING btree (user_id, created_at);
2559 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2562 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2566 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2569 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2573 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2576 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2580 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2583 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2587 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2590 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2594 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2597 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2601 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2604 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2608 -- Name: index_note_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2611 CREATE INDEX index_note_comments_on_author_id_and_created_at ON public.note_comments USING btree (author_id, created_at);
2615 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2618 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2622 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2625 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2629 -- Name: index_oauth_access_grants_on_application_id; Type: INDEX; Schema: public; Owner: -
2632 CREATE INDEX index_oauth_access_grants_on_application_id ON public.oauth_access_grants USING btree (application_id);
2636 -- Name: index_oauth_access_grants_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2639 CREATE INDEX index_oauth_access_grants_on_resource_owner_id ON public.oauth_access_grants USING btree (resource_owner_id);
2643 -- Name: index_oauth_access_grants_on_token; Type: INDEX; Schema: public; Owner: -
2646 CREATE UNIQUE INDEX index_oauth_access_grants_on_token ON public.oauth_access_grants USING btree (token);
2650 -- Name: index_oauth_access_tokens_on_application_id; Type: INDEX; Schema: public; Owner: -
2653 CREATE INDEX index_oauth_access_tokens_on_application_id ON public.oauth_access_tokens USING btree (application_id);
2657 -- Name: index_oauth_access_tokens_on_refresh_token; Type: INDEX; Schema: public; Owner: -
2660 CREATE UNIQUE INDEX index_oauth_access_tokens_on_refresh_token ON public.oauth_access_tokens USING btree (refresh_token);
2664 -- Name: index_oauth_access_tokens_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2667 CREATE INDEX index_oauth_access_tokens_on_resource_owner_id ON public.oauth_access_tokens USING btree (resource_owner_id);
2671 -- Name: index_oauth_access_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2674 CREATE UNIQUE INDEX index_oauth_access_tokens_on_token ON public.oauth_access_tokens USING btree (token);
2678 -- Name: index_oauth_applications_on_owner_type_and_owner_id; Type: INDEX; Schema: public; Owner: -
2681 CREATE INDEX index_oauth_applications_on_owner_type_and_owner_id ON public.oauth_applications USING btree (owner_type, owner_id);
2685 -- Name: index_oauth_applications_on_uid; Type: INDEX; Schema: public; Owner: -
2688 CREATE UNIQUE INDEX index_oauth_applications_on_uid ON public.oauth_applications USING btree (uid);
2692 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2695 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2699 -- Name: index_oauth_openid_requests_on_access_grant_id; Type: INDEX; Schema: public; Owner: -
2702 CREATE INDEX index_oauth_openid_requests_on_access_grant_id ON public.oauth_openid_requests USING btree (access_grant_id);
2706 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2709 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2713 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2716 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2720 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2723 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2727 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2730 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2734 -- Name: index_user_blocks_on_creator_id_and_id; Type: INDEX; Schema: public; Owner: -
2737 CREATE INDEX index_user_blocks_on_creator_id_and_id ON public.user_blocks USING btree (creator_id, id);
2741 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2744 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2748 -- Name: index_user_mutes_on_owner_id_and_subject_id; Type: INDEX; Schema: public; Owner: -
2751 CREATE UNIQUE INDEX index_user_mutes_on_owner_id_and_subject_id ON public.user_mutes USING btree (owner_id, subject_id);
2755 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2758 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2762 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2765 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2769 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2772 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2776 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2779 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2783 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2786 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2790 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2793 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2797 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2800 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2804 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2807 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2811 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2814 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2818 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2821 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2825 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2828 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2832 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2835 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2839 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2842 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2846 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2849 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2853 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2856 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2860 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2863 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2867 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2870 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2874 -- Name: users_display_name_canonical_idx; Type: INDEX; Schema: public; Owner: -
2877 CREATE INDEX users_display_name_canonical_idx ON public.users USING btree (lower(NORMALIZE(display_name, NFKC)));
2881 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2884 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2888 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2891 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2895 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2898 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2902 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2905 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2909 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2912 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2916 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2919 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2923 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2926 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2930 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2933 ALTER TABLE ONLY public.changeset_comments
2934 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2938 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2941 ALTER TABLE ONLY public.changeset_comments
2942 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2946 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2949 ALTER TABLE ONLY public.changeset_tags
2950 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2954 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2957 ALTER TABLE ONLY public.changesets_subscribers
2958 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2962 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2965 ALTER TABLE ONLY public.changesets_subscribers
2966 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2970 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2973 ALTER TABLE ONLY public.changesets
2974 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2978 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2981 ALTER TABLE ONLY public.client_applications
2982 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2986 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2989 ALTER TABLE ONLY public.current_node_tags
2990 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2994 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2997 ALTER TABLE ONLY public.current_nodes
2998 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3002 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3005 ALTER TABLE ONLY public.current_relation_members
3006 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
3010 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3013 ALTER TABLE ONLY public.current_relation_tags
3014 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
3018 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3021 ALTER TABLE ONLY public.current_relations
3022 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3026 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3029 ALTER TABLE ONLY public.current_way_nodes
3030 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
3034 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3037 ALTER TABLE ONLY public.current_way_nodes
3038 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
3042 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3045 ALTER TABLE ONLY public.current_way_tags
3046 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
3050 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3053 ALTER TABLE ONLY public.current_ways
3054 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3058 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3061 ALTER TABLE ONLY public.diary_comments
3062 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
3066 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3069 ALTER TABLE ONLY public.diary_comments
3070 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3074 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3077 ALTER TABLE ONLY public.diary_entries
3078 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
3082 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3085 ALTER TABLE ONLY public.diary_entries
3086 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3090 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3093 ALTER TABLE ONLY public.diary_entry_subscriptions
3094 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
3098 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3101 ALTER TABLE ONLY public.diary_entry_subscriptions
3102 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3106 -- Name: oauth_access_grants fk_rails_330c32d8d9; Type: FK CONSTRAINT; Schema: public; Owner: -
3109 ALTER TABLE ONLY public.oauth_access_grants
3110 ADD CONSTRAINT fk_rails_330c32d8d9 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3114 -- Name: user_mutes fk_rails_591dad3359; Type: FK CONSTRAINT; Schema: public; Owner: -
3117 ALTER TABLE ONLY public.user_mutes
3118 ADD CONSTRAINT fk_rails_591dad3359 FOREIGN KEY (owner_id) REFERENCES public.users(id);
3122 -- Name: oauth_access_tokens fk_rails_732cb83ab7; Type: FK CONSTRAINT; Schema: public; Owner: -
3125 ALTER TABLE ONLY public.oauth_access_tokens
3126 ADD CONSTRAINT fk_rails_732cb83ab7 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3130 -- Name: oauth_openid_requests fk_rails_77114b3b09; Type: FK CONSTRAINT; Schema: public; Owner: -
3133 ALTER TABLE ONLY public.oauth_openid_requests
3134 ADD CONSTRAINT fk_rails_77114b3b09 FOREIGN KEY (access_grant_id) REFERENCES public.oauth_access_grants(id) ON DELETE CASCADE;
3138 -- Name: active_storage_variant_records fk_rails_993965df05; Type: FK CONSTRAINT; Schema: public; Owner: -
3141 ALTER TABLE ONLY public.active_storage_variant_records
3142 ADD CONSTRAINT fk_rails_993965df05 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3146 -- Name: oauth_access_grants fk_rails_b4b53e07b8; Type: FK CONSTRAINT; Schema: public; Owner: -
3149 ALTER TABLE ONLY public.oauth_access_grants
3150 ADD CONSTRAINT fk_rails_b4b53e07b8 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3154 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
3157 ALTER TABLE ONLY public.active_storage_attachments
3158 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3162 -- Name: oauth_applications fk_rails_cc886e315a; Type: FK CONSTRAINT; Schema: public; Owner: -
3165 ALTER TABLE ONLY public.oauth_applications
3166 ADD CONSTRAINT fk_rails_cc886e315a FOREIGN KEY (owner_id) REFERENCES public.users(id) NOT VALID;
3170 -- Name: user_mutes fk_rails_e9dd4fb6c3; Type: FK CONSTRAINT; Schema: public; Owner: -
3173 ALTER TABLE ONLY public.user_mutes
3174 ADD CONSTRAINT fk_rails_e9dd4fb6c3 FOREIGN KEY (subject_id) REFERENCES public.users(id);
3178 -- Name: oauth_access_tokens fk_rails_ee63f25419; Type: FK CONSTRAINT; Schema: public; Owner: -
3181 ALTER TABLE ONLY public.oauth_access_tokens
3182 ADD CONSTRAINT fk_rails_ee63f25419 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3186 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3189 ALTER TABLE ONLY public.friends
3190 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
3194 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3197 ALTER TABLE ONLY public.friends
3198 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3202 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3205 ALTER TABLE ONLY public.gps_points
3206 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3210 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3213 ALTER TABLE ONLY public.gpx_file_tags
3214 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3218 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3221 ALTER TABLE ONLY public.gpx_files
3222 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3226 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3229 ALTER TABLE ONLY public.issue_comments
3230 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3234 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3237 ALTER TABLE ONLY public.issue_comments
3238 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3242 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3245 ALTER TABLE ONLY public.issues
3246 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
3250 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3253 ALTER TABLE ONLY public.issues
3254 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
3258 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3261 ALTER TABLE ONLY public.issues
3262 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
3266 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3269 ALTER TABLE ONLY public.messages
3270 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
3274 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3277 ALTER TABLE ONLY public.messages
3278 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
3282 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3285 ALTER TABLE ONLY public.node_tags
3286 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
3290 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3293 ALTER TABLE ONLY public.nodes
3294 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3298 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3301 ALTER TABLE ONLY public.nodes
3302 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3306 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3309 ALTER TABLE ONLY public.note_comments
3310 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
3314 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3317 ALTER TABLE ONLY public.note_comments
3318 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
3322 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3325 ALTER TABLE ONLY public.oauth_tokens
3326 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
3330 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3333 ALTER TABLE ONLY public.oauth_tokens
3334 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3338 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3341 ALTER TABLE ONLY public.redactions
3342 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3346 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3349 ALTER TABLE ONLY public.relation_members
3350 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3354 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3357 ALTER TABLE ONLY public.relation_tags
3358 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3362 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3365 ALTER TABLE ONLY public.relations
3366 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3370 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3373 ALTER TABLE ONLY public.relations
3374 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3378 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3381 ALTER TABLE ONLY public.reports
3382 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3386 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3389 ALTER TABLE ONLY public.reports
3390 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3394 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3397 ALTER TABLE ONLY public.user_blocks
3398 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
3402 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3405 ALTER TABLE ONLY public.user_blocks
3406 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
3410 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3413 ALTER TABLE ONLY public.user_blocks
3414 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3418 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3421 ALTER TABLE ONLY public.user_preferences
3422 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3426 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3429 ALTER TABLE ONLY public.user_roles
3430 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3434 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3437 ALTER TABLE ONLY public.user_roles
3438 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3442 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3445 ALTER TABLE ONLY public.way_nodes
3446 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3450 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3453 ALTER TABLE ONLY public.way_tags
3454 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3458 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3461 ALTER TABLE ONLY public.ways
3462 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3466 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3469 ALTER TABLE ONLY public.ways
3470 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3474 -- PostgreSQL database dump complete
3477 SET search_path TO "$user", public;
3479 INSERT INTO "schema_migrations" (version) VALUES