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 (
106 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
109 CREATE TYPE public.user_status_enum AS ENUM (
119 -- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
122 CREATE FUNCTION public.tile_for_point(scaled_lat integer, scaled_lon integer) RETURNS bigint
123 LANGUAGE plpgsql IMMUTABLE
126 x int8; -- quantized x from lon,
127 y int8; -- quantized y from lat,
129 x := round(((scaled_lon / 10000000.0) + 180.0) * 65535.0 / 360.0);
130 y := round(((scaled_lat / 10000000.0) + 90.0) * 65535.0 / 180.0);
132 -- these bit-masks are special numbers used in the bit interleaving algorithm.
133 -- see https://graphics.stanford.edu/~seander/bithacks.html#InterleaveBMN
134 -- for the original algorithm and more details.
135 x := (x | (x << 8)) & 16711935; -- 0x00FF00FF
136 x := (x | (x << 4)) & 252645135; -- 0x0F0F0F0F
137 x := (x | (x << 2)) & 858993459; -- 0x33333333
138 x := (x | (x << 1)) & 1431655765; -- 0x55555555
140 y := (y | (y << 8)) & 16711935; -- 0x00FF00FF
141 y := (y | (y << 4)) & 252645135; -- 0x0F0F0F0F
142 y := (y | (y << 2)) & 858993459; -- 0x33333333
143 y := (y | (y << 1)) & 1431655765; -- 0x55555555
151 -- Name: acls; Type: TABLE; Schema: public; Owner: -
154 CREATE TABLE public.acls (
157 k character varying NOT NULL,
159 domain character varying,
165 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
168 CREATE SEQUENCE public.acls_id_seq
177 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
180 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
184 -- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
187 CREATE TABLE public.active_storage_attachments (
189 name character varying NOT NULL,
190 record_type character varying NOT NULL,
191 record_id bigint NOT NULL,
192 blob_id bigint NOT NULL,
193 created_at timestamp without time zone NOT NULL
198 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
201 CREATE SEQUENCE public.active_storage_attachments_id_seq
210 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
213 ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
217 -- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
220 CREATE TABLE public.active_storage_blobs (
222 key character varying NOT NULL,
223 filename character varying NOT NULL,
224 content_type character varying,
226 byte_size bigint NOT NULL,
227 checksum character varying NOT NULL,
228 created_at timestamp without time zone NOT NULL,
229 service_name character varying NOT NULL
234 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
237 CREATE SEQUENCE public.active_storage_blobs_id_seq
246 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
249 ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
253 -- Name: active_storage_variant_records; Type: TABLE; Schema: public; Owner: -
256 CREATE TABLE public.active_storage_variant_records (
258 blob_id bigint NOT NULL,
259 variation_digest character varying NOT NULL
264 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE; Schema: public; Owner: -
267 CREATE SEQUENCE public.active_storage_variant_records_id_seq
276 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
279 ALTER SEQUENCE public.active_storage_variant_records_id_seq OWNED BY public.active_storage_variant_records.id;
283 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
286 CREATE TABLE public.ar_internal_metadata (
287 key character varying NOT NULL,
288 value character varying,
289 created_at timestamp(6) without time zone NOT NULL,
290 updated_at timestamp(6) without time zone NOT NULL
295 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
298 CREATE TABLE public.changeset_comments (
300 changeset_id bigint NOT NULL,
301 author_id bigint NOT NULL,
303 created_at timestamp without time zone NOT NULL,
304 visible boolean NOT NULL
309 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
312 CREATE SEQUENCE public.changeset_comments_id_seq
322 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
325 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
329 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
332 CREATE TABLE public.changeset_tags (
333 changeset_id bigint NOT NULL,
334 k character varying DEFAULT ''::character varying NOT NULL,
335 v character varying DEFAULT ''::character varying NOT NULL
340 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
343 CREATE TABLE public.changesets (
345 user_id bigint NOT NULL,
346 created_at timestamp without time zone NOT NULL,
351 closed_at timestamp without time zone NOT NULL,
352 num_changes integer DEFAULT 0 NOT NULL
357 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
360 CREATE SEQUENCE public.changesets_id_seq
369 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
372 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
376 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
379 CREATE TABLE public.changesets_subscribers (
380 subscriber_id bigint NOT NULL,
381 changeset_id bigint NOT NULL
386 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
389 CREATE TABLE public.client_applications (
391 name character varying,
392 url character varying,
393 support_url character varying,
394 callback_url character varying,
395 key character varying(50),
396 secret character varying(50),
398 created_at timestamp without time zone,
399 updated_at timestamp without time zone,
400 allow_read_prefs boolean DEFAULT false NOT NULL,
401 allow_write_prefs boolean DEFAULT false NOT NULL,
402 allow_write_diary boolean DEFAULT false NOT NULL,
403 allow_write_api boolean DEFAULT false NOT NULL,
404 allow_read_gpx boolean DEFAULT false NOT NULL,
405 allow_write_gpx boolean DEFAULT false NOT NULL,
406 allow_write_notes boolean DEFAULT false NOT NULL
411 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
414 CREATE SEQUENCE public.client_applications_id_seq
424 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
427 ALTER SEQUENCE public.client_applications_id_seq OWNED BY public.client_applications.id;
431 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
434 CREATE TABLE public.current_node_tags (
435 node_id bigint NOT NULL,
436 k character varying DEFAULT ''::character varying NOT NULL,
437 v character varying DEFAULT ''::character varying NOT NULL
442 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
445 CREATE TABLE public.current_nodes (
447 latitude integer NOT NULL,
448 longitude integer NOT NULL,
449 changeset_id bigint NOT NULL,
450 visible boolean NOT NULL,
451 "timestamp" timestamp without time zone NOT NULL,
452 tile bigint NOT NULL,
453 version bigint NOT NULL
458 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
461 CREATE SEQUENCE public.current_nodes_id_seq
470 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
473 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
477 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
480 CREATE TABLE public.current_relation_members (
481 relation_id bigint NOT NULL,
482 member_type public.nwr_enum NOT NULL,
483 member_id bigint NOT NULL,
484 member_role character varying NOT NULL,
485 sequence_id integer DEFAULT 0 NOT NULL
490 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
493 CREATE TABLE public.current_relation_tags (
494 relation_id bigint NOT NULL,
495 k character varying DEFAULT ''::character varying NOT NULL,
496 v character varying DEFAULT ''::character varying NOT NULL
501 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
504 CREATE TABLE public.current_relations (
506 changeset_id bigint NOT NULL,
507 "timestamp" timestamp without time zone NOT NULL,
508 visible boolean NOT NULL,
509 version bigint NOT NULL
514 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
517 CREATE SEQUENCE public.current_relations_id_seq
526 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
529 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
533 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
536 CREATE TABLE public.current_way_nodes (
537 way_id bigint NOT NULL,
538 node_id bigint NOT NULL,
539 sequence_id bigint NOT NULL
544 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
547 CREATE TABLE public.current_way_tags (
548 way_id bigint NOT NULL,
549 k character varying DEFAULT ''::character varying NOT NULL,
550 v character varying DEFAULT ''::character varying NOT NULL
555 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
558 CREATE TABLE public.current_ways (
560 changeset_id bigint NOT NULL,
561 "timestamp" timestamp without time zone NOT NULL,
562 visible boolean NOT NULL,
563 version bigint NOT NULL
568 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
571 CREATE SEQUENCE public.current_ways_id_seq
580 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
583 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
587 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
590 CREATE TABLE public.delayed_jobs (
592 priority integer DEFAULT 0 NOT NULL,
593 attempts integer DEFAULT 0 NOT NULL,
594 handler text NOT NULL,
596 run_at timestamp without time zone,
597 locked_at timestamp without time zone,
598 failed_at timestamp without time zone,
599 locked_by character varying,
600 queue character varying,
601 created_at timestamp without time zone,
602 updated_at timestamp without time zone
607 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
610 CREATE SEQUENCE public.delayed_jobs_id_seq
619 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
622 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
626 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
629 CREATE TABLE public.diary_comments (
631 diary_entry_id bigint NOT NULL,
632 user_id bigint NOT NULL,
634 created_at timestamp without time zone NOT NULL,
635 updated_at timestamp without time zone NOT NULL,
636 visible boolean DEFAULT true NOT NULL,
637 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
642 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
645 CREATE SEQUENCE public.diary_comments_id_seq
654 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
657 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
661 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
664 CREATE TABLE public.diary_entries (
666 user_id bigint NOT NULL,
667 title character varying NOT NULL,
669 created_at timestamp without time zone NOT NULL,
670 updated_at timestamp without time zone NOT NULL,
671 latitude double precision,
672 longitude double precision,
673 language_code character varying DEFAULT 'en'::character varying NOT NULL,
674 visible boolean DEFAULT true NOT NULL,
675 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
680 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
683 CREATE SEQUENCE public.diary_entries_id_seq
692 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
695 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
699 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
702 CREATE TABLE public.diary_entry_subscriptions (
703 user_id bigint NOT NULL,
704 diary_entry_id bigint NOT NULL
709 -- Name: friends; Type: TABLE; Schema: public; Owner: -
712 CREATE TABLE public.friends (
714 user_id bigint NOT NULL,
715 friend_user_id bigint NOT NULL,
716 created_at timestamp without time zone
721 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
724 CREATE SEQUENCE public.friends_id_seq
733 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
736 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
740 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
743 CREATE TABLE public.gps_points (
744 altitude double precision,
745 trackid integer NOT NULL,
746 latitude integer NOT NULL,
747 longitude integer NOT NULL,
748 gpx_id bigint NOT NULL,
749 "timestamp" timestamp without time zone,
755 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
758 CREATE TABLE public.gpx_file_tags (
759 gpx_id bigint DEFAULT 0 NOT NULL,
760 tag character varying NOT NULL,
766 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
769 CREATE SEQUENCE public.gpx_file_tags_id_seq
778 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
781 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
785 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
788 CREATE TABLE public.gpx_files (
790 user_id bigint NOT NULL,
791 visible boolean DEFAULT true NOT NULL,
792 name character varying DEFAULT ''::character varying NOT NULL,
794 latitude double precision,
795 longitude double precision,
796 "timestamp" timestamp without time zone NOT NULL,
797 description character varying DEFAULT ''::character varying NOT NULL,
798 inserted boolean NOT NULL,
799 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
804 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
807 CREATE SEQUENCE public.gpx_files_id_seq
816 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
819 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
823 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
826 CREATE TABLE public.issue_comments (
828 issue_id integer NOT NULL,
829 user_id integer NOT NULL,
831 created_at timestamp without time zone NOT NULL,
832 updated_at timestamp without time zone NOT NULL
837 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
840 CREATE SEQUENCE public.issue_comments_id_seq
850 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
853 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
857 -- Name: issues; Type: TABLE; Schema: public; Owner: -
860 CREATE TABLE public.issues (
862 reportable_type character varying NOT NULL,
863 reportable_id integer NOT NULL,
864 reported_user_id integer,
865 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
866 assigned_role public.user_role_enum NOT NULL,
867 resolved_at timestamp without time zone,
870 reports_count integer DEFAULT 0,
871 created_at timestamp without time zone NOT NULL,
872 updated_at timestamp without time zone NOT NULL
877 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
880 CREATE SEQUENCE public.issues_id_seq
890 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
893 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
897 -- Name: languages; Type: TABLE; Schema: public; Owner: -
900 CREATE TABLE public.languages (
901 code character varying NOT NULL,
902 english_name character varying NOT NULL,
903 native_name character varying
908 -- Name: messages; Type: TABLE; Schema: public; Owner: -
911 CREATE TABLE public.messages (
913 from_user_id bigint NOT NULL,
914 title character varying NOT NULL,
916 sent_on timestamp without time zone NOT NULL,
917 message_read boolean DEFAULT false NOT NULL,
918 to_user_id bigint NOT NULL,
919 to_user_visible boolean DEFAULT true NOT NULL,
920 from_user_visible boolean DEFAULT true NOT NULL,
921 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
926 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
929 CREATE SEQUENCE public.messages_id_seq
938 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
941 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
945 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
948 CREATE TABLE public.node_tags (
949 node_id bigint NOT NULL,
950 version bigint NOT NULL,
951 k character varying DEFAULT ''::character varying NOT NULL,
952 v character varying DEFAULT ''::character varying NOT NULL
957 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
960 CREATE TABLE public.nodes (
961 node_id bigint NOT NULL,
962 latitude integer NOT NULL,
963 longitude integer NOT NULL,
964 changeset_id bigint NOT NULL,
965 visible boolean NOT NULL,
966 "timestamp" timestamp without time zone NOT NULL,
967 tile bigint NOT NULL,
968 version bigint NOT NULL,
974 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
977 CREATE TABLE public.note_comments (
979 note_id bigint NOT NULL,
980 visible boolean NOT NULL,
981 created_at timestamp without time zone NOT NULL,
985 event public.note_event_enum
990 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
993 CREATE SEQUENCE public.note_comments_id_seq
1003 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1006 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
1010 -- Name: notes; Type: TABLE; Schema: public; Owner: -
1013 CREATE TABLE public.notes (
1015 latitude integer NOT NULL,
1016 longitude integer NOT NULL,
1017 tile bigint NOT NULL,
1018 updated_at timestamp without time zone NOT NULL,
1019 created_at timestamp without time zone NOT NULL,
1020 status public.note_status_enum NOT NULL,
1021 closed_at timestamp without time zone
1026 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1029 CREATE SEQUENCE public.notes_id_seq
1039 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1042 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
1046 -- Name: oauth_access_grants; Type: TABLE; Schema: public; Owner: -
1049 CREATE TABLE public.oauth_access_grants (
1051 resource_owner_id bigint NOT NULL,
1052 application_id bigint NOT NULL,
1053 token character varying NOT NULL,
1054 expires_in integer NOT NULL,
1055 redirect_uri text NOT NULL,
1056 created_at timestamp without time zone NOT NULL,
1057 revoked_at timestamp without time zone,
1058 scopes character varying DEFAULT ''::character varying NOT NULL,
1059 code_challenge character varying,
1060 code_challenge_method character varying
1065 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1068 CREATE SEQUENCE public.oauth_access_grants_id_seq
1077 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1080 ALTER SEQUENCE public.oauth_access_grants_id_seq OWNED BY public.oauth_access_grants.id;
1084 -- Name: oauth_access_tokens; Type: TABLE; Schema: public; Owner: -
1087 CREATE TABLE public.oauth_access_tokens (
1089 resource_owner_id bigint,
1090 application_id bigint NOT NULL,
1091 token character varying NOT NULL,
1092 refresh_token character varying,
1094 revoked_at timestamp without time zone,
1095 created_at timestamp without time zone NOT NULL,
1096 scopes character varying,
1097 previous_refresh_token character varying DEFAULT ''::character varying NOT NULL
1102 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1105 CREATE SEQUENCE public.oauth_access_tokens_id_seq
1114 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1117 ALTER SEQUENCE public.oauth_access_tokens_id_seq OWNED BY public.oauth_access_tokens.id;
1121 -- Name: oauth_applications; Type: TABLE; Schema: public; Owner: -
1124 CREATE TABLE public.oauth_applications (
1126 owner_type character varying NOT NULL,
1127 owner_id bigint NOT NULL,
1128 name character varying NOT NULL,
1129 uid character varying NOT NULL,
1130 secret character varying NOT NULL,
1131 redirect_uri text NOT NULL,
1132 scopes character varying DEFAULT ''::character varying NOT NULL,
1133 confidential boolean DEFAULT true NOT NULL,
1134 created_at timestamp(6) without time zone NOT NULL,
1135 updated_at timestamp(6) without time zone NOT NULL
1140 -- Name: oauth_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1143 CREATE SEQUENCE public.oauth_applications_id_seq
1152 -- Name: oauth_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1155 ALTER SEQUENCE public.oauth_applications_id_seq OWNED BY public.oauth_applications.id;
1159 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
1162 CREATE TABLE public.oauth_nonces (
1164 nonce character varying,
1165 "timestamp" integer,
1166 created_at timestamp without time zone,
1167 updated_at timestamp without time zone
1172 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1175 CREATE SEQUENCE public.oauth_nonces_id_seq
1185 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1188 ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id;
1192 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
1195 CREATE TABLE public.oauth_tokens (
1196 id integer NOT NULL,
1198 type character varying(20),
1199 client_application_id integer,
1200 token character varying(50),
1201 secret character varying(50),
1202 authorized_at timestamp without time zone,
1203 invalidated_at timestamp without time zone,
1204 created_at timestamp without time zone,
1205 updated_at timestamp without time zone,
1206 allow_read_prefs boolean DEFAULT false NOT NULL,
1207 allow_write_prefs boolean DEFAULT false NOT NULL,
1208 allow_write_diary boolean DEFAULT false NOT NULL,
1209 allow_write_api boolean DEFAULT false NOT NULL,
1210 allow_read_gpx boolean DEFAULT false NOT NULL,
1211 allow_write_gpx boolean DEFAULT false NOT NULL,
1212 callback_url character varying,
1213 verifier character varying(20),
1214 scope character varying,
1215 valid_to timestamp without time zone,
1216 allow_write_notes boolean DEFAULT false NOT NULL
1221 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1224 CREATE SEQUENCE public.oauth_tokens_id_seq
1234 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1237 ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
1241 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1244 CREATE TABLE public.redactions (
1245 id integer NOT NULL,
1246 title character varying,
1248 created_at timestamp without time zone,
1249 updated_at timestamp without time zone,
1250 user_id bigint NOT NULL,
1251 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1256 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1259 CREATE SEQUENCE public.redactions_id_seq
1269 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1272 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1276 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1279 CREATE TABLE public.relation_members (
1280 relation_id bigint DEFAULT 0 NOT NULL,
1281 member_type public.nwr_enum NOT NULL,
1282 member_id bigint NOT NULL,
1283 member_role character varying NOT NULL,
1284 version bigint DEFAULT 0 NOT NULL,
1285 sequence_id integer DEFAULT 0 NOT NULL
1290 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1293 CREATE TABLE public.relation_tags (
1294 relation_id bigint DEFAULT 0 NOT NULL,
1295 k character varying DEFAULT ''::character varying NOT NULL,
1296 v character varying DEFAULT ''::character varying NOT NULL,
1297 version bigint NOT NULL
1302 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1305 CREATE TABLE public.relations (
1306 relation_id bigint DEFAULT 0 NOT NULL,
1307 changeset_id bigint NOT NULL,
1308 "timestamp" timestamp without time zone NOT NULL,
1309 version bigint NOT NULL,
1310 visible boolean DEFAULT true NOT NULL,
1311 redaction_id integer
1316 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1319 CREATE TABLE public.reports (
1320 id integer NOT NULL,
1321 issue_id integer NOT NULL,
1322 user_id integer NOT NULL,
1323 details text NOT NULL,
1324 category character varying NOT NULL,
1325 created_at timestamp without time zone NOT NULL,
1326 updated_at timestamp without time zone NOT NULL
1331 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1334 CREATE SEQUENCE public.reports_id_seq
1344 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1347 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1351 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1354 CREATE TABLE public.schema_migrations (
1355 version character varying NOT NULL
1360 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1363 CREATE TABLE public.user_blocks (
1364 id integer NOT NULL,
1365 user_id bigint NOT NULL,
1366 creator_id bigint NOT NULL,
1367 reason text NOT NULL,
1368 ends_at timestamp without time zone NOT NULL,
1369 needs_view boolean DEFAULT false NOT NULL,
1371 created_at timestamp without time zone,
1372 updated_at timestamp without time zone,
1373 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1378 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1381 CREATE SEQUENCE public.user_blocks_id_seq
1391 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1394 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1398 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1401 CREATE TABLE public.user_preferences (
1402 user_id bigint NOT NULL,
1403 k character varying NOT NULL,
1404 v character varying NOT NULL
1409 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1412 CREATE TABLE public.user_roles (
1413 id integer NOT NULL,
1414 user_id bigint NOT NULL,
1415 role public.user_role_enum NOT NULL,
1416 created_at timestamp without time zone,
1417 updated_at timestamp without time zone,
1418 granter_id bigint NOT NULL
1423 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1426 CREATE SEQUENCE public.user_roles_id_seq
1436 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1439 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1443 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1446 CREATE TABLE public.user_tokens (
1448 user_id bigint NOT NULL,
1449 token character varying NOT NULL,
1450 expiry timestamp without time zone NOT NULL,
1456 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1459 CREATE SEQUENCE public.user_tokens_id_seq
1468 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1471 ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id;
1475 -- Name: users; Type: TABLE; Schema: public; Owner: -
1478 CREATE TABLE public.users (
1479 email character varying NOT NULL,
1481 pass_crypt character varying NOT NULL,
1482 creation_time timestamp without time zone NOT NULL,
1483 display_name character varying DEFAULT ''::character varying NOT NULL,
1484 data_public boolean DEFAULT false NOT NULL,
1485 description text DEFAULT ''::text NOT NULL,
1486 home_lat double precision,
1487 home_lon double precision,
1488 home_zoom smallint DEFAULT 3,
1489 pass_salt character varying,
1490 email_valid boolean DEFAULT false NOT NULL,
1491 new_email character varying,
1492 creation_ip character varying,
1493 languages character varying,
1494 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1495 terms_agreed timestamp without time zone,
1496 consider_pd boolean DEFAULT false NOT NULL,
1497 auth_uid character varying,
1498 preferred_editor character varying,
1499 terms_seen boolean DEFAULT false NOT NULL,
1500 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1501 changesets_count integer DEFAULT 0 NOT NULL,
1502 traces_count integer DEFAULT 0 NOT NULL,
1503 diary_entries_count integer DEFAULT 0 NOT NULL,
1504 image_use_gravatar boolean DEFAULT false NOT NULL,
1505 auth_provider character varying,
1507 tou_agreed timestamp without time zone
1512 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1515 CREATE SEQUENCE public.users_id_seq
1524 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1527 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1531 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1534 CREATE TABLE public.way_nodes (
1535 way_id bigint NOT NULL,
1536 node_id bigint NOT NULL,
1537 version bigint NOT NULL,
1538 sequence_id bigint NOT NULL
1543 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1546 CREATE TABLE public.way_tags (
1547 way_id bigint DEFAULT 0 NOT NULL,
1548 k character varying NOT NULL,
1549 v character varying NOT NULL,
1550 version bigint NOT NULL
1555 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1558 CREATE TABLE public.ways (
1559 way_id bigint DEFAULT 0 NOT NULL,
1560 changeset_id bigint NOT NULL,
1561 "timestamp" timestamp without time zone NOT NULL,
1562 version bigint NOT NULL,
1563 visible boolean DEFAULT true NOT NULL,
1564 redaction_id integer
1569 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1572 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1576 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1579 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1583 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1586 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1590 -- Name: active_storage_variant_records id; Type: DEFAULT; Schema: public; Owner: -
1593 ALTER TABLE ONLY public.active_storage_variant_records ALTER COLUMN id SET DEFAULT nextval('public.active_storage_variant_records_id_seq'::regclass);
1597 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1600 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1604 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1607 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1611 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1614 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1618 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1621 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1625 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1628 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1632 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1635 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1639 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1642 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1646 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1649 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1653 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1656 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1660 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1663 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1667 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1670 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1674 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1677 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1681 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1684 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1688 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1691 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1695 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1698 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1702 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1705 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1709 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1712 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1716 -- Name: oauth_access_grants id; Type: DEFAULT; Schema: public; Owner: -
1719 ALTER TABLE ONLY public.oauth_access_grants ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_grants_id_seq'::regclass);
1723 -- Name: oauth_access_tokens id; Type: DEFAULT; Schema: public; Owner: -
1726 ALTER TABLE ONLY public.oauth_access_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_tokens_id_seq'::regclass);
1730 -- Name: oauth_applications id; Type: DEFAULT; Schema: public; Owner: -
1733 ALTER TABLE ONLY public.oauth_applications ALTER COLUMN id SET DEFAULT nextval('public.oauth_applications_id_seq'::regclass);
1737 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1740 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1744 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1747 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1751 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1754 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1758 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1761 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1765 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1768 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1772 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1775 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1779 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1782 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1786 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1789 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1793 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1796 ALTER TABLE ONLY public.acls
1797 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1801 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1804 ALTER TABLE ONLY public.active_storage_attachments
1805 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1809 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1812 ALTER TABLE ONLY public.active_storage_blobs
1813 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1817 -- Name: active_storage_variant_records active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1820 ALTER TABLE ONLY public.active_storage_variant_records
1821 ADD CONSTRAINT active_storage_variant_records_pkey PRIMARY KEY (id);
1825 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1828 ALTER TABLE ONLY public.ar_internal_metadata
1829 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1833 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1836 ALTER TABLE ONLY public.changeset_comments
1837 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1841 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1844 ALTER TABLE ONLY public.changesets
1845 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1849 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1852 ALTER TABLE ONLY public.client_applications
1853 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1857 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1860 ALTER TABLE ONLY public.current_node_tags
1861 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1865 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1868 ALTER TABLE ONLY public.current_nodes
1869 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1873 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1876 ALTER TABLE ONLY public.current_relation_members
1877 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1881 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1884 ALTER TABLE ONLY public.current_relation_tags
1885 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1889 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1892 ALTER TABLE ONLY public.current_relations
1893 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1897 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1900 ALTER TABLE ONLY public.current_way_nodes
1901 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1905 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1908 ALTER TABLE ONLY public.current_way_tags
1909 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1913 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1916 ALTER TABLE ONLY public.current_ways
1917 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1921 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1924 ALTER TABLE ONLY public.delayed_jobs
1925 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1929 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1932 ALTER TABLE ONLY public.diary_comments
1933 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1937 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1940 ALTER TABLE ONLY public.diary_entries
1941 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1945 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1948 ALTER TABLE ONLY public.diary_entry_subscriptions
1949 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1953 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1956 ALTER TABLE ONLY public.friends
1957 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1961 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1964 ALTER TABLE ONLY public.gpx_file_tags
1965 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1969 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1972 ALTER TABLE ONLY public.gpx_files
1973 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1977 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1980 ALTER TABLE ONLY public.issue_comments
1981 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1985 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1988 ALTER TABLE ONLY public.issues
1989 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
1993 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1996 ALTER TABLE ONLY public.languages
1997 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
2001 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2004 ALTER TABLE ONLY public.messages
2005 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
2009 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2012 ALTER TABLE ONLY public.node_tags
2013 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
2017 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2020 ALTER TABLE ONLY public.nodes
2021 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
2025 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2028 ALTER TABLE ONLY public.note_comments
2029 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
2033 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2036 ALTER TABLE ONLY public.notes
2037 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
2041 -- Name: oauth_access_grants oauth_access_grants_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2044 ALTER TABLE ONLY public.oauth_access_grants
2045 ADD CONSTRAINT oauth_access_grants_pkey PRIMARY KEY (id);
2049 -- Name: oauth_access_tokens oauth_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2052 ALTER TABLE ONLY public.oauth_access_tokens
2053 ADD CONSTRAINT oauth_access_tokens_pkey PRIMARY KEY (id);
2057 -- Name: oauth_applications oauth_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2060 ALTER TABLE ONLY public.oauth_applications
2061 ADD CONSTRAINT oauth_applications_pkey PRIMARY KEY (id);
2065 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2068 ALTER TABLE ONLY public.oauth_nonces
2069 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
2073 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2076 ALTER TABLE ONLY public.oauth_tokens
2077 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
2081 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2084 ALTER TABLE ONLY public.redactions
2085 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
2089 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2092 ALTER TABLE ONLY public.relation_members
2093 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
2097 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2100 ALTER TABLE ONLY public.relation_tags
2101 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
2105 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2108 ALTER TABLE ONLY public.relations
2109 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
2113 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2116 ALTER TABLE ONLY public.reports
2117 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
2121 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2124 ALTER TABLE ONLY public.schema_migrations
2125 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
2129 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2132 ALTER TABLE ONLY public.user_blocks
2133 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
2137 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2140 ALTER TABLE ONLY public.user_preferences
2141 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
2145 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2148 ALTER TABLE ONLY public.user_roles
2149 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
2153 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2156 ALTER TABLE ONLY public.user_tokens
2157 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
2161 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2164 ALTER TABLE ONLY public.users
2165 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2169 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2172 ALTER TABLE ONLY public.way_nodes
2173 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2177 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2180 ALTER TABLE ONLY public.way_tags
2181 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2185 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2188 ALTER TABLE ONLY public.ways
2189 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2193 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2196 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2200 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
2203 CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id);
2207 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2210 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2214 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2217 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2221 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2224 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2228 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2231 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2235 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2238 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2242 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2245 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2249 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2252 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2256 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2259 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2263 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2266 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2270 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2273 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2277 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2280 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2284 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2287 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2291 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2294 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2298 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2301 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2305 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2308 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2312 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2315 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2319 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2322 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2326 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2329 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2333 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2336 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2340 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2343 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2347 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2350 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2354 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2357 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2361 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2364 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2368 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2371 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2375 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2378 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2382 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2385 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2389 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2392 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2396 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2399 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2403 -- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
2406 CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest);
2410 -- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2413 CREATE INDEX index_changeset_comments_on_changeset_id_and_created_at ON public.changeset_comments USING btree (changeset_id, created_at);
2417 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2420 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2424 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2427 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2431 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2434 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2438 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2441 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2445 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2448 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2452 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2455 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2459 -- Name: index_friends_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2462 CREATE INDEX index_friends_on_user_id_and_created_at ON public.friends USING btree (user_id, created_at);
2466 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2469 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2473 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2476 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2480 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2483 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2487 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2490 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2494 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2497 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2501 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2504 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2508 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2511 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2515 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2518 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2522 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2525 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2529 -- Name: index_oauth_access_grants_on_application_id; Type: INDEX; Schema: public; Owner: -
2532 CREATE INDEX index_oauth_access_grants_on_application_id ON public.oauth_access_grants USING btree (application_id);
2536 -- Name: index_oauth_access_grants_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2539 CREATE INDEX index_oauth_access_grants_on_resource_owner_id ON public.oauth_access_grants USING btree (resource_owner_id);
2543 -- Name: index_oauth_access_grants_on_token; Type: INDEX; Schema: public; Owner: -
2546 CREATE UNIQUE INDEX index_oauth_access_grants_on_token ON public.oauth_access_grants USING btree (token);
2550 -- Name: index_oauth_access_tokens_on_application_id; Type: INDEX; Schema: public; Owner: -
2553 CREATE INDEX index_oauth_access_tokens_on_application_id ON public.oauth_access_tokens USING btree (application_id);
2557 -- Name: index_oauth_access_tokens_on_refresh_token; Type: INDEX; Schema: public; Owner: -
2560 CREATE UNIQUE INDEX index_oauth_access_tokens_on_refresh_token ON public.oauth_access_tokens USING btree (refresh_token);
2564 -- Name: index_oauth_access_tokens_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2567 CREATE INDEX index_oauth_access_tokens_on_resource_owner_id ON public.oauth_access_tokens USING btree (resource_owner_id);
2571 -- Name: index_oauth_access_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2574 CREATE UNIQUE INDEX index_oauth_access_tokens_on_token ON public.oauth_access_tokens USING btree (token);
2578 -- Name: index_oauth_applications_on_owner_type_and_owner_id; Type: INDEX; Schema: public; Owner: -
2581 CREATE INDEX index_oauth_applications_on_owner_type_and_owner_id ON public.oauth_applications USING btree (owner_type, owner_id);
2585 -- Name: index_oauth_applications_on_uid; Type: INDEX; Schema: public; Owner: -
2588 CREATE UNIQUE INDEX index_oauth_applications_on_uid ON public.oauth_applications USING btree (uid);
2592 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2595 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2599 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2602 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2606 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2609 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2613 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2616 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2620 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2623 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2627 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2630 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2634 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2637 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2641 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2644 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2648 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2651 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2655 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2658 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2662 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2665 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2669 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2672 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2676 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2679 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2683 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2686 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2690 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2693 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2697 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2700 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2704 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2707 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2711 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2714 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2718 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2721 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2725 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2728 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2732 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2735 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2739 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2742 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2746 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2749 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2753 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2756 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2760 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2763 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2767 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2770 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2774 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2777 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2781 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2784 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2788 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2791 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2795 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2798 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2802 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2805 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2809 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2812 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2816 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2819 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2823 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2826 ALTER TABLE ONLY public.changeset_comments
2827 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2831 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2834 ALTER TABLE ONLY public.changeset_comments
2835 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2839 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2842 ALTER TABLE ONLY public.changeset_tags
2843 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2847 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2850 ALTER TABLE ONLY public.changesets_subscribers
2851 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2855 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2858 ALTER TABLE ONLY public.changesets_subscribers
2859 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2863 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2866 ALTER TABLE ONLY public.changesets
2867 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2871 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2874 ALTER TABLE ONLY public.client_applications
2875 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2879 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2882 ALTER TABLE ONLY public.current_node_tags
2883 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2887 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2890 ALTER TABLE ONLY public.current_nodes
2891 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2895 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2898 ALTER TABLE ONLY public.current_relation_members
2899 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2903 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2906 ALTER TABLE ONLY public.current_relation_tags
2907 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2911 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2914 ALTER TABLE ONLY public.current_relations
2915 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2919 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2922 ALTER TABLE ONLY public.current_way_nodes
2923 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2927 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2930 ALTER TABLE ONLY public.current_way_nodes
2931 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2935 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2938 ALTER TABLE ONLY public.current_way_tags
2939 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2943 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2946 ALTER TABLE ONLY public.current_ways
2947 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2951 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2954 ALTER TABLE ONLY public.diary_comments
2955 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2959 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2962 ALTER TABLE ONLY public.diary_comments
2963 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2967 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2970 ALTER TABLE ONLY public.diary_entries
2971 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
2975 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2978 ALTER TABLE ONLY public.diary_entries
2979 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2983 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2986 ALTER TABLE ONLY public.diary_entry_subscriptions
2987 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2991 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2994 ALTER TABLE ONLY public.diary_entry_subscriptions
2995 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2999 -- Name: oauth_access_grants fk_rails_330c32d8d9; Type: FK CONSTRAINT; Schema: public; Owner: -
3002 ALTER TABLE ONLY public.oauth_access_grants
3003 ADD CONSTRAINT fk_rails_330c32d8d9 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3007 -- Name: oauth_access_tokens fk_rails_732cb83ab7; Type: FK CONSTRAINT; Schema: public; Owner: -
3010 ALTER TABLE ONLY public.oauth_access_tokens
3011 ADD CONSTRAINT fk_rails_732cb83ab7 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3015 -- Name: active_storage_variant_records fk_rails_993965df05; Type: FK CONSTRAINT; Schema: public; Owner: -
3018 ALTER TABLE ONLY public.active_storage_variant_records
3019 ADD CONSTRAINT fk_rails_993965df05 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3023 -- Name: oauth_access_grants fk_rails_b4b53e07b8; Type: FK CONSTRAINT; Schema: public; Owner: -
3026 ALTER TABLE ONLY public.oauth_access_grants
3027 ADD CONSTRAINT fk_rails_b4b53e07b8 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3031 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
3034 ALTER TABLE ONLY public.active_storage_attachments
3035 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3039 -- Name: oauth_applications fk_rails_cc886e315a; Type: FK CONSTRAINT; Schema: public; Owner: -
3042 ALTER TABLE ONLY public.oauth_applications
3043 ADD CONSTRAINT fk_rails_cc886e315a FOREIGN KEY (owner_id) REFERENCES public.users(id) NOT VALID;
3047 -- Name: oauth_access_tokens fk_rails_ee63f25419; Type: FK CONSTRAINT; Schema: public; Owner: -
3050 ALTER TABLE ONLY public.oauth_access_tokens
3051 ADD CONSTRAINT fk_rails_ee63f25419 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3055 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3058 ALTER TABLE ONLY public.friends
3059 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
3063 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3066 ALTER TABLE ONLY public.friends
3067 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3071 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3074 ALTER TABLE ONLY public.gps_points
3075 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3079 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3082 ALTER TABLE ONLY public.gpx_file_tags
3083 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3087 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3090 ALTER TABLE ONLY public.gpx_files
3091 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3095 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3098 ALTER TABLE ONLY public.issue_comments
3099 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3103 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3106 ALTER TABLE ONLY public.issue_comments
3107 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3111 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3114 ALTER TABLE ONLY public.issues
3115 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
3119 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3122 ALTER TABLE ONLY public.issues
3123 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
3127 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3130 ALTER TABLE ONLY public.issues
3131 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
3135 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3138 ALTER TABLE ONLY public.messages
3139 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
3143 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3146 ALTER TABLE ONLY public.messages
3147 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
3151 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3154 ALTER TABLE ONLY public.node_tags
3155 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
3159 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3162 ALTER TABLE ONLY public.nodes
3163 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3167 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3170 ALTER TABLE ONLY public.nodes
3171 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3175 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3178 ALTER TABLE ONLY public.note_comments
3179 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
3183 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3186 ALTER TABLE ONLY public.note_comments
3187 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
3191 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3194 ALTER TABLE ONLY public.oauth_tokens
3195 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
3199 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3202 ALTER TABLE ONLY public.oauth_tokens
3203 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3207 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3210 ALTER TABLE ONLY public.redactions
3211 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3215 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3218 ALTER TABLE ONLY public.relation_members
3219 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3223 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3226 ALTER TABLE ONLY public.relation_tags
3227 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3231 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3234 ALTER TABLE ONLY public.relations
3235 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3239 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3242 ALTER TABLE ONLY public.relations
3243 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3247 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3250 ALTER TABLE ONLY public.reports
3251 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3255 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3258 ALTER TABLE ONLY public.reports
3259 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3263 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3266 ALTER TABLE ONLY public.user_blocks
3267 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
3271 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3274 ALTER TABLE ONLY public.user_blocks
3275 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
3279 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3282 ALTER TABLE ONLY public.user_blocks
3283 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3287 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3290 ALTER TABLE ONLY public.user_preferences
3291 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3295 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3298 ALTER TABLE ONLY public.user_roles
3299 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3303 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3306 ALTER TABLE ONLY public.user_roles
3307 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3311 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3314 ALTER TABLE ONLY public.user_tokens
3315 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3319 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3322 ALTER TABLE ONLY public.way_nodes
3323 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3327 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3330 ALTER TABLE ONLY public.way_tags
3331 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3335 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3338 ALTER TABLE ONLY public.ways
3339 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3343 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3346 ALTER TABLE ONLY public.ways
3347 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3351 -- PostgreSQL database dump complete
3354 SET search_path TO "$user", public;
3356 INSERT INTO "schema_migrations" (version) VALUES