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: xid_to_int4(xid); Type: FUNCTION; Schema: public; Owner: -
154 CREATE FUNCTION public.xid_to_int4(t xid) RETURNS integer
155 LANGUAGE plpgsql IMMUTABLE STRICT
163 IF tl >= 2147483648 THEN
164 tl := tl - 4294967296;
174 SET default_tablespace = '';
176 SET default_table_access_method = heap;
179 -- Name: acls; Type: TABLE; Schema: public; Owner: -
182 CREATE TABLE public.acls (
185 k character varying NOT NULL,
187 domain character varying,
193 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
196 CREATE SEQUENCE public.acls_id_seq
205 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
208 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
212 -- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
215 CREATE TABLE public.active_storage_attachments (
217 name character varying NOT NULL,
218 record_type character varying NOT NULL,
219 record_id bigint NOT NULL,
220 blob_id bigint NOT NULL,
221 created_at timestamp without time zone NOT NULL
226 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
229 CREATE SEQUENCE public.active_storage_attachments_id_seq
238 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
241 ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
245 -- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
248 CREATE TABLE public.active_storage_blobs (
250 key character varying NOT NULL,
251 filename character varying NOT NULL,
252 content_type character varying,
254 byte_size bigint NOT NULL,
255 checksum character varying NOT NULL,
256 created_at timestamp without time zone NOT NULL,
257 service_name character varying NOT NULL
262 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
265 CREATE SEQUENCE public.active_storage_blobs_id_seq
274 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
277 ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
281 -- Name: active_storage_variant_records; Type: TABLE; Schema: public; Owner: -
284 CREATE TABLE public.active_storage_variant_records (
286 blob_id bigint NOT NULL,
287 variation_digest character varying NOT NULL
292 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE; Schema: public; Owner: -
295 CREATE SEQUENCE public.active_storage_variant_records_id_seq
304 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
307 ALTER SEQUENCE public.active_storage_variant_records_id_seq OWNED BY public.active_storage_variant_records.id;
311 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
314 CREATE TABLE public.ar_internal_metadata (
315 key character varying NOT NULL,
316 value character varying,
317 created_at timestamp(6) without time zone NOT NULL,
318 updated_at timestamp(6) without time zone NOT NULL
323 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
326 CREATE TABLE public.changeset_comments (
328 changeset_id bigint NOT NULL,
329 author_id bigint NOT NULL,
331 created_at timestamp without time zone NOT NULL,
332 visible boolean NOT NULL
337 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
340 CREATE SEQUENCE public.changeset_comments_id_seq
350 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
353 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
357 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
360 CREATE TABLE public.changeset_tags (
361 changeset_id bigint NOT NULL,
362 k character varying DEFAULT ''::character varying NOT NULL,
363 v character varying DEFAULT ''::character varying NOT NULL
368 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
371 CREATE TABLE public.changesets (
373 user_id bigint NOT NULL,
374 created_at timestamp without time zone NOT NULL,
379 closed_at timestamp without time zone NOT NULL,
380 num_changes integer DEFAULT 0 NOT NULL
385 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
388 CREATE SEQUENCE public.changesets_id_seq
397 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
400 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
404 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
407 CREATE TABLE public.changesets_subscribers (
408 subscriber_id bigint NOT NULL,
409 changeset_id bigint NOT NULL
414 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
417 CREATE TABLE public.client_applications (
419 name character varying,
420 url character varying,
421 support_url character varying,
422 callback_url character varying,
423 key character varying(50),
424 secret character varying(50),
426 created_at timestamp without time zone,
427 updated_at timestamp without time zone,
428 allow_read_prefs boolean DEFAULT false NOT NULL,
429 allow_write_prefs boolean DEFAULT false NOT NULL,
430 allow_write_diary boolean DEFAULT false NOT NULL,
431 allow_write_api boolean DEFAULT false NOT NULL,
432 allow_read_gpx boolean DEFAULT false NOT NULL,
433 allow_write_gpx boolean DEFAULT false NOT NULL,
434 allow_write_notes boolean DEFAULT false NOT NULL
439 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
442 CREATE SEQUENCE public.client_applications_id_seq
452 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
455 ALTER SEQUENCE public.client_applications_id_seq OWNED BY public.client_applications.id;
459 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
462 CREATE TABLE public.current_node_tags (
463 node_id bigint NOT NULL,
464 k character varying DEFAULT ''::character varying NOT NULL,
465 v character varying DEFAULT ''::character varying NOT NULL
470 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
473 CREATE TABLE public.current_nodes (
475 latitude integer NOT NULL,
476 longitude integer NOT NULL,
477 changeset_id bigint NOT NULL,
478 visible boolean NOT NULL,
479 "timestamp" timestamp without time zone NOT NULL,
480 tile bigint NOT NULL,
481 version bigint NOT NULL
486 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
489 CREATE SEQUENCE public.current_nodes_id_seq
498 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
501 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
505 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
508 CREATE TABLE public.current_relation_members (
509 relation_id bigint NOT NULL,
510 member_type public.nwr_enum NOT NULL,
511 member_id bigint NOT NULL,
512 member_role character varying NOT NULL,
513 sequence_id integer DEFAULT 0 NOT NULL
518 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
521 CREATE TABLE public.current_relation_tags (
522 relation_id bigint NOT NULL,
523 k character varying DEFAULT ''::character varying NOT NULL,
524 v character varying DEFAULT ''::character varying NOT NULL
529 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
532 CREATE TABLE public.current_relations (
534 changeset_id bigint NOT NULL,
535 "timestamp" timestamp without time zone NOT NULL,
536 visible boolean NOT NULL,
537 version bigint NOT NULL
542 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
545 CREATE SEQUENCE public.current_relations_id_seq
554 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
557 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
561 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
564 CREATE TABLE public.current_way_nodes (
565 way_id bigint NOT NULL,
566 node_id bigint NOT NULL,
567 sequence_id bigint NOT NULL
572 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
575 CREATE TABLE public.current_way_tags (
576 way_id bigint NOT NULL,
577 k character varying DEFAULT ''::character varying NOT NULL,
578 v character varying DEFAULT ''::character varying NOT NULL
583 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
586 CREATE TABLE public.current_ways (
588 changeset_id bigint NOT NULL,
589 "timestamp" timestamp without time zone NOT NULL,
590 visible boolean NOT NULL,
591 version bigint NOT NULL
596 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
599 CREATE SEQUENCE public.current_ways_id_seq
608 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
611 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
615 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
618 CREATE TABLE public.delayed_jobs (
620 priority integer DEFAULT 0 NOT NULL,
621 attempts integer DEFAULT 0 NOT NULL,
622 handler text NOT NULL,
624 run_at timestamp without time zone,
625 locked_at timestamp without time zone,
626 failed_at timestamp without time zone,
627 locked_by character varying,
628 queue character varying,
629 created_at timestamp without time zone,
630 updated_at timestamp without time zone
635 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
638 CREATE SEQUENCE public.delayed_jobs_id_seq
647 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
650 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
654 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
657 CREATE TABLE public.diary_comments (
659 diary_entry_id bigint NOT NULL,
660 user_id bigint NOT NULL,
662 created_at timestamp without time zone NOT NULL,
663 updated_at timestamp without time zone NOT NULL,
664 visible boolean DEFAULT true NOT NULL,
665 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
670 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
673 CREATE SEQUENCE public.diary_comments_id_seq
682 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
685 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
689 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
692 CREATE TABLE public.diary_entries (
694 user_id bigint NOT NULL,
695 title character varying NOT NULL,
697 created_at timestamp without time zone NOT NULL,
698 updated_at timestamp without time zone NOT NULL,
699 latitude double precision,
700 longitude double precision,
701 language_code character varying DEFAULT 'en'::character varying NOT NULL,
702 visible boolean DEFAULT true NOT NULL,
703 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
708 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
711 CREATE SEQUENCE public.diary_entries_id_seq
720 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
723 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
727 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
730 CREATE TABLE public.diary_entry_subscriptions (
731 user_id bigint NOT NULL,
732 diary_entry_id bigint NOT NULL
737 -- Name: friends; Type: TABLE; Schema: public; Owner: -
740 CREATE TABLE public.friends (
742 user_id bigint NOT NULL,
743 friend_user_id bigint NOT NULL,
744 created_at timestamp without time zone
749 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
752 CREATE SEQUENCE public.friends_id_seq
761 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
764 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
768 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
771 CREATE TABLE public.gps_points (
772 altitude double precision,
773 trackid integer NOT NULL,
774 latitude integer NOT NULL,
775 longitude integer NOT NULL,
776 gpx_id bigint NOT NULL,
777 "timestamp" timestamp without time zone,
783 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
786 CREATE TABLE public.gpx_file_tags (
787 gpx_id bigint DEFAULT 0 NOT NULL,
788 tag character varying NOT NULL,
794 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
797 CREATE SEQUENCE public.gpx_file_tags_id_seq
806 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
809 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
813 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
816 CREATE TABLE public.gpx_files (
818 user_id bigint NOT NULL,
819 visible boolean DEFAULT true NOT NULL,
820 name character varying DEFAULT ''::character varying NOT NULL,
822 latitude double precision,
823 longitude double precision,
824 "timestamp" timestamp without time zone NOT NULL,
825 description character varying DEFAULT ''::character varying NOT NULL,
826 inserted boolean NOT NULL,
827 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
832 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
835 CREATE SEQUENCE public.gpx_files_id_seq
844 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
847 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
851 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
854 CREATE TABLE public.issue_comments (
856 issue_id integer NOT NULL,
857 user_id integer NOT NULL,
859 created_at timestamp without time zone NOT NULL,
860 updated_at timestamp without time zone NOT NULL
865 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
868 CREATE SEQUENCE public.issue_comments_id_seq
878 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
881 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
885 -- Name: issues; Type: TABLE; Schema: public; Owner: -
888 CREATE TABLE public.issues (
890 reportable_type character varying NOT NULL,
891 reportable_id integer NOT NULL,
892 reported_user_id integer,
893 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
894 assigned_role public.user_role_enum NOT NULL,
895 resolved_at timestamp without time zone,
898 reports_count integer DEFAULT 0,
899 created_at timestamp without time zone NOT NULL,
900 updated_at timestamp without time zone NOT NULL
905 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
908 CREATE SEQUENCE public.issues_id_seq
918 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
921 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
925 -- Name: languages; Type: TABLE; Schema: public; Owner: -
928 CREATE TABLE public.languages (
929 code character varying NOT NULL,
930 english_name character varying NOT NULL,
931 native_name character varying
936 -- Name: messages; Type: TABLE; Schema: public; Owner: -
939 CREATE TABLE public.messages (
941 from_user_id bigint NOT NULL,
942 title character varying NOT NULL,
944 sent_on timestamp without time zone NOT NULL,
945 message_read boolean DEFAULT false NOT NULL,
946 to_user_id bigint NOT NULL,
947 to_user_visible boolean DEFAULT true NOT NULL,
948 from_user_visible boolean DEFAULT true NOT NULL,
949 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
954 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
957 CREATE SEQUENCE public.messages_id_seq
966 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
969 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
973 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
976 CREATE TABLE public.node_tags (
977 node_id bigint NOT NULL,
978 version bigint NOT NULL,
979 k character varying DEFAULT ''::character varying NOT NULL,
980 v character varying DEFAULT ''::character varying NOT NULL
985 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
988 CREATE TABLE public.nodes (
989 node_id bigint NOT NULL,
990 latitude integer NOT NULL,
991 longitude integer NOT NULL,
992 changeset_id bigint NOT NULL,
993 visible boolean NOT NULL,
994 "timestamp" timestamp without time zone NOT NULL,
995 tile bigint NOT NULL,
996 version bigint NOT NULL,
1002 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
1005 CREATE TABLE public.note_comments (
1007 note_id bigint NOT NULL,
1008 visible boolean NOT NULL,
1009 created_at timestamp without time zone NOT NULL,
1013 event public.note_event_enum
1018 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1021 CREATE SEQUENCE public.note_comments_id_seq
1031 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1034 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
1038 -- Name: notes; Type: TABLE; Schema: public; Owner: -
1041 CREATE TABLE public.notes (
1043 latitude integer NOT NULL,
1044 longitude integer NOT NULL,
1045 tile bigint NOT NULL,
1046 updated_at timestamp without time zone NOT NULL,
1047 created_at timestamp without time zone NOT NULL,
1048 status public.note_status_enum NOT NULL,
1049 closed_at timestamp without time zone
1054 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1057 CREATE SEQUENCE public.notes_id_seq
1067 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1070 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
1074 -- Name: oauth_access_grants; Type: TABLE; Schema: public; Owner: -
1077 CREATE TABLE public.oauth_access_grants (
1079 resource_owner_id bigint NOT NULL,
1080 application_id bigint NOT NULL,
1081 token character varying NOT NULL,
1082 expires_in integer NOT NULL,
1083 redirect_uri text NOT NULL,
1084 created_at timestamp without time zone NOT NULL,
1085 revoked_at timestamp without time zone,
1086 scopes character varying DEFAULT ''::character varying NOT NULL,
1087 code_challenge character varying,
1088 code_challenge_method character varying
1093 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1096 CREATE SEQUENCE public.oauth_access_grants_id_seq
1105 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1108 ALTER SEQUENCE public.oauth_access_grants_id_seq OWNED BY public.oauth_access_grants.id;
1112 -- Name: oauth_access_tokens; Type: TABLE; Schema: public; Owner: -
1115 CREATE TABLE public.oauth_access_tokens (
1117 resource_owner_id bigint,
1118 application_id bigint NOT NULL,
1119 token character varying NOT NULL,
1120 refresh_token character varying,
1122 revoked_at timestamp without time zone,
1123 created_at timestamp without time zone NOT NULL,
1124 scopes character varying,
1125 previous_refresh_token character varying DEFAULT ''::character varying NOT NULL
1130 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1133 CREATE SEQUENCE public.oauth_access_tokens_id_seq
1142 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1145 ALTER SEQUENCE public.oauth_access_tokens_id_seq OWNED BY public.oauth_access_tokens.id;
1149 -- Name: oauth_applications; Type: TABLE; Schema: public; Owner: -
1152 CREATE TABLE public.oauth_applications (
1154 owner_type character varying NOT NULL,
1155 owner_id bigint NOT NULL,
1156 name character varying NOT NULL,
1157 uid character varying NOT NULL,
1158 secret character varying NOT NULL,
1159 redirect_uri text NOT NULL,
1160 scopes character varying DEFAULT ''::character varying NOT NULL,
1161 confidential boolean DEFAULT true NOT NULL,
1162 created_at timestamp(6) without time zone NOT NULL,
1163 updated_at timestamp(6) without time zone NOT NULL
1168 -- Name: oauth_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1171 CREATE SEQUENCE public.oauth_applications_id_seq
1180 -- Name: oauth_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1183 ALTER SEQUENCE public.oauth_applications_id_seq OWNED BY public.oauth_applications.id;
1187 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
1190 CREATE TABLE public.oauth_nonces (
1192 nonce character varying,
1193 "timestamp" integer,
1194 created_at timestamp without time zone,
1195 updated_at timestamp without time zone
1200 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1203 CREATE SEQUENCE public.oauth_nonces_id_seq
1213 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1216 ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id;
1220 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
1223 CREATE TABLE public.oauth_tokens (
1224 id integer NOT NULL,
1226 type character varying(20),
1227 client_application_id integer,
1228 token character varying(50),
1229 secret character varying(50),
1230 authorized_at timestamp without time zone,
1231 invalidated_at timestamp without time zone,
1232 created_at timestamp without time zone,
1233 updated_at timestamp without time zone,
1234 allow_read_prefs boolean DEFAULT false NOT NULL,
1235 allow_write_prefs boolean DEFAULT false NOT NULL,
1236 allow_write_diary boolean DEFAULT false NOT NULL,
1237 allow_write_api boolean DEFAULT false NOT NULL,
1238 allow_read_gpx boolean DEFAULT false NOT NULL,
1239 allow_write_gpx boolean DEFAULT false NOT NULL,
1240 callback_url character varying,
1241 verifier character varying(20),
1242 scope character varying,
1243 valid_to timestamp without time zone,
1244 allow_write_notes boolean DEFAULT false NOT NULL
1249 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1252 CREATE SEQUENCE public.oauth_tokens_id_seq
1262 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1265 ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
1269 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1272 CREATE TABLE public.redactions (
1273 id integer NOT NULL,
1274 title character varying,
1276 created_at timestamp without time zone,
1277 updated_at timestamp without time zone,
1278 user_id bigint NOT NULL,
1279 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1284 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1287 CREATE SEQUENCE public.redactions_id_seq
1297 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1300 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1304 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1307 CREATE TABLE public.relation_members (
1308 relation_id bigint DEFAULT 0 NOT NULL,
1309 member_type public.nwr_enum NOT NULL,
1310 member_id bigint NOT NULL,
1311 member_role character varying NOT NULL,
1312 version bigint DEFAULT 0 NOT NULL,
1313 sequence_id integer DEFAULT 0 NOT NULL
1318 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1321 CREATE TABLE public.relation_tags (
1322 relation_id bigint DEFAULT 0 NOT NULL,
1323 k character varying DEFAULT ''::character varying NOT NULL,
1324 v character varying DEFAULT ''::character varying NOT NULL,
1325 version bigint NOT NULL
1330 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1333 CREATE TABLE public.relations (
1334 relation_id bigint DEFAULT 0 NOT NULL,
1335 changeset_id bigint NOT NULL,
1336 "timestamp" timestamp without time zone NOT NULL,
1337 version bigint NOT NULL,
1338 visible boolean DEFAULT true NOT NULL,
1339 redaction_id integer
1344 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1347 CREATE TABLE public.reports (
1348 id integer NOT NULL,
1349 issue_id integer NOT NULL,
1350 user_id integer NOT NULL,
1351 details text NOT NULL,
1352 category character varying NOT NULL,
1353 created_at timestamp without time zone NOT NULL,
1354 updated_at timestamp without time zone NOT NULL
1359 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1362 CREATE SEQUENCE public.reports_id_seq
1372 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1375 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1379 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1382 CREATE TABLE public.schema_migrations (
1383 version character varying NOT NULL
1388 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1391 CREATE TABLE public.user_blocks (
1392 id integer NOT NULL,
1393 user_id bigint NOT NULL,
1394 creator_id bigint NOT NULL,
1395 reason text NOT NULL,
1396 ends_at timestamp without time zone NOT NULL,
1397 needs_view boolean DEFAULT false NOT NULL,
1399 created_at timestamp without time zone,
1400 updated_at timestamp without time zone,
1401 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1406 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1409 CREATE SEQUENCE public.user_blocks_id_seq
1419 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1422 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1426 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1429 CREATE TABLE public.user_preferences (
1430 user_id bigint NOT NULL,
1431 k character varying NOT NULL,
1432 v character varying NOT NULL
1437 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1440 CREATE TABLE public.user_roles (
1441 id integer NOT NULL,
1442 user_id bigint NOT NULL,
1443 role public.user_role_enum NOT NULL,
1444 created_at timestamp without time zone,
1445 updated_at timestamp without time zone,
1446 granter_id bigint NOT NULL
1451 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1454 CREATE SEQUENCE public.user_roles_id_seq
1464 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1467 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1471 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1474 CREATE TABLE public.user_tokens (
1476 user_id bigint NOT NULL,
1477 token character varying NOT NULL,
1478 expiry timestamp without time zone NOT NULL,
1484 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1487 CREATE SEQUENCE public.user_tokens_id_seq
1496 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1499 ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id;
1503 -- Name: users; Type: TABLE; Schema: public; Owner: -
1506 CREATE TABLE public.users (
1507 email character varying NOT NULL,
1509 pass_crypt character varying NOT NULL,
1510 creation_time timestamp without time zone NOT NULL,
1511 display_name character varying DEFAULT ''::character varying NOT NULL,
1512 data_public boolean DEFAULT false NOT NULL,
1513 description text DEFAULT ''::text NOT NULL,
1514 home_lat double precision,
1515 home_lon double precision,
1516 home_zoom smallint DEFAULT 3,
1517 pass_salt character varying,
1518 email_valid boolean DEFAULT false NOT NULL,
1519 new_email character varying,
1520 creation_ip character varying,
1521 languages character varying,
1522 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1523 terms_agreed timestamp without time zone,
1524 consider_pd boolean DEFAULT false NOT NULL,
1525 auth_uid character varying,
1526 preferred_editor character varying,
1527 terms_seen boolean DEFAULT false NOT NULL,
1528 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1529 changesets_count integer DEFAULT 0 NOT NULL,
1530 traces_count integer DEFAULT 0 NOT NULL,
1531 diary_entries_count integer DEFAULT 0 NOT NULL,
1532 image_use_gravatar boolean DEFAULT false NOT NULL,
1533 auth_provider character varying,
1535 tou_agreed timestamp without time zone
1540 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1543 CREATE SEQUENCE public.users_id_seq
1552 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1555 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1559 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1562 CREATE TABLE public.way_nodes (
1563 way_id bigint NOT NULL,
1564 node_id bigint NOT NULL,
1565 version bigint NOT NULL,
1566 sequence_id bigint NOT NULL
1571 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1574 CREATE TABLE public.way_tags (
1575 way_id bigint DEFAULT 0 NOT NULL,
1576 k character varying NOT NULL,
1577 v character varying NOT NULL,
1578 version bigint NOT NULL
1583 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1586 CREATE TABLE public.ways (
1587 way_id bigint DEFAULT 0 NOT NULL,
1588 changeset_id bigint NOT NULL,
1589 "timestamp" timestamp without time zone NOT NULL,
1590 version bigint NOT NULL,
1591 visible boolean DEFAULT true NOT NULL,
1592 redaction_id integer
1597 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1600 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1604 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1607 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1611 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1614 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1618 -- Name: active_storage_variant_records id; Type: DEFAULT; Schema: public; Owner: -
1621 ALTER TABLE ONLY public.active_storage_variant_records ALTER COLUMN id SET DEFAULT nextval('public.active_storage_variant_records_id_seq'::regclass);
1625 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1628 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1632 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1635 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1639 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1642 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1646 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1649 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1653 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1656 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1660 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1663 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1667 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1670 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1674 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1677 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1681 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1684 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1688 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1691 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1695 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1698 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1702 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1705 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1709 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1712 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1716 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1719 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1723 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1726 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1730 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1733 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1737 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1740 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1744 -- Name: oauth_access_grants id; Type: DEFAULT; Schema: public; Owner: -
1747 ALTER TABLE ONLY public.oauth_access_grants ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_grants_id_seq'::regclass);
1751 -- Name: oauth_access_tokens id; Type: DEFAULT; Schema: public; Owner: -
1754 ALTER TABLE ONLY public.oauth_access_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_tokens_id_seq'::regclass);
1758 -- Name: oauth_applications id; Type: DEFAULT; Schema: public; Owner: -
1761 ALTER TABLE ONLY public.oauth_applications ALTER COLUMN id SET DEFAULT nextval('public.oauth_applications_id_seq'::regclass);
1765 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1768 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1772 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1775 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1779 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1782 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1786 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1789 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1793 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1796 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1800 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1803 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1807 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1810 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1814 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1817 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1821 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1824 ALTER TABLE ONLY public.acls
1825 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1829 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1832 ALTER TABLE ONLY public.active_storage_attachments
1833 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1837 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1840 ALTER TABLE ONLY public.active_storage_blobs
1841 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1845 -- Name: active_storage_variant_records active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1848 ALTER TABLE ONLY public.active_storage_variant_records
1849 ADD CONSTRAINT active_storage_variant_records_pkey PRIMARY KEY (id);
1853 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1856 ALTER TABLE ONLY public.ar_internal_metadata
1857 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1861 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1864 ALTER TABLE ONLY public.changeset_comments
1865 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1869 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1872 ALTER TABLE ONLY public.changesets
1873 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1877 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1880 ALTER TABLE ONLY public.client_applications
1881 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1885 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1888 ALTER TABLE ONLY public.current_node_tags
1889 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1893 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1896 ALTER TABLE ONLY public.current_nodes
1897 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1901 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1904 ALTER TABLE ONLY public.current_relation_members
1905 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1909 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1912 ALTER TABLE ONLY public.current_relation_tags
1913 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1917 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1920 ALTER TABLE ONLY public.current_relations
1921 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1925 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1928 ALTER TABLE ONLY public.current_way_nodes
1929 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1933 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1936 ALTER TABLE ONLY public.current_way_tags
1937 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1941 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1944 ALTER TABLE ONLY public.current_ways
1945 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1949 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1952 ALTER TABLE ONLY public.delayed_jobs
1953 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1957 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1960 ALTER TABLE ONLY public.diary_comments
1961 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1965 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1968 ALTER TABLE ONLY public.diary_entries
1969 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1973 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1976 ALTER TABLE ONLY public.diary_entry_subscriptions
1977 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1981 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1984 ALTER TABLE ONLY public.friends
1985 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1989 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1992 ALTER TABLE ONLY public.gpx_file_tags
1993 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1997 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2000 ALTER TABLE ONLY public.gpx_files
2001 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
2005 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2008 ALTER TABLE ONLY public.issue_comments
2009 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
2013 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2016 ALTER TABLE ONLY public.issues
2017 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
2021 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2024 ALTER TABLE ONLY public.languages
2025 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
2029 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2032 ALTER TABLE ONLY public.messages
2033 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
2037 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2040 ALTER TABLE ONLY public.node_tags
2041 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
2045 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2048 ALTER TABLE ONLY public.nodes
2049 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
2053 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2056 ALTER TABLE ONLY public.note_comments
2057 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
2061 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2064 ALTER TABLE ONLY public.notes
2065 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
2069 -- Name: oauth_access_grants oauth_access_grants_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2072 ALTER TABLE ONLY public.oauth_access_grants
2073 ADD CONSTRAINT oauth_access_grants_pkey PRIMARY KEY (id);
2077 -- Name: oauth_access_tokens oauth_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2080 ALTER TABLE ONLY public.oauth_access_tokens
2081 ADD CONSTRAINT oauth_access_tokens_pkey PRIMARY KEY (id);
2085 -- Name: oauth_applications oauth_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2088 ALTER TABLE ONLY public.oauth_applications
2089 ADD CONSTRAINT oauth_applications_pkey PRIMARY KEY (id);
2093 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2096 ALTER TABLE ONLY public.oauth_nonces
2097 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
2101 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2104 ALTER TABLE ONLY public.oauth_tokens
2105 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
2109 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2112 ALTER TABLE ONLY public.redactions
2113 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
2117 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2120 ALTER TABLE ONLY public.relation_members
2121 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
2125 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2128 ALTER TABLE ONLY public.relation_tags
2129 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
2133 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2136 ALTER TABLE ONLY public.relations
2137 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
2141 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2144 ALTER TABLE ONLY public.reports
2145 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
2149 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2152 ALTER TABLE ONLY public.schema_migrations
2153 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
2157 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2160 ALTER TABLE ONLY public.user_blocks
2161 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
2165 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2168 ALTER TABLE ONLY public.user_preferences
2169 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
2173 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2176 ALTER TABLE ONLY public.user_roles
2177 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
2181 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2184 ALTER TABLE ONLY public.user_tokens
2185 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
2189 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2192 ALTER TABLE ONLY public.users
2193 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2197 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2200 ALTER TABLE ONLY public.way_nodes
2201 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2205 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2208 ALTER TABLE ONLY public.way_tags
2209 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2213 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2216 ALTER TABLE ONLY public.ways
2217 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2221 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2224 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2228 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
2231 CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id);
2235 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2238 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2242 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2245 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2249 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2252 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2256 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2259 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2263 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2266 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2270 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2273 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2277 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2280 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2284 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2287 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2291 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2294 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2298 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2301 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2305 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2308 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2312 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2315 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2319 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2322 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2326 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2329 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2333 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2336 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2340 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2343 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2347 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2350 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2354 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2357 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2361 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2364 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2368 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2371 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2375 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2378 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2382 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2385 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2389 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2392 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2396 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2399 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2403 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2406 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2410 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2413 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2417 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2420 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2424 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2427 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2431 -- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
2434 CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest);
2438 -- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2441 CREATE INDEX index_changeset_comments_on_changeset_id_and_created_at ON public.changeset_comments USING btree (changeset_id, created_at);
2445 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2448 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2452 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2455 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2459 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2462 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2466 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2469 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2473 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2476 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2480 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2483 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2487 -- Name: index_friends_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2490 CREATE INDEX index_friends_on_user_id_and_created_at ON public.friends USING btree (user_id, created_at);
2494 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2497 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2501 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2504 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2508 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2511 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2515 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2518 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2522 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2525 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2529 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2532 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2536 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2539 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2543 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2546 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2550 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2553 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2557 -- Name: index_oauth_access_grants_on_application_id; Type: INDEX; Schema: public; Owner: -
2560 CREATE INDEX index_oauth_access_grants_on_application_id ON public.oauth_access_grants USING btree (application_id);
2564 -- Name: index_oauth_access_grants_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2567 CREATE INDEX index_oauth_access_grants_on_resource_owner_id ON public.oauth_access_grants USING btree (resource_owner_id);
2571 -- Name: index_oauth_access_grants_on_token; Type: INDEX; Schema: public; Owner: -
2574 CREATE UNIQUE INDEX index_oauth_access_grants_on_token ON public.oauth_access_grants USING btree (token);
2578 -- Name: index_oauth_access_tokens_on_application_id; Type: INDEX; Schema: public; Owner: -
2581 CREATE INDEX index_oauth_access_tokens_on_application_id ON public.oauth_access_tokens USING btree (application_id);
2585 -- Name: index_oauth_access_tokens_on_refresh_token; Type: INDEX; Schema: public; Owner: -
2588 CREATE UNIQUE INDEX index_oauth_access_tokens_on_refresh_token ON public.oauth_access_tokens USING btree (refresh_token);
2592 -- Name: index_oauth_access_tokens_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2595 CREATE INDEX index_oauth_access_tokens_on_resource_owner_id ON public.oauth_access_tokens USING btree (resource_owner_id);
2599 -- Name: index_oauth_access_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2602 CREATE UNIQUE INDEX index_oauth_access_tokens_on_token ON public.oauth_access_tokens USING btree (token);
2606 -- Name: index_oauth_applications_on_owner_type_and_owner_id; Type: INDEX; Schema: public; Owner: -
2609 CREATE INDEX index_oauth_applications_on_owner_type_and_owner_id ON public.oauth_applications USING btree (owner_type, owner_id);
2613 -- Name: index_oauth_applications_on_uid; Type: INDEX; Schema: public; Owner: -
2616 CREATE UNIQUE INDEX index_oauth_applications_on_uid ON public.oauth_applications USING btree (uid);
2620 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2623 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2627 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2630 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2634 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2637 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2641 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2644 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2648 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2651 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2655 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2658 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2662 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2665 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2669 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2672 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2676 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2679 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2683 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2686 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2690 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2693 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2697 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2700 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2704 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2707 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2711 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2714 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2718 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2721 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2725 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2728 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2732 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2735 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2739 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2742 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2746 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2749 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2753 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2756 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2760 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2763 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2767 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2770 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2774 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2777 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2781 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2784 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2788 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2791 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2795 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2798 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2802 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2805 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2809 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2812 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2816 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2819 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2823 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2826 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2830 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2833 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2837 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2840 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2844 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2847 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2851 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2854 ALTER TABLE ONLY public.changeset_comments
2855 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2859 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2862 ALTER TABLE ONLY public.changeset_comments
2863 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2867 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2870 ALTER TABLE ONLY public.changeset_tags
2871 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2875 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2878 ALTER TABLE ONLY public.changesets_subscribers
2879 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2883 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2886 ALTER TABLE ONLY public.changesets_subscribers
2887 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2891 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2894 ALTER TABLE ONLY public.changesets
2895 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2899 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2902 ALTER TABLE ONLY public.client_applications
2903 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2907 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2910 ALTER TABLE ONLY public.current_node_tags
2911 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2915 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2918 ALTER TABLE ONLY public.current_nodes
2919 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2923 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2926 ALTER TABLE ONLY public.current_relation_members
2927 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2931 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2934 ALTER TABLE ONLY public.current_relation_tags
2935 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2939 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2942 ALTER TABLE ONLY public.current_relations
2943 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2947 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2950 ALTER TABLE ONLY public.current_way_nodes
2951 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2955 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2958 ALTER TABLE ONLY public.current_way_nodes
2959 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2963 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2966 ALTER TABLE ONLY public.current_way_tags
2967 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2971 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2974 ALTER TABLE ONLY public.current_ways
2975 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2979 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2982 ALTER TABLE ONLY public.diary_comments
2983 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2987 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2990 ALTER TABLE ONLY public.diary_comments
2991 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2995 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2998 ALTER TABLE ONLY public.diary_entries
2999 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
3003 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3006 ALTER TABLE ONLY public.diary_entries
3007 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3011 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3014 ALTER TABLE ONLY public.diary_entry_subscriptions
3015 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
3019 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3022 ALTER TABLE ONLY public.diary_entry_subscriptions
3023 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3027 -- Name: oauth_access_grants fk_rails_330c32d8d9; Type: FK CONSTRAINT; Schema: public; Owner: -
3030 ALTER TABLE ONLY public.oauth_access_grants
3031 ADD CONSTRAINT fk_rails_330c32d8d9 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3035 -- Name: oauth_access_tokens fk_rails_732cb83ab7; Type: FK CONSTRAINT; Schema: public; Owner: -
3038 ALTER TABLE ONLY public.oauth_access_tokens
3039 ADD CONSTRAINT fk_rails_732cb83ab7 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3043 -- Name: active_storage_variant_records fk_rails_993965df05; Type: FK CONSTRAINT; Schema: public; Owner: -
3046 ALTER TABLE ONLY public.active_storage_variant_records
3047 ADD CONSTRAINT fk_rails_993965df05 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3051 -- Name: oauth_access_grants fk_rails_b4b53e07b8; Type: FK CONSTRAINT; Schema: public; Owner: -
3054 ALTER TABLE ONLY public.oauth_access_grants
3055 ADD CONSTRAINT fk_rails_b4b53e07b8 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3059 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
3062 ALTER TABLE ONLY public.active_storage_attachments
3063 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3067 -- Name: oauth_applications fk_rails_cc886e315a; Type: FK CONSTRAINT; Schema: public; Owner: -
3070 ALTER TABLE ONLY public.oauth_applications
3071 ADD CONSTRAINT fk_rails_cc886e315a FOREIGN KEY (owner_id) REFERENCES public.users(id) NOT VALID;
3075 -- Name: oauth_access_tokens fk_rails_ee63f25419; Type: FK CONSTRAINT; Schema: public; Owner: -
3078 ALTER TABLE ONLY public.oauth_access_tokens
3079 ADD CONSTRAINT fk_rails_ee63f25419 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3083 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3086 ALTER TABLE ONLY public.friends
3087 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
3091 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3094 ALTER TABLE ONLY public.friends
3095 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3099 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3102 ALTER TABLE ONLY public.gps_points
3103 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3107 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3110 ALTER TABLE ONLY public.gpx_file_tags
3111 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3115 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3118 ALTER TABLE ONLY public.gpx_files
3119 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3123 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3126 ALTER TABLE ONLY public.issue_comments
3127 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3131 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3134 ALTER TABLE ONLY public.issue_comments
3135 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3139 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3142 ALTER TABLE ONLY public.issues
3143 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
3147 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3150 ALTER TABLE ONLY public.issues
3151 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
3155 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3158 ALTER TABLE ONLY public.issues
3159 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
3163 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3166 ALTER TABLE ONLY public.messages
3167 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
3171 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3174 ALTER TABLE ONLY public.messages
3175 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
3179 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3182 ALTER TABLE ONLY public.node_tags
3183 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
3187 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3190 ALTER TABLE ONLY public.nodes
3191 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3195 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3198 ALTER TABLE ONLY public.nodes
3199 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3203 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3206 ALTER TABLE ONLY public.note_comments
3207 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
3211 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3214 ALTER TABLE ONLY public.note_comments
3215 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
3219 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3222 ALTER TABLE ONLY public.oauth_tokens
3223 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
3227 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3230 ALTER TABLE ONLY public.oauth_tokens
3231 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3235 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3238 ALTER TABLE ONLY public.redactions
3239 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3243 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3246 ALTER TABLE ONLY public.relation_members
3247 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3251 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3254 ALTER TABLE ONLY public.relation_tags
3255 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3259 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3262 ALTER TABLE ONLY public.relations
3263 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3267 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3270 ALTER TABLE ONLY public.relations
3271 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3275 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3278 ALTER TABLE ONLY public.reports
3279 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3283 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3286 ALTER TABLE ONLY public.reports
3287 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3291 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3294 ALTER TABLE ONLY public.user_blocks
3295 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
3299 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3302 ALTER TABLE ONLY public.user_blocks
3303 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
3307 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3310 ALTER TABLE ONLY public.user_blocks
3311 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3315 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3318 ALTER TABLE ONLY public.user_preferences
3319 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3323 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3326 ALTER TABLE ONLY public.user_roles
3327 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3331 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3334 ALTER TABLE ONLY public.user_roles
3335 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3339 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3342 ALTER TABLE ONLY public.user_tokens
3343 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3347 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3350 ALTER TABLE ONLY public.way_nodes
3351 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3355 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3358 ALTER TABLE ONLY public.way_tags
3359 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3363 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3366 ALTER TABLE ONLY public.ways
3367 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3371 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3374 ALTER TABLE ONLY public.ways
3375 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3379 -- PostgreSQL database dump complete
3382 SET search_path TO "$user", public;
3384 INSERT INTO "schema_migrations" (version) VALUES