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: changeset_tags changeset_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1845 ALTER TABLE ONLY public.changeset_tags
1846 ADD CONSTRAINT changeset_tags_pkey PRIMARY KEY (changeset_id, k);
1850 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1853 ALTER TABLE ONLY public.changesets
1854 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1858 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1861 ALTER TABLE ONLY public.client_applications
1862 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1866 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1869 ALTER TABLE ONLY public.current_node_tags
1870 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1874 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1877 ALTER TABLE ONLY public.current_nodes
1878 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1882 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1885 ALTER TABLE ONLY public.current_relation_members
1886 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, sequence_id);
1890 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1893 ALTER TABLE ONLY public.current_relation_tags
1894 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1898 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1901 ALTER TABLE ONLY public.current_relations
1902 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1906 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1909 ALTER TABLE ONLY public.current_way_nodes
1910 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1914 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1917 ALTER TABLE ONLY public.current_way_tags
1918 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1922 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1925 ALTER TABLE ONLY public.current_ways
1926 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1930 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1933 ALTER TABLE ONLY public.delayed_jobs
1934 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1938 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1941 ALTER TABLE ONLY public.diary_comments
1942 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1946 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1949 ALTER TABLE ONLY public.diary_entries
1950 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1954 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1957 ALTER TABLE ONLY public.diary_entry_subscriptions
1958 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1962 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1965 ALTER TABLE ONLY public.friends
1966 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1970 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1973 ALTER TABLE ONLY public.gpx_file_tags
1974 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1978 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1981 ALTER TABLE ONLY public.gpx_files
1982 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1986 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1989 ALTER TABLE ONLY public.issue_comments
1990 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1994 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1997 ALTER TABLE ONLY public.issues
1998 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
2002 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2005 ALTER TABLE ONLY public.languages
2006 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
2010 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2013 ALTER TABLE ONLY public.messages
2014 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
2018 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2021 ALTER TABLE ONLY public.node_tags
2022 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
2026 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2029 ALTER TABLE ONLY public.nodes
2030 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
2034 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2037 ALTER TABLE ONLY public.note_comments
2038 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
2042 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2045 ALTER TABLE ONLY public.notes
2046 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
2050 -- Name: oauth_access_grants oauth_access_grants_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2053 ALTER TABLE ONLY public.oauth_access_grants
2054 ADD CONSTRAINT oauth_access_grants_pkey PRIMARY KEY (id);
2058 -- Name: oauth_access_tokens oauth_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2061 ALTER TABLE ONLY public.oauth_access_tokens
2062 ADD CONSTRAINT oauth_access_tokens_pkey PRIMARY KEY (id);
2066 -- Name: oauth_applications oauth_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2069 ALTER TABLE ONLY public.oauth_applications
2070 ADD CONSTRAINT oauth_applications_pkey PRIMARY KEY (id);
2074 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2077 ALTER TABLE ONLY public.oauth_nonces
2078 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
2082 -- Name: oauth_openid_requests oauth_openid_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2085 ALTER TABLE ONLY public.oauth_openid_requests
2086 ADD CONSTRAINT oauth_openid_requests_pkey PRIMARY KEY (id);
2090 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2093 ALTER TABLE ONLY public.oauth_tokens
2094 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
2098 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2101 ALTER TABLE ONLY public.redactions
2102 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
2106 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2109 ALTER TABLE ONLY public.relation_members
2110 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, sequence_id);
2114 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2117 ALTER TABLE ONLY public.relation_tags
2118 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
2122 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2125 ALTER TABLE ONLY public.relations
2126 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
2130 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2133 ALTER TABLE ONLY public.reports
2134 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
2138 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2141 ALTER TABLE ONLY public.schema_migrations
2142 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
2146 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2149 ALTER TABLE ONLY public.user_blocks
2150 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
2154 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2157 ALTER TABLE ONLY public.user_preferences
2158 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
2162 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2165 ALTER TABLE ONLY public.user_roles
2166 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
2170 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2173 ALTER TABLE ONLY public.user_tokens
2174 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
2178 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2181 ALTER TABLE ONLY public.users
2182 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2186 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2189 ALTER TABLE ONLY public.way_nodes
2190 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2194 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2197 ALTER TABLE ONLY public.way_tags
2198 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2202 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2205 ALTER TABLE ONLY public.ways
2206 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2210 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2213 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2217 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2220 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2224 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2227 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2231 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2234 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2238 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2241 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2245 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2248 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2252 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2255 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2259 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2262 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2266 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2269 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2273 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2276 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2280 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2283 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2287 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2290 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2294 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2297 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2301 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2304 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2308 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2311 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2315 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2318 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2322 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2325 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2329 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2332 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2336 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2339 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2343 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2346 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2350 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2353 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2357 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2360 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2364 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2367 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2371 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2374 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2378 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2381 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2385 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2388 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2392 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2395 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2399 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2402 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2406 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2409 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2413 -- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
2416 CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest);
2420 -- Name: index_changeset_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2423 CREATE INDEX index_changeset_comments_on_author_id_and_created_at ON public.changeset_comments USING btree (author_id, created_at);
2427 -- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2430 CREATE INDEX index_changeset_comments_on_changeset_id_and_created_at ON public.changeset_comments USING btree (changeset_id, created_at);
2434 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2437 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2441 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2444 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2448 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2451 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2455 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2458 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2462 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2465 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2469 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2472 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2476 -- Name: index_friends_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2479 CREATE INDEX index_friends_on_user_id_and_created_at ON public.friends USING btree (user_id, created_at);
2483 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2486 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2490 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2493 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2497 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2500 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2504 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2507 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2511 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2514 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2518 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2521 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2525 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2528 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2532 -- Name: index_note_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2535 CREATE INDEX index_note_comments_on_author_id_and_created_at ON public.note_comments USING btree (author_id, created_at);
2539 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2542 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2546 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2549 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2553 -- Name: index_oauth_access_grants_on_application_id; Type: INDEX; Schema: public; Owner: -
2556 CREATE INDEX index_oauth_access_grants_on_application_id ON public.oauth_access_grants USING btree (application_id);
2560 -- Name: index_oauth_access_grants_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2563 CREATE INDEX index_oauth_access_grants_on_resource_owner_id ON public.oauth_access_grants USING btree (resource_owner_id);
2567 -- Name: index_oauth_access_grants_on_token; Type: INDEX; Schema: public; Owner: -
2570 CREATE UNIQUE INDEX index_oauth_access_grants_on_token ON public.oauth_access_grants USING btree (token);
2574 -- Name: index_oauth_access_tokens_on_application_id; Type: INDEX; Schema: public; Owner: -
2577 CREATE INDEX index_oauth_access_tokens_on_application_id ON public.oauth_access_tokens USING btree (application_id);
2581 -- Name: index_oauth_access_tokens_on_refresh_token; Type: INDEX; Schema: public; Owner: -
2584 CREATE UNIQUE INDEX index_oauth_access_tokens_on_refresh_token ON public.oauth_access_tokens USING btree (refresh_token);
2588 -- Name: index_oauth_access_tokens_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2591 CREATE INDEX index_oauth_access_tokens_on_resource_owner_id ON public.oauth_access_tokens USING btree (resource_owner_id);
2595 -- Name: index_oauth_access_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2598 CREATE UNIQUE INDEX index_oauth_access_tokens_on_token ON public.oauth_access_tokens USING btree (token);
2602 -- Name: index_oauth_applications_on_owner_type_and_owner_id; Type: INDEX; Schema: public; Owner: -
2605 CREATE INDEX index_oauth_applications_on_owner_type_and_owner_id ON public.oauth_applications USING btree (owner_type, owner_id);
2609 -- Name: index_oauth_applications_on_uid; Type: INDEX; Schema: public; Owner: -
2612 CREATE UNIQUE INDEX index_oauth_applications_on_uid ON public.oauth_applications USING btree (uid);
2616 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2619 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2623 -- Name: index_oauth_openid_requests_on_access_grant_id; Type: INDEX; Schema: public; Owner: -
2626 CREATE INDEX index_oauth_openid_requests_on_access_grant_id ON public.oauth_openid_requests USING btree (access_grant_id);
2630 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2633 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2637 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2640 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2644 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2647 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2651 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2654 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2658 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2661 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2665 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2668 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2672 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2675 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2679 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2682 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2686 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2689 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2693 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2696 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2700 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2703 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2707 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2710 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2714 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2717 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2721 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2724 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2728 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2731 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2735 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2738 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2742 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2745 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2749 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2752 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2756 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2759 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2763 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2766 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2770 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2773 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2777 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2780 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2784 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2787 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2791 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2794 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2798 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2801 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2805 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2808 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2812 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2815 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2819 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2822 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2826 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2829 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2833 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2836 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2840 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2843 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2847 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2850 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2854 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2857 ALTER TABLE ONLY public.changeset_comments
2858 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2862 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2865 ALTER TABLE ONLY public.changeset_comments
2866 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2870 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2873 ALTER TABLE ONLY public.changeset_tags
2874 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2878 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2881 ALTER TABLE ONLY public.changesets_subscribers
2882 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2886 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2889 ALTER TABLE ONLY public.changesets_subscribers
2890 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2894 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2897 ALTER TABLE ONLY public.changesets
2898 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2902 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2905 ALTER TABLE ONLY public.client_applications
2906 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2910 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2913 ALTER TABLE ONLY public.current_node_tags
2914 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2918 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2921 ALTER TABLE ONLY public.current_nodes
2922 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2926 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2929 ALTER TABLE ONLY public.current_relation_members
2930 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2934 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2937 ALTER TABLE ONLY public.current_relation_tags
2938 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2942 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2945 ALTER TABLE ONLY public.current_relations
2946 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2950 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2953 ALTER TABLE ONLY public.current_way_nodes
2954 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2958 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2961 ALTER TABLE ONLY public.current_way_nodes
2962 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2966 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2969 ALTER TABLE ONLY public.current_way_tags
2970 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2974 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2977 ALTER TABLE ONLY public.current_ways
2978 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2982 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2985 ALTER TABLE ONLY public.diary_comments
2986 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2990 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2993 ALTER TABLE ONLY public.diary_comments
2994 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2998 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3001 ALTER TABLE ONLY public.diary_entries
3002 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
3006 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3009 ALTER TABLE ONLY public.diary_entries
3010 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3014 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3017 ALTER TABLE ONLY public.diary_entry_subscriptions
3018 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
3022 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3025 ALTER TABLE ONLY public.diary_entry_subscriptions
3026 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3030 -- Name: oauth_access_grants fk_rails_330c32d8d9; Type: FK CONSTRAINT; Schema: public; Owner: -
3033 ALTER TABLE ONLY public.oauth_access_grants
3034 ADD CONSTRAINT fk_rails_330c32d8d9 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3038 -- Name: oauth_access_tokens fk_rails_732cb83ab7; Type: FK CONSTRAINT; Schema: public; Owner: -
3041 ALTER TABLE ONLY public.oauth_access_tokens
3042 ADD CONSTRAINT fk_rails_732cb83ab7 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3046 -- Name: oauth_openid_requests fk_rails_77114b3b09; Type: FK CONSTRAINT; Schema: public; Owner: -
3049 ALTER TABLE ONLY public.oauth_openid_requests
3050 ADD CONSTRAINT fk_rails_77114b3b09 FOREIGN KEY (access_grant_id) REFERENCES public.oauth_access_grants(id) ON DELETE CASCADE;
3054 -- Name: active_storage_variant_records fk_rails_993965df05; Type: FK CONSTRAINT; Schema: public; Owner: -
3057 ALTER TABLE ONLY public.active_storage_variant_records
3058 ADD CONSTRAINT fk_rails_993965df05 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3062 -- Name: oauth_access_grants fk_rails_b4b53e07b8; Type: FK CONSTRAINT; Schema: public; Owner: -
3065 ALTER TABLE ONLY public.oauth_access_grants
3066 ADD CONSTRAINT fk_rails_b4b53e07b8 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3070 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
3073 ALTER TABLE ONLY public.active_storage_attachments
3074 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3078 -- Name: oauth_applications fk_rails_cc886e315a; Type: FK CONSTRAINT; Schema: public; Owner: -
3081 ALTER TABLE ONLY public.oauth_applications
3082 ADD CONSTRAINT fk_rails_cc886e315a FOREIGN KEY (owner_id) REFERENCES public.users(id) NOT VALID;
3086 -- Name: oauth_access_tokens fk_rails_ee63f25419; Type: FK CONSTRAINT; Schema: public; Owner: -
3089 ALTER TABLE ONLY public.oauth_access_tokens
3090 ADD CONSTRAINT fk_rails_ee63f25419 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3094 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3097 ALTER TABLE ONLY public.friends
3098 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
3102 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3105 ALTER TABLE ONLY public.friends
3106 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3110 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3113 ALTER TABLE ONLY public.gps_points
3114 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3118 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3121 ALTER TABLE ONLY public.gpx_file_tags
3122 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3126 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3129 ALTER TABLE ONLY public.gpx_files
3130 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3134 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3137 ALTER TABLE ONLY public.issue_comments
3138 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3142 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3145 ALTER TABLE ONLY public.issue_comments
3146 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3150 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3153 ALTER TABLE ONLY public.issues
3154 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
3158 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3161 ALTER TABLE ONLY public.issues
3162 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
3166 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3169 ALTER TABLE ONLY public.issues
3170 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
3174 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3177 ALTER TABLE ONLY public.messages
3178 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
3182 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3185 ALTER TABLE ONLY public.messages
3186 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
3190 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3193 ALTER TABLE ONLY public.node_tags
3194 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
3198 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3201 ALTER TABLE ONLY public.nodes
3202 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3206 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3209 ALTER TABLE ONLY public.nodes
3210 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3214 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3217 ALTER TABLE ONLY public.note_comments
3218 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
3222 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3225 ALTER TABLE ONLY public.note_comments
3226 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
3230 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3233 ALTER TABLE ONLY public.oauth_tokens
3234 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
3238 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3241 ALTER TABLE ONLY public.oauth_tokens
3242 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3246 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3249 ALTER TABLE ONLY public.redactions
3250 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3254 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3257 ALTER TABLE ONLY public.relation_members
3258 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3262 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3265 ALTER TABLE ONLY public.relation_tags
3266 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3270 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3273 ALTER TABLE ONLY public.relations
3274 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3278 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3281 ALTER TABLE ONLY public.relations
3282 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3286 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3289 ALTER TABLE ONLY public.reports
3290 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3294 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3297 ALTER TABLE ONLY public.reports
3298 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3302 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3305 ALTER TABLE ONLY public.user_blocks
3306 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
3310 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3313 ALTER TABLE ONLY public.user_blocks
3314 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
3318 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3321 ALTER TABLE ONLY public.user_blocks
3322 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3326 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3329 ALTER TABLE ONLY public.user_preferences
3330 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3334 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3337 ALTER TABLE ONLY public.user_roles
3338 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3342 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3345 ALTER TABLE ONLY public.user_roles
3346 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3350 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3353 ALTER TABLE ONLY public.user_tokens
3354 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3358 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3361 ALTER TABLE ONLY public.way_nodes
3362 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3366 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3369 ALTER TABLE ONLY public.way_tags
3370 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3374 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3377 ALTER TABLE ONLY public.ways
3378 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3382 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3385 ALTER TABLE ONLY public.ways
3386 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3390 -- PostgreSQL database dump complete
3393 SET search_path TO "$user", public;
3395 INSERT INTO "schema_migrations" (version) VALUES