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: format_enum; Type: TYPE; Schema: public; Owner: -
23 CREATE TYPE public.format_enum AS ENUM (
31 -- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: -
34 CREATE TYPE public.gpx_visibility_enum AS ENUM (
43 -- Name: issue_status_enum; Type: TYPE; Schema: public; Owner: -
46 CREATE TYPE public.issue_status_enum AS ENUM (
54 -- Name: note_event_enum; Type: TYPE; Schema: public; Owner: -
57 CREATE TYPE public.note_event_enum AS ENUM (
67 -- Name: note_status_enum; Type: TYPE; Schema: public; Owner: -
70 CREATE TYPE public.note_status_enum AS ENUM (
78 -- Name: nwr_enum; Type: TYPE; Schema: public; Owner: -
81 CREATE TYPE public.nwr_enum AS ENUM (
89 -- Name: user_role_enum; Type: TYPE; Schema: public; Owner: -
92 CREATE TYPE public.user_role_enum AS ENUM (
99 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
102 CREATE TYPE public.user_status_enum AS ENUM (
110 SET default_tablespace = '';
112 SET default_table_access_method = heap;
115 -- Name: acls; Type: TABLE; Schema: public; Owner: -
118 CREATE TABLE public.acls (
121 k character varying NOT NULL,
123 domain character varying,
129 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
132 CREATE SEQUENCE public.acls_id_seq
141 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
144 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
148 -- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
151 CREATE TABLE public.active_storage_attachments (
153 name character varying NOT NULL,
154 record_type character varying NOT NULL,
155 record_id bigint NOT NULL,
156 blob_id bigint NOT NULL,
157 created_at timestamp without time zone NOT NULL
162 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
165 CREATE SEQUENCE public.active_storage_attachments_id_seq
174 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
177 ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
181 -- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
184 CREATE TABLE public.active_storage_blobs (
186 key character varying NOT NULL,
187 filename character varying NOT NULL,
188 content_type character varying,
190 byte_size bigint NOT NULL,
191 checksum character varying,
192 created_at timestamp without time zone NOT NULL,
193 service_name character varying NOT NULL
198 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
201 CREATE SEQUENCE public.active_storage_blobs_id_seq
210 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
213 ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
217 -- Name: active_storage_variant_records; Type: TABLE; Schema: public; Owner: -
220 CREATE TABLE public.active_storage_variant_records (
222 blob_id bigint NOT NULL,
223 variation_digest character varying NOT NULL
228 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE; Schema: public; Owner: -
231 CREATE SEQUENCE public.active_storage_variant_records_id_seq
240 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
243 ALTER SEQUENCE public.active_storage_variant_records_id_seq OWNED BY public.active_storage_variant_records.id;
247 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
250 CREATE TABLE public.ar_internal_metadata (
251 key character varying NOT NULL,
252 value character varying,
253 created_at timestamp(6) without time zone NOT NULL,
254 updated_at timestamp(6) without time zone NOT NULL
259 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
262 CREATE TABLE public.changeset_comments (
264 changeset_id bigint NOT NULL,
265 author_id bigint NOT NULL,
267 created_at timestamp without time zone NOT NULL,
268 visible boolean NOT NULL
273 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
276 CREATE SEQUENCE public.changeset_comments_id_seq
286 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
289 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
293 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
296 CREATE TABLE public.changeset_tags (
297 changeset_id bigint NOT NULL,
298 k character varying DEFAULT ''::character varying NOT NULL,
299 v character varying DEFAULT ''::character varying NOT NULL
304 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
307 CREATE TABLE public.changesets (
309 user_id bigint NOT NULL,
310 created_at timestamp without time zone NOT NULL,
315 closed_at timestamp without time zone NOT NULL,
316 num_changes integer DEFAULT 0 NOT NULL
321 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
324 CREATE SEQUENCE public.changesets_id_seq
333 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
336 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
340 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
343 CREATE TABLE public.changesets_subscribers (
344 subscriber_id bigint NOT NULL,
345 changeset_id bigint NOT NULL
350 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
353 CREATE TABLE public.client_applications (
355 name character varying,
356 url character varying,
357 support_url character varying,
358 callback_url character varying,
359 key character varying(50),
360 secret character varying(50),
362 created_at timestamp without time zone,
363 updated_at timestamp without time zone,
364 allow_read_prefs boolean DEFAULT false NOT NULL,
365 allow_write_prefs boolean DEFAULT false NOT NULL,
366 allow_write_diary boolean DEFAULT false NOT NULL,
367 allow_write_api boolean DEFAULT false NOT NULL,
368 allow_read_gpx boolean DEFAULT false NOT NULL,
369 allow_write_gpx boolean DEFAULT false NOT NULL,
370 allow_write_notes boolean DEFAULT false NOT NULL
375 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
378 CREATE SEQUENCE public.client_applications_id_seq
388 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
391 ALTER SEQUENCE public.client_applications_id_seq OWNED BY public.client_applications.id;
395 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
398 CREATE TABLE public.current_node_tags (
399 node_id bigint NOT NULL,
400 k character varying DEFAULT ''::character varying NOT NULL,
401 v character varying DEFAULT ''::character varying NOT NULL
406 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
409 CREATE TABLE public.current_nodes (
411 latitude integer NOT NULL,
412 longitude integer NOT NULL,
413 changeset_id bigint NOT NULL,
414 visible boolean NOT NULL,
415 "timestamp" timestamp without time zone NOT NULL,
416 tile bigint NOT NULL,
417 version bigint NOT NULL
422 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
425 CREATE SEQUENCE public.current_nodes_id_seq
434 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
437 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
441 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
444 CREATE TABLE public.current_relation_members (
445 relation_id bigint NOT NULL,
446 member_type public.nwr_enum NOT NULL,
447 member_id bigint NOT NULL,
448 member_role character varying NOT NULL,
449 sequence_id integer DEFAULT 0 NOT NULL
454 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
457 CREATE TABLE public.current_relation_tags (
458 relation_id bigint NOT NULL,
459 k character varying DEFAULT ''::character varying NOT NULL,
460 v character varying DEFAULT ''::character varying NOT NULL
465 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
468 CREATE TABLE public.current_relations (
470 changeset_id bigint NOT NULL,
471 "timestamp" timestamp without time zone NOT NULL,
472 visible boolean NOT NULL,
473 version bigint NOT NULL
478 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
481 CREATE SEQUENCE public.current_relations_id_seq
490 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
493 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
497 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
500 CREATE TABLE public.current_way_nodes (
501 way_id bigint NOT NULL,
502 node_id bigint NOT NULL,
503 sequence_id bigint NOT NULL
508 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
511 CREATE TABLE public.current_way_tags (
512 way_id bigint NOT NULL,
513 k character varying DEFAULT ''::character varying NOT NULL,
514 v character varying DEFAULT ''::character varying NOT NULL
519 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
522 CREATE TABLE public.current_ways (
524 changeset_id bigint NOT NULL,
525 "timestamp" timestamp without time zone NOT NULL,
526 visible boolean NOT NULL,
527 version bigint NOT NULL
532 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
535 CREATE SEQUENCE public.current_ways_id_seq
544 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
547 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
551 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
554 CREATE TABLE public.delayed_jobs (
556 priority integer DEFAULT 0 NOT NULL,
557 attempts integer DEFAULT 0 NOT NULL,
558 handler text NOT NULL,
560 run_at timestamp without time zone,
561 locked_at timestamp without time zone,
562 failed_at timestamp without time zone,
563 locked_by character varying,
564 queue character varying,
565 created_at timestamp without time zone,
566 updated_at timestamp without time zone
571 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
574 CREATE SEQUENCE public.delayed_jobs_id_seq
583 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
586 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
590 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
593 CREATE TABLE public.diary_comments (
595 diary_entry_id bigint NOT NULL,
596 user_id bigint NOT NULL,
598 created_at timestamp without time zone NOT NULL,
599 updated_at timestamp without time zone NOT NULL,
600 visible boolean DEFAULT true NOT NULL,
601 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
606 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
609 CREATE SEQUENCE public.diary_comments_id_seq
618 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
621 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
625 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
628 CREATE TABLE public.diary_entries (
630 user_id bigint NOT NULL,
631 title character varying NOT NULL,
633 created_at timestamp without time zone NOT NULL,
634 updated_at timestamp without time zone NOT NULL,
635 latitude double precision,
636 longitude double precision,
637 language_code character varying DEFAULT 'en'::character varying NOT NULL,
638 visible boolean DEFAULT true NOT NULL,
639 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
644 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
647 CREATE SEQUENCE public.diary_entries_id_seq
656 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
659 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
663 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
666 CREATE TABLE public.diary_entry_subscriptions (
667 user_id bigint NOT NULL,
668 diary_entry_id bigint NOT NULL
673 -- Name: friends; Type: TABLE; Schema: public; Owner: -
676 CREATE TABLE public.friends (
678 user_id bigint NOT NULL,
679 friend_user_id bigint NOT NULL,
680 created_at timestamp without time zone
685 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
688 CREATE SEQUENCE public.friends_id_seq
697 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
700 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
704 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
707 CREATE TABLE public.gps_points (
708 altitude double precision,
709 trackid integer NOT NULL,
710 latitude integer NOT NULL,
711 longitude integer NOT NULL,
712 gpx_id bigint NOT NULL,
713 "timestamp" timestamp without time zone,
719 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
722 CREATE TABLE public.gpx_file_tags (
723 gpx_id bigint NOT NULL,
724 tag character varying NOT NULL,
730 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
733 CREATE SEQUENCE public.gpx_file_tags_id_seq
742 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
745 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
749 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
752 CREATE TABLE public.gpx_files (
754 user_id bigint NOT NULL,
755 visible boolean DEFAULT true NOT NULL,
756 name character varying DEFAULT ''::character varying NOT NULL,
758 latitude double precision,
759 longitude double precision,
760 "timestamp" timestamp without time zone NOT NULL,
761 description character varying DEFAULT ''::character varying NOT NULL,
762 inserted boolean NOT NULL,
763 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
768 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
771 CREATE SEQUENCE public.gpx_files_id_seq
780 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
783 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
787 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
790 CREATE TABLE public.issue_comments (
792 issue_id integer NOT NULL,
793 user_id integer NOT NULL,
795 created_at timestamp without time zone NOT NULL,
796 updated_at timestamp without time zone NOT NULL
801 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
804 CREATE SEQUENCE public.issue_comments_id_seq
814 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
817 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
821 -- Name: issues; Type: TABLE; Schema: public; Owner: -
824 CREATE TABLE public.issues (
826 reportable_type character varying NOT NULL,
827 reportable_id integer NOT NULL,
828 reported_user_id integer,
829 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
830 assigned_role public.user_role_enum NOT NULL,
831 resolved_at timestamp without time zone,
834 reports_count integer DEFAULT 0,
835 created_at timestamp without time zone NOT NULL,
836 updated_at timestamp without time zone NOT NULL
841 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
844 CREATE SEQUENCE public.issues_id_seq
854 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
857 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
861 -- Name: languages; Type: TABLE; Schema: public; Owner: -
864 CREATE TABLE public.languages (
865 code character varying NOT NULL,
866 english_name character varying NOT NULL,
867 native_name character varying
872 -- Name: messages; Type: TABLE; Schema: public; Owner: -
875 CREATE TABLE public.messages (
877 from_user_id bigint NOT NULL,
878 title character varying NOT NULL,
880 sent_on timestamp without time zone NOT NULL,
881 message_read boolean DEFAULT false NOT NULL,
882 to_user_id bigint NOT NULL,
883 to_user_visible boolean DEFAULT true NOT NULL,
884 from_user_visible boolean DEFAULT true NOT NULL,
885 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
890 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
893 CREATE SEQUENCE public.messages_id_seq
902 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
905 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
909 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
912 CREATE TABLE public.node_tags (
913 node_id bigint NOT NULL,
914 version bigint NOT NULL,
915 k character varying DEFAULT ''::character varying NOT NULL,
916 v character varying DEFAULT ''::character varying NOT NULL
921 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
924 CREATE TABLE public.nodes (
925 node_id bigint NOT NULL,
926 latitude integer NOT NULL,
927 longitude integer NOT NULL,
928 changeset_id bigint NOT NULL,
929 visible boolean NOT NULL,
930 "timestamp" timestamp without time zone NOT NULL,
931 tile bigint NOT NULL,
932 version bigint NOT NULL,
938 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
941 CREATE TABLE public.note_comments (
943 note_id bigint NOT NULL,
944 visible boolean NOT NULL,
945 created_at timestamp without time zone NOT NULL,
949 event public.note_event_enum
954 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
957 CREATE SEQUENCE public.note_comments_id_seq
967 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
970 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
974 -- Name: notes; Type: TABLE; Schema: public; Owner: -
977 CREATE TABLE public.notes (
979 latitude integer NOT NULL,
980 longitude integer NOT NULL,
981 tile bigint NOT NULL,
982 updated_at timestamp without time zone NOT NULL,
983 created_at timestamp without time zone NOT NULL,
984 status public.note_status_enum NOT NULL,
985 closed_at timestamp without time zone
990 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
993 CREATE SEQUENCE public.notes_id_seq
1003 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1006 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
1010 -- Name: oauth_access_grants; Type: TABLE; Schema: public; Owner: -
1013 CREATE TABLE public.oauth_access_grants (
1015 resource_owner_id bigint NOT NULL,
1016 application_id bigint NOT NULL,
1017 token character varying NOT NULL,
1018 expires_in integer NOT NULL,
1019 redirect_uri text NOT NULL,
1020 created_at timestamp without time zone NOT NULL,
1021 revoked_at timestamp without time zone,
1022 scopes character varying DEFAULT ''::character varying NOT NULL,
1023 code_challenge character varying,
1024 code_challenge_method character varying
1029 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1032 CREATE SEQUENCE public.oauth_access_grants_id_seq
1041 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1044 ALTER SEQUENCE public.oauth_access_grants_id_seq OWNED BY public.oauth_access_grants.id;
1048 -- Name: oauth_access_tokens; Type: TABLE; Schema: public; Owner: -
1051 CREATE TABLE public.oauth_access_tokens (
1053 resource_owner_id bigint,
1054 application_id bigint NOT NULL,
1055 token character varying NOT NULL,
1056 refresh_token character varying,
1058 revoked_at timestamp without time zone,
1059 created_at timestamp without time zone NOT NULL,
1060 scopes character varying,
1061 previous_refresh_token character varying DEFAULT ''::character varying NOT NULL
1066 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1069 CREATE SEQUENCE public.oauth_access_tokens_id_seq
1078 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1081 ALTER SEQUENCE public.oauth_access_tokens_id_seq OWNED BY public.oauth_access_tokens.id;
1085 -- Name: oauth_applications; Type: TABLE; Schema: public; Owner: -
1088 CREATE TABLE public.oauth_applications (
1090 owner_type character varying NOT NULL,
1091 owner_id bigint NOT NULL,
1092 name character varying NOT NULL,
1093 uid character varying NOT NULL,
1094 secret character varying NOT NULL,
1095 redirect_uri text NOT NULL,
1096 scopes character varying DEFAULT ''::character varying NOT NULL,
1097 confidential boolean DEFAULT true NOT NULL,
1098 created_at timestamp(6) without time zone NOT NULL,
1099 updated_at timestamp(6) without time zone NOT NULL
1104 -- Name: oauth_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1107 CREATE SEQUENCE public.oauth_applications_id_seq
1116 -- Name: oauth_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1119 ALTER SEQUENCE public.oauth_applications_id_seq OWNED BY public.oauth_applications.id;
1123 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
1126 CREATE TABLE public.oauth_nonces (
1128 nonce character varying,
1129 "timestamp" integer,
1130 created_at timestamp without time zone,
1131 updated_at timestamp without time zone
1136 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1139 CREATE SEQUENCE public.oauth_nonces_id_seq
1149 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1152 ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id;
1156 -- Name: oauth_openid_requests; Type: TABLE; Schema: public; Owner: -
1159 CREATE TABLE public.oauth_openid_requests (
1161 access_grant_id bigint NOT NULL,
1162 nonce character varying NOT NULL
1167 -- Name: oauth_openid_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1170 CREATE SEQUENCE public.oauth_openid_requests_id_seq
1179 -- Name: oauth_openid_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1182 ALTER SEQUENCE public.oauth_openid_requests_id_seq OWNED BY public.oauth_openid_requests.id;
1186 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
1189 CREATE TABLE public.oauth_tokens (
1190 id integer NOT NULL,
1192 type character varying(20),
1193 client_application_id integer,
1194 token character varying(50),
1195 secret character varying(50),
1196 authorized_at timestamp without time zone,
1197 invalidated_at timestamp without time zone,
1198 created_at timestamp without time zone,
1199 updated_at timestamp without time zone,
1200 allow_read_prefs boolean DEFAULT false NOT NULL,
1201 allow_write_prefs boolean DEFAULT false NOT NULL,
1202 allow_write_diary boolean DEFAULT false NOT NULL,
1203 allow_write_api boolean DEFAULT false NOT NULL,
1204 allow_read_gpx boolean DEFAULT false NOT NULL,
1205 allow_write_gpx boolean DEFAULT false NOT NULL,
1206 callback_url character varying,
1207 verifier character varying(20),
1208 scope character varying,
1209 valid_to timestamp without time zone,
1210 allow_write_notes boolean DEFAULT false NOT NULL
1215 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1218 CREATE SEQUENCE public.oauth_tokens_id_seq
1228 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1231 ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
1235 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1238 CREATE TABLE public.redactions (
1239 id integer NOT NULL,
1240 title character varying,
1242 created_at timestamp without time zone,
1243 updated_at timestamp without time zone,
1244 user_id bigint NOT NULL,
1245 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1250 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1253 CREATE SEQUENCE public.redactions_id_seq
1263 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1266 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1270 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1273 CREATE TABLE public.relation_members (
1274 relation_id bigint NOT NULL,
1275 member_type public.nwr_enum NOT NULL,
1276 member_id bigint NOT NULL,
1277 member_role character varying NOT NULL,
1278 version bigint DEFAULT 0 NOT NULL,
1279 sequence_id integer DEFAULT 0 NOT NULL
1284 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1287 CREATE TABLE public.relation_tags (
1288 relation_id bigint NOT NULL,
1289 k character varying DEFAULT ''::character varying NOT NULL,
1290 v character varying DEFAULT ''::character varying NOT NULL,
1291 version bigint NOT NULL
1296 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1299 CREATE TABLE public.relations (
1300 relation_id bigint NOT NULL,
1301 changeset_id bigint NOT NULL,
1302 "timestamp" timestamp without time zone NOT NULL,
1303 version bigint NOT NULL,
1304 visible boolean DEFAULT true NOT NULL,
1305 redaction_id integer
1310 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1313 CREATE TABLE public.reports (
1314 id integer NOT NULL,
1315 issue_id integer NOT NULL,
1316 user_id integer NOT NULL,
1317 details text NOT NULL,
1318 category character varying NOT NULL,
1319 created_at timestamp without time zone NOT NULL,
1320 updated_at timestamp without time zone NOT NULL
1325 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1328 CREATE SEQUENCE public.reports_id_seq
1338 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1341 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1345 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1348 CREATE TABLE public.schema_migrations (
1349 version character varying NOT NULL
1354 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1357 CREATE TABLE public.user_blocks (
1358 id integer NOT NULL,
1359 user_id bigint NOT NULL,
1360 creator_id bigint NOT NULL,
1361 reason text NOT NULL,
1362 ends_at timestamp without time zone NOT NULL,
1363 needs_view boolean DEFAULT false NOT NULL,
1365 created_at timestamp without time zone,
1366 updated_at timestamp without time zone,
1367 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1372 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1375 CREATE SEQUENCE public.user_blocks_id_seq
1385 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1388 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1392 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1395 CREATE TABLE public.user_preferences (
1396 user_id bigint NOT NULL,
1397 k character varying NOT NULL,
1398 v character varying NOT NULL
1403 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1406 CREATE TABLE public.user_roles (
1407 id integer NOT NULL,
1408 user_id bigint NOT NULL,
1409 role public.user_role_enum NOT NULL,
1410 created_at timestamp without time zone,
1411 updated_at timestamp without time zone,
1412 granter_id bigint NOT NULL
1417 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1420 CREATE SEQUENCE public.user_roles_id_seq
1430 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1433 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1437 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1440 CREATE TABLE public.user_tokens (
1442 user_id bigint NOT NULL,
1443 token character varying NOT NULL,
1444 expiry timestamp without time zone NOT NULL,
1450 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1453 CREATE SEQUENCE public.user_tokens_id_seq
1462 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1465 ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id;
1469 -- Name: users; Type: TABLE; Schema: public; Owner: -
1472 CREATE TABLE public.users (
1473 email character varying NOT NULL,
1475 pass_crypt character varying NOT NULL,
1476 creation_time timestamp without time zone NOT NULL,
1477 display_name character varying DEFAULT ''::character varying NOT NULL,
1478 data_public boolean DEFAULT false NOT NULL,
1479 description text DEFAULT ''::text NOT NULL,
1480 home_lat double precision,
1481 home_lon double precision,
1482 home_zoom smallint DEFAULT 3,
1483 pass_salt character varying,
1484 email_valid boolean DEFAULT false NOT NULL,
1485 new_email character varying,
1486 creation_ip character varying,
1487 languages character varying,
1488 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1489 terms_agreed timestamp without time zone,
1490 consider_pd boolean DEFAULT false NOT NULL,
1491 auth_uid character varying,
1492 preferred_editor character varying,
1493 terms_seen boolean DEFAULT false NOT NULL,
1494 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1495 changesets_count integer DEFAULT 0 NOT NULL,
1496 traces_count integer DEFAULT 0 NOT NULL,
1497 diary_entries_count integer DEFAULT 0 NOT NULL,
1498 image_use_gravatar boolean DEFAULT false NOT NULL,
1499 auth_provider character varying,
1501 tou_agreed timestamp without time zone
1506 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1509 CREATE SEQUENCE public.users_id_seq
1518 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1521 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1525 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1528 CREATE TABLE public.way_nodes (
1529 way_id bigint NOT NULL,
1530 node_id bigint NOT NULL,
1531 version bigint NOT NULL,
1532 sequence_id bigint NOT NULL
1537 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1540 CREATE TABLE public.way_tags (
1541 way_id bigint NOT NULL,
1542 k character varying NOT NULL,
1543 v character varying NOT NULL,
1544 version bigint NOT NULL
1549 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1552 CREATE TABLE public.ways (
1553 way_id bigint NOT NULL,
1554 changeset_id bigint NOT NULL,
1555 "timestamp" timestamp without time zone NOT NULL,
1556 version bigint NOT NULL,
1557 visible boolean DEFAULT true NOT NULL,
1558 redaction_id integer
1563 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1566 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1570 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1573 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1577 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1580 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1584 -- Name: active_storage_variant_records id; Type: DEFAULT; Schema: public; Owner: -
1587 ALTER TABLE ONLY public.active_storage_variant_records ALTER COLUMN id SET DEFAULT nextval('public.active_storage_variant_records_id_seq'::regclass);
1591 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1594 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1598 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1601 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1605 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1608 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1612 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1615 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1619 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1622 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1626 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1629 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1633 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1636 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1640 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1643 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1647 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1650 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1654 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1657 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1661 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1664 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1668 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1671 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1675 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1678 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1682 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1685 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1689 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1692 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1696 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1699 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1703 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1706 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1710 -- Name: oauth_access_grants id; Type: DEFAULT; Schema: public; Owner: -
1713 ALTER TABLE ONLY public.oauth_access_grants ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_grants_id_seq'::regclass);
1717 -- Name: oauth_access_tokens id; Type: DEFAULT; Schema: public; Owner: -
1720 ALTER TABLE ONLY public.oauth_access_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_tokens_id_seq'::regclass);
1724 -- Name: oauth_applications id; Type: DEFAULT; Schema: public; Owner: -
1727 ALTER TABLE ONLY public.oauth_applications ALTER COLUMN id SET DEFAULT nextval('public.oauth_applications_id_seq'::regclass);
1731 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1734 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1738 -- Name: oauth_openid_requests id; Type: DEFAULT; Schema: public; Owner: -
1741 ALTER TABLE ONLY public.oauth_openid_requests ALTER COLUMN id SET DEFAULT nextval('public.oauth_openid_requests_id_seq'::regclass);
1745 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1748 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1752 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1755 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1759 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1762 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1766 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1769 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1773 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1776 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1780 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1783 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1787 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1790 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1794 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1797 ALTER TABLE ONLY public.acls
1798 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1802 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1805 ALTER TABLE ONLY public.active_storage_attachments
1806 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1810 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1813 ALTER TABLE ONLY public.active_storage_blobs
1814 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1818 -- Name: active_storage_variant_records active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1821 ALTER TABLE ONLY public.active_storage_variant_records
1822 ADD CONSTRAINT active_storage_variant_records_pkey PRIMARY KEY (id);
1826 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1829 ALTER TABLE ONLY public.ar_internal_metadata
1830 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1834 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1837 ALTER TABLE ONLY public.changeset_comments
1838 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1842 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1845 ALTER TABLE ONLY public.changesets
1846 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1850 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1853 ALTER TABLE ONLY public.client_applications
1854 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1858 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1861 ALTER TABLE ONLY public.current_node_tags
1862 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1866 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1869 ALTER TABLE ONLY public.current_nodes
1870 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1874 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1877 ALTER TABLE ONLY public.current_relation_members
1878 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1882 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1885 ALTER TABLE ONLY public.current_relation_tags
1886 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1890 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1893 ALTER TABLE ONLY public.current_relations
1894 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1898 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1901 ALTER TABLE ONLY public.current_way_nodes
1902 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1906 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1909 ALTER TABLE ONLY public.current_way_tags
1910 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1914 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1917 ALTER TABLE ONLY public.current_ways
1918 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1922 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1925 ALTER TABLE ONLY public.delayed_jobs
1926 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1930 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1933 ALTER TABLE ONLY public.diary_comments
1934 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1938 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1941 ALTER TABLE ONLY public.diary_entries
1942 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1946 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1949 ALTER TABLE ONLY public.diary_entry_subscriptions
1950 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1954 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1957 ALTER TABLE ONLY public.friends
1958 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1962 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1965 ALTER TABLE ONLY public.gpx_file_tags
1966 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1970 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1973 ALTER TABLE ONLY public.gpx_files
1974 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1978 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1981 ALTER TABLE ONLY public.issue_comments
1982 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1986 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1989 ALTER TABLE ONLY public.issues
1990 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
1994 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1997 ALTER TABLE ONLY public.languages
1998 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
2002 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2005 ALTER TABLE ONLY public.messages
2006 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
2010 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2013 ALTER TABLE ONLY public.node_tags
2014 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
2018 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2021 ALTER TABLE ONLY public.nodes
2022 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
2026 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2029 ALTER TABLE ONLY public.note_comments
2030 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
2034 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2037 ALTER TABLE ONLY public.notes
2038 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
2042 -- Name: oauth_access_grants oauth_access_grants_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2045 ALTER TABLE ONLY public.oauth_access_grants
2046 ADD CONSTRAINT oauth_access_grants_pkey PRIMARY KEY (id);
2050 -- Name: oauth_access_tokens oauth_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2053 ALTER TABLE ONLY public.oauth_access_tokens
2054 ADD CONSTRAINT oauth_access_tokens_pkey PRIMARY KEY (id);
2058 -- Name: oauth_applications oauth_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2061 ALTER TABLE ONLY public.oauth_applications
2062 ADD CONSTRAINT oauth_applications_pkey PRIMARY KEY (id);
2066 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2069 ALTER TABLE ONLY public.oauth_nonces
2070 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
2074 -- Name: oauth_openid_requests oauth_openid_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2077 ALTER TABLE ONLY public.oauth_openid_requests
2078 ADD CONSTRAINT oauth_openid_requests_pkey PRIMARY KEY (id);
2082 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2085 ALTER TABLE ONLY public.oauth_tokens
2086 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
2090 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2093 ALTER TABLE ONLY public.redactions
2094 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
2098 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2101 ALTER TABLE ONLY public.relation_members
2102 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
2106 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2109 ALTER TABLE ONLY public.relation_tags
2110 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
2114 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2117 ALTER TABLE ONLY public.relations
2118 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
2122 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2125 ALTER TABLE ONLY public.reports
2126 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
2130 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2133 ALTER TABLE ONLY public.schema_migrations
2134 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
2138 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2141 ALTER TABLE ONLY public.user_blocks
2142 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
2146 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2149 ALTER TABLE ONLY public.user_preferences
2150 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
2154 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2157 ALTER TABLE ONLY public.user_roles
2158 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
2162 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2165 ALTER TABLE ONLY public.user_tokens
2166 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
2170 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2173 ALTER TABLE ONLY public.users
2174 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2178 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2181 ALTER TABLE ONLY public.way_nodes
2182 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2186 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2189 ALTER TABLE ONLY public.way_tags
2190 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2194 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2197 ALTER TABLE ONLY public.ways
2198 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2202 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2205 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2209 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
2212 CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id);
2216 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2219 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2223 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2226 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2230 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2233 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2237 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2240 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2244 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2247 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2251 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2254 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2258 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2261 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2265 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2268 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2272 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2275 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2279 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2282 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2286 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2289 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2293 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2296 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2300 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2303 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2307 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2310 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2314 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2317 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2321 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2324 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2328 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2331 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2335 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2338 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2342 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2345 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2349 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2352 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2356 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2359 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2363 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2366 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2370 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2373 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2377 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2380 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2384 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2387 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2391 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2394 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2398 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2401 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2405 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2408 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2412 -- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
2415 CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest);
2419 -- Name: index_changeset_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2422 CREATE INDEX index_changeset_comments_on_author_id_and_created_at ON public.changeset_comments USING btree (author_id, created_at);
2426 -- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2429 CREATE INDEX index_changeset_comments_on_changeset_id_and_created_at ON public.changeset_comments USING btree (changeset_id, created_at);
2433 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2436 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2440 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2443 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2447 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2450 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2454 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2457 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2461 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2464 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2468 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2471 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2475 -- Name: index_friends_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2478 CREATE INDEX index_friends_on_user_id_and_created_at ON public.friends USING btree (user_id, created_at);
2482 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2485 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2489 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2492 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2496 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2499 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2503 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2506 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2510 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2513 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2517 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2520 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2524 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2527 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2531 -- Name: index_note_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2534 CREATE INDEX index_note_comments_on_author_id_and_created_at ON public.note_comments USING btree (author_id, created_at);
2538 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2541 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2545 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2548 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2552 -- Name: index_oauth_access_grants_on_application_id; Type: INDEX; Schema: public; Owner: -
2555 CREATE INDEX index_oauth_access_grants_on_application_id ON public.oauth_access_grants USING btree (application_id);
2559 -- Name: index_oauth_access_grants_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2562 CREATE INDEX index_oauth_access_grants_on_resource_owner_id ON public.oauth_access_grants USING btree (resource_owner_id);
2566 -- Name: index_oauth_access_grants_on_token; Type: INDEX; Schema: public; Owner: -
2569 CREATE UNIQUE INDEX index_oauth_access_grants_on_token ON public.oauth_access_grants USING btree (token);
2573 -- Name: index_oauth_access_tokens_on_application_id; Type: INDEX; Schema: public; Owner: -
2576 CREATE INDEX index_oauth_access_tokens_on_application_id ON public.oauth_access_tokens USING btree (application_id);
2580 -- Name: index_oauth_access_tokens_on_refresh_token; Type: INDEX; Schema: public; Owner: -
2583 CREATE UNIQUE INDEX index_oauth_access_tokens_on_refresh_token ON public.oauth_access_tokens USING btree (refresh_token);
2587 -- Name: index_oauth_access_tokens_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2590 CREATE INDEX index_oauth_access_tokens_on_resource_owner_id ON public.oauth_access_tokens USING btree (resource_owner_id);
2594 -- Name: index_oauth_access_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2597 CREATE UNIQUE INDEX index_oauth_access_tokens_on_token ON public.oauth_access_tokens USING btree (token);
2601 -- Name: index_oauth_applications_on_owner_type_and_owner_id; Type: INDEX; Schema: public; Owner: -
2604 CREATE INDEX index_oauth_applications_on_owner_type_and_owner_id ON public.oauth_applications USING btree (owner_type, owner_id);
2608 -- Name: index_oauth_applications_on_uid; Type: INDEX; Schema: public; Owner: -
2611 CREATE UNIQUE INDEX index_oauth_applications_on_uid ON public.oauth_applications USING btree (uid);
2615 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2618 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2622 -- Name: index_oauth_openid_requests_on_access_grant_id; Type: INDEX; Schema: public; Owner: -
2625 CREATE INDEX index_oauth_openid_requests_on_access_grant_id ON public.oauth_openid_requests USING btree (access_grant_id);
2629 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2632 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2636 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2639 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2643 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2646 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2650 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2653 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2657 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2660 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2664 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2667 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2671 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2674 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2678 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2681 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2685 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2688 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2692 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2695 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2699 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2702 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2706 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2709 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2713 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2716 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2720 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2723 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2727 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2730 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2734 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2737 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2741 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2744 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2748 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2751 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2755 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2758 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2762 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2765 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2769 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2772 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2776 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2779 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2783 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2786 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2790 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2793 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2797 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2800 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2804 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2807 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2811 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2814 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2818 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2821 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2825 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2828 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2832 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2835 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2839 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2842 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2846 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2849 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2853 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2856 ALTER TABLE ONLY public.changeset_comments
2857 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2861 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2864 ALTER TABLE ONLY public.changeset_comments
2865 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2869 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2872 ALTER TABLE ONLY public.changeset_tags
2873 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2877 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2880 ALTER TABLE ONLY public.changesets_subscribers
2881 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2885 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2888 ALTER TABLE ONLY public.changesets_subscribers
2889 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2893 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2896 ALTER TABLE ONLY public.changesets
2897 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2901 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2904 ALTER TABLE ONLY public.client_applications
2905 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2909 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2912 ALTER TABLE ONLY public.current_node_tags
2913 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2917 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2920 ALTER TABLE ONLY public.current_nodes
2921 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2925 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2928 ALTER TABLE ONLY public.current_relation_members
2929 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2933 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2936 ALTER TABLE ONLY public.current_relation_tags
2937 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2941 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2944 ALTER TABLE ONLY public.current_relations
2945 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2949 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2952 ALTER TABLE ONLY public.current_way_nodes
2953 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2957 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2960 ALTER TABLE ONLY public.current_way_nodes
2961 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2965 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2968 ALTER TABLE ONLY public.current_way_tags
2969 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2973 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2976 ALTER TABLE ONLY public.current_ways
2977 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2981 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2984 ALTER TABLE ONLY public.diary_comments
2985 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2989 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2992 ALTER TABLE ONLY public.diary_comments
2993 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2997 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3000 ALTER TABLE ONLY public.diary_entries
3001 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
3005 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3008 ALTER TABLE ONLY public.diary_entries
3009 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3013 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3016 ALTER TABLE ONLY public.diary_entry_subscriptions
3017 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
3021 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3024 ALTER TABLE ONLY public.diary_entry_subscriptions
3025 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3029 -- Name: oauth_access_grants fk_rails_330c32d8d9; Type: FK CONSTRAINT; Schema: public; Owner: -
3032 ALTER TABLE ONLY public.oauth_access_grants
3033 ADD CONSTRAINT fk_rails_330c32d8d9 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3037 -- Name: oauth_access_tokens fk_rails_732cb83ab7; Type: FK CONSTRAINT; Schema: public; Owner: -
3040 ALTER TABLE ONLY public.oauth_access_tokens
3041 ADD CONSTRAINT fk_rails_732cb83ab7 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3045 -- Name: oauth_openid_requests fk_rails_77114b3b09; Type: FK CONSTRAINT; Schema: public; Owner: -
3048 ALTER TABLE ONLY public.oauth_openid_requests
3049 ADD CONSTRAINT fk_rails_77114b3b09 FOREIGN KEY (access_grant_id) REFERENCES public.oauth_access_grants(id) ON DELETE CASCADE;
3053 -- Name: active_storage_variant_records fk_rails_993965df05; Type: FK CONSTRAINT; Schema: public; Owner: -
3056 ALTER TABLE ONLY public.active_storage_variant_records
3057 ADD CONSTRAINT fk_rails_993965df05 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3061 -- Name: oauth_access_grants fk_rails_b4b53e07b8; Type: FK CONSTRAINT; Schema: public; Owner: -
3064 ALTER TABLE ONLY public.oauth_access_grants
3065 ADD CONSTRAINT fk_rails_b4b53e07b8 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3069 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
3072 ALTER TABLE ONLY public.active_storage_attachments
3073 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3077 -- Name: oauth_applications fk_rails_cc886e315a; Type: FK CONSTRAINT; Schema: public; Owner: -
3080 ALTER TABLE ONLY public.oauth_applications
3081 ADD CONSTRAINT fk_rails_cc886e315a FOREIGN KEY (owner_id) REFERENCES public.users(id) NOT VALID;
3085 -- Name: oauth_access_tokens fk_rails_ee63f25419; Type: FK CONSTRAINT; Schema: public; Owner: -
3088 ALTER TABLE ONLY public.oauth_access_tokens
3089 ADD CONSTRAINT fk_rails_ee63f25419 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3093 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3096 ALTER TABLE ONLY public.friends
3097 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
3101 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3104 ALTER TABLE ONLY public.friends
3105 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3109 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3112 ALTER TABLE ONLY public.gps_points
3113 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3117 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3120 ALTER TABLE ONLY public.gpx_file_tags
3121 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3125 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3128 ALTER TABLE ONLY public.gpx_files
3129 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3133 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3136 ALTER TABLE ONLY public.issue_comments
3137 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3141 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3144 ALTER TABLE ONLY public.issue_comments
3145 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3149 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3152 ALTER TABLE ONLY public.issues
3153 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
3157 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3160 ALTER TABLE ONLY public.issues
3161 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
3165 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3168 ALTER TABLE ONLY public.issues
3169 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
3173 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3176 ALTER TABLE ONLY public.messages
3177 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
3181 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3184 ALTER TABLE ONLY public.messages
3185 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
3189 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3192 ALTER TABLE ONLY public.node_tags
3193 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
3197 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3200 ALTER TABLE ONLY public.nodes
3201 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3205 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3208 ALTER TABLE ONLY public.nodes
3209 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3213 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3216 ALTER TABLE ONLY public.note_comments
3217 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
3221 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3224 ALTER TABLE ONLY public.note_comments
3225 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
3229 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3232 ALTER TABLE ONLY public.oauth_tokens
3233 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
3237 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3240 ALTER TABLE ONLY public.oauth_tokens
3241 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3245 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3248 ALTER TABLE ONLY public.redactions
3249 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3253 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3256 ALTER TABLE ONLY public.relation_members
3257 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3261 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3264 ALTER TABLE ONLY public.relation_tags
3265 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3269 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3272 ALTER TABLE ONLY public.relations
3273 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3277 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3280 ALTER TABLE ONLY public.relations
3281 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3285 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3288 ALTER TABLE ONLY public.reports
3289 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3293 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3296 ALTER TABLE ONLY public.reports
3297 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3301 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3304 ALTER TABLE ONLY public.user_blocks
3305 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
3309 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3312 ALTER TABLE ONLY public.user_blocks
3313 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
3317 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3320 ALTER TABLE ONLY public.user_blocks
3321 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3325 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3328 ALTER TABLE ONLY public.user_preferences
3329 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3333 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3336 ALTER TABLE ONLY public.user_roles
3337 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3341 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3344 ALTER TABLE ONLY public.user_roles
3345 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3349 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3352 ALTER TABLE ONLY public.user_tokens
3353 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3357 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3360 ALTER TABLE ONLY public.way_nodes
3361 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3365 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3368 ALTER TABLE ONLY public.way_tags
3369 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3373 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3376 ALTER TABLE ONLY public.ways
3377 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3381 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3384 ALTER TABLE ONLY public.ways
3385 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3389 -- PostgreSQL database dump complete
3392 SET search_path TO "$user", public;
3394 INSERT INTO "schema_migrations" (version) VALUES