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_tokens; Type: TABLE; Schema: public; Owner: -
1159 CREATE TABLE public.oauth_tokens (
1160 id integer NOT NULL,
1162 type character varying(20),
1163 client_application_id integer,
1164 token character varying(50),
1165 secret character varying(50),
1166 authorized_at timestamp without time zone,
1167 invalidated_at timestamp without time zone,
1168 created_at timestamp without time zone,
1169 updated_at timestamp without time zone,
1170 allow_read_prefs boolean DEFAULT false NOT NULL,
1171 allow_write_prefs boolean DEFAULT false NOT NULL,
1172 allow_write_diary boolean DEFAULT false NOT NULL,
1173 allow_write_api boolean DEFAULT false NOT NULL,
1174 allow_read_gpx boolean DEFAULT false NOT NULL,
1175 allow_write_gpx boolean DEFAULT false NOT NULL,
1176 callback_url character varying,
1177 verifier character varying(20),
1178 scope character varying,
1179 valid_to timestamp without time zone,
1180 allow_write_notes boolean DEFAULT false NOT NULL
1185 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1188 CREATE SEQUENCE public.oauth_tokens_id_seq
1198 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1201 ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
1205 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1208 CREATE TABLE public.redactions (
1209 id integer NOT NULL,
1210 title character varying,
1212 created_at timestamp without time zone,
1213 updated_at timestamp without time zone,
1214 user_id bigint NOT NULL,
1215 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1220 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1223 CREATE SEQUENCE public.redactions_id_seq
1233 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1236 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1240 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1243 CREATE TABLE public.relation_members (
1244 relation_id bigint NOT NULL,
1245 member_type public.nwr_enum NOT NULL,
1246 member_id bigint NOT NULL,
1247 member_role character varying NOT NULL,
1248 version bigint DEFAULT 0 NOT NULL,
1249 sequence_id integer DEFAULT 0 NOT NULL
1254 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1257 CREATE TABLE public.relation_tags (
1258 relation_id bigint NOT NULL,
1259 k character varying DEFAULT ''::character varying NOT NULL,
1260 v character varying DEFAULT ''::character varying NOT NULL,
1261 version bigint NOT NULL
1266 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1269 CREATE TABLE public.relations (
1270 relation_id bigint NOT NULL,
1271 changeset_id bigint NOT NULL,
1272 "timestamp" timestamp without time zone NOT NULL,
1273 version bigint NOT NULL,
1274 visible boolean DEFAULT true NOT NULL,
1275 redaction_id integer
1280 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1283 CREATE TABLE public.reports (
1284 id integer NOT NULL,
1285 issue_id integer NOT NULL,
1286 user_id integer NOT NULL,
1287 details text NOT NULL,
1288 category character varying NOT NULL,
1289 created_at timestamp without time zone NOT NULL,
1290 updated_at timestamp without time zone NOT NULL
1295 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1298 CREATE SEQUENCE public.reports_id_seq
1308 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1311 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1315 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1318 CREATE TABLE public.schema_migrations (
1319 version character varying NOT NULL
1324 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1327 CREATE TABLE public.user_blocks (
1328 id integer NOT NULL,
1329 user_id bigint NOT NULL,
1330 creator_id bigint NOT NULL,
1331 reason text NOT NULL,
1332 ends_at timestamp without time zone NOT NULL,
1333 needs_view boolean DEFAULT false NOT NULL,
1335 created_at timestamp without time zone,
1336 updated_at timestamp without time zone,
1337 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1342 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1345 CREATE SEQUENCE public.user_blocks_id_seq
1355 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1358 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1362 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1365 CREATE TABLE public.user_preferences (
1366 user_id bigint NOT NULL,
1367 k character varying NOT NULL,
1368 v character varying NOT NULL
1373 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1376 CREATE TABLE public.user_roles (
1377 id integer NOT NULL,
1378 user_id bigint NOT NULL,
1379 role public.user_role_enum NOT NULL,
1380 created_at timestamp without time zone,
1381 updated_at timestamp without time zone,
1382 granter_id bigint NOT NULL
1387 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1390 CREATE SEQUENCE public.user_roles_id_seq
1400 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1403 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1407 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1410 CREATE TABLE public.user_tokens (
1412 user_id bigint NOT NULL,
1413 token character varying NOT NULL,
1414 expiry timestamp without time zone NOT NULL,
1420 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1423 CREATE SEQUENCE public.user_tokens_id_seq
1432 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1435 ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id;
1439 -- Name: users; Type: TABLE; Schema: public; Owner: -
1442 CREATE TABLE public.users (
1443 email character varying NOT NULL,
1445 pass_crypt character varying NOT NULL,
1446 creation_time timestamp without time zone NOT NULL,
1447 display_name character varying DEFAULT ''::character varying NOT NULL,
1448 data_public boolean DEFAULT false NOT NULL,
1449 description text DEFAULT ''::text NOT NULL,
1450 home_lat double precision,
1451 home_lon double precision,
1452 home_zoom smallint DEFAULT 3,
1453 pass_salt character varying,
1454 email_valid boolean DEFAULT false NOT NULL,
1455 new_email character varying,
1456 creation_ip character varying,
1457 languages character varying,
1458 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1459 terms_agreed timestamp without time zone,
1460 consider_pd boolean DEFAULT false NOT NULL,
1461 auth_uid character varying,
1462 preferred_editor character varying,
1463 terms_seen boolean DEFAULT false NOT NULL,
1464 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1465 changesets_count integer DEFAULT 0 NOT NULL,
1466 traces_count integer DEFAULT 0 NOT NULL,
1467 diary_entries_count integer DEFAULT 0 NOT NULL,
1468 image_use_gravatar boolean DEFAULT false NOT NULL,
1469 auth_provider character varying,
1471 tou_agreed timestamp without time zone
1476 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1479 CREATE SEQUENCE public.users_id_seq
1488 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1491 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1495 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1498 CREATE TABLE public.way_nodes (
1499 way_id bigint NOT NULL,
1500 node_id bigint NOT NULL,
1501 version bigint NOT NULL,
1502 sequence_id bigint NOT NULL
1507 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1510 CREATE TABLE public.way_tags (
1511 way_id bigint NOT NULL,
1512 k character varying NOT NULL,
1513 v character varying NOT NULL,
1514 version bigint NOT NULL
1519 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1522 CREATE TABLE public.ways (
1523 way_id bigint NOT NULL,
1524 changeset_id bigint NOT NULL,
1525 "timestamp" timestamp without time zone NOT NULL,
1526 version bigint NOT NULL,
1527 visible boolean DEFAULT true NOT NULL,
1528 redaction_id integer
1533 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1536 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1540 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1543 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1547 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1550 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1554 -- Name: active_storage_variant_records id; Type: DEFAULT; Schema: public; Owner: -
1557 ALTER TABLE ONLY public.active_storage_variant_records ALTER COLUMN id SET DEFAULT nextval('public.active_storage_variant_records_id_seq'::regclass);
1561 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1564 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1568 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1571 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1575 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1578 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1582 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1585 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1589 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1592 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1596 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1599 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1603 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1606 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1610 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1613 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1617 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1620 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1624 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1627 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1631 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1634 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1638 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1641 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1645 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1648 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1652 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1655 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1659 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1662 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1666 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1669 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1673 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1676 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1680 -- Name: oauth_access_grants id; Type: DEFAULT; Schema: public; Owner: -
1683 ALTER TABLE ONLY public.oauth_access_grants ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_grants_id_seq'::regclass);
1687 -- Name: oauth_access_tokens id; Type: DEFAULT; Schema: public; Owner: -
1690 ALTER TABLE ONLY public.oauth_access_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_tokens_id_seq'::regclass);
1694 -- Name: oauth_applications id; Type: DEFAULT; Schema: public; Owner: -
1697 ALTER TABLE ONLY public.oauth_applications ALTER COLUMN id SET DEFAULT nextval('public.oauth_applications_id_seq'::regclass);
1701 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1704 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1708 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1711 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1715 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1718 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1722 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1725 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1729 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1732 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1736 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1739 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1743 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1746 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1750 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1753 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1757 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1760 ALTER TABLE ONLY public.acls
1761 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1765 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1768 ALTER TABLE ONLY public.active_storage_attachments
1769 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1773 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1776 ALTER TABLE ONLY public.active_storage_blobs
1777 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1781 -- Name: active_storage_variant_records active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1784 ALTER TABLE ONLY public.active_storage_variant_records
1785 ADD CONSTRAINT active_storage_variant_records_pkey PRIMARY KEY (id);
1789 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1792 ALTER TABLE ONLY public.ar_internal_metadata
1793 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1797 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1800 ALTER TABLE ONLY public.changeset_comments
1801 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1805 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1808 ALTER TABLE ONLY public.changesets
1809 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1813 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1816 ALTER TABLE ONLY public.client_applications
1817 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1821 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1824 ALTER TABLE ONLY public.current_node_tags
1825 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1829 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1832 ALTER TABLE ONLY public.current_nodes
1833 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1837 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1840 ALTER TABLE ONLY public.current_relation_members
1841 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1845 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1848 ALTER TABLE ONLY public.current_relation_tags
1849 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1853 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1856 ALTER TABLE ONLY public.current_relations
1857 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1861 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1864 ALTER TABLE ONLY public.current_way_nodes
1865 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1869 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1872 ALTER TABLE ONLY public.current_way_tags
1873 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1877 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1880 ALTER TABLE ONLY public.current_ways
1881 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1885 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1888 ALTER TABLE ONLY public.delayed_jobs
1889 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1893 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1896 ALTER TABLE ONLY public.diary_comments
1897 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1901 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1904 ALTER TABLE ONLY public.diary_entries
1905 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1909 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1912 ALTER TABLE ONLY public.diary_entry_subscriptions
1913 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1917 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1920 ALTER TABLE ONLY public.friends
1921 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1925 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1928 ALTER TABLE ONLY public.gpx_file_tags
1929 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1933 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1936 ALTER TABLE ONLY public.gpx_files
1937 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1941 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1944 ALTER TABLE ONLY public.issue_comments
1945 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1949 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1952 ALTER TABLE ONLY public.issues
1953 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
1957 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1960 ALTER TABLE ONLY public.languages
1961 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1965 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1968 ALTER TABLE ONLY public.messages
1969 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1973 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1976 ALTER TABLE ONLY public.node_tags
1977 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1981 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1984 ALTER TABLE ONLY public.nodes
1985 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1989 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1992 ALTER TABLE ONLY public.note_comments
1993 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1997 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2000 ALTER TABLE ONLY public.notes
2001 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
2005 -- Name: oauth_access_grants oauth_access_grants_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2008 ALTER TABLE ONLY public.oauth_access_grants
2009 ADD CONSTRAINT oauth_access_grants_pkey PRIMARY KEY (id);
2013 -- Name: oauth_access_tokens oauth_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2016 ALTER TABLE ONLY public.oauth_access_tokens
2017 ADD CONSTRAINT oauth_access_tokens_pkey PRIMARY KEY (id);
2021 -- Name: oauth_applications oauth_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2024 ALTER TABLE ONLY public.oauth_applications
2025 ADD CONSTRAINT oauth_applications_pkey PRIMARY KEY (id);
2029 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2032 ALTER TABLE ONLY public.oauth_nonces
2033 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
2037 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2040 ALTER TABLE ONLY public.oauth_tokens
2041 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
2045 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2048 ALTER TABLE ONLY public.redactions
2049 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
2053 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2056 ALTER TABLE ONLY public.relation_members
2057 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
2061 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2064 ALTER TABLE ONLY public.relation_tags
2065 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
2069 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2072 ALTER TABLE ONLY public.relations
2073 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
2077 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2080 ALTER TABLE ONLY public.reports
2081 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
2085 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2088 ALTER TABLE ONLY public.schema_migrations
2089 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
2093 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2096 ALTER TABLE ONLY public.user_blocks
2097 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
2101 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2104 ALTER TABLE ONLY public.user_preferences
2105 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
2109 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2112 ALTER TABLE ONLY public.user_roles
2113 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
2117 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2120 ALTER TABLE ONLY public.user_tokens
2121 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
2125 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2128 ALTER TABLE ONLY public.users
2129 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2133 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2136 ALTER TABLE ONLY public.way_nodes
2137 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2141 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2144 ALTER TABLE ONLY public.way_tags
2145 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2149 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2152 ALTER TABLE ONLY public.ways
2153 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2157 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2160 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2164 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
2167 CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id);
2171 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2174 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2178 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2181 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2185 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2188 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2192 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2195 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2199 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2202 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2206 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2209 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2213 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2216 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2220 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2223 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2227 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2230 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2234 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2237 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2241 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2244 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2248 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2251 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2255 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2258 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2262 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2265 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2269 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2272 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2276 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2279 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2283 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2286 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2290 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2293 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2297 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2300 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2304 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2307 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2311 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2314 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2318 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2321 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2325 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2328 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2332 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2335 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2339 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2342 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2346 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2349 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2353 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2356 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2360 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2363 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2367 -- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
2370 CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest);
2374 -- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2377 CREATE INDEX index_changeset_comments_on_changeset_id_and_created_at ON public.changeset_comments USING btree (changeset_id, created_at);
2381 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2384 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2388 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2391 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2395 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2398 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2402 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2405 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2409 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2412 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2416 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2419 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2423 -- Name: index_friends_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2426 CREATE INDEX index_friends_on_user_id_and_created_at ON public.friends USING btree (user_id, created_at);
2430 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2433 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2437 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2440 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2444 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2447 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2451 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2454 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2458 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2461 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2465 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2468 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2472 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2475 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2479 -- Name: index_note_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2482 CREATE INDEX index_note_comments_on_author_id_and_created_at ON public.note_comments USING btree (author_id, created_at);
2486 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2489 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2493 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2496 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2500 -- Name: index_oauth_access_grants_on_application_id; Type: INDEX; Schema: public; Owner: -
2503 CREATE INDEX index_oauth_access_grants_on_application_id ON public.oauth_access_grants USING btree (application_id);
2507 -- Name: index_oauth_access_grants_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2510 CREATE INDEX index_oauth_access_grants_on_resource_owner_id ON public.oauth_access_grants USING btree (resource_owner_id);
2514 -- Name: index_oauth_access_grants_on_token; Type: INDEX; Schema: public; Owner: -
2517 CREATE UNIQUE INDEX index_oauth_access_grants_on_token ON public.oauth_access_grants USING btree (token);
2521 -- Name: index_oauth_access_tokens_on_application_id; Type: INDEX; Schema: public; Owner: -
2524 CREATE INDEX index_oauth_access_tokens_on_application_id ON public.oauth_access_tokens USING btree (application_id);
2528 -- Name: index_oauth_access_tokens_on_refresh_token; Type: INDEX; Schema: public; Owner: -
2531 CREATE UNIQUE INDEX index_oauth_access_tokens_on_refresh_token ON public.oauth_access_tokens USING btree (refresh_token);
2535 -- Name: index_oauth_access_tokens_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2538 CREATE INDEX index_oauth_access_tokens_on_resource_owner_id ON public.oauth_access_tokens USING btree (resource_owner_id);
2542 -- Name: index_oauth_access_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2545 CREATE UNIQUE INDEX index_oauth_access_tokens_on_token ON public.oauth_access_tokens USING btree (token);
2549 -- Name: index_oauth_applications_on_owner_type_and_owner_id; Type: INDEX; Schema: public; Owner: -
2552 CREATE INDEX index_oauth_applications_on_owner_type_and_owner_id ON public.oauth_applications USING btree (owner_type, owner_id);
2556 -- Name: index_oauth_applications_on_uid; Type: INDEX; Schema: public; Owner: -
2559 CREATE UNIQUE INDEX index_oauth_applications_on_uid ON public.oauth_applications USING btree (uid);
2563 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2566 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2570 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2573 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2577 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2580 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2584 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2587 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2591 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2594 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2598 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2601 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2605 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2608 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2612 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2615 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2619 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2622 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2626 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2629 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2633 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2636 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2640 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2643 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2647 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2650 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2654 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2657 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2661 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2664 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2668 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2671 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2675 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2678 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2682 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2685 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2689 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2692 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2696 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2699 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2703 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2706 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2710 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2713 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2717 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2720 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2724 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2727 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2731 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2734 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2738 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2741 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2745 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2748 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2752 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2755 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2759 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2762 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2766 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2769 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2773 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2776 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2780 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2783 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2787 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2790 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2794 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2797 ALTER TABLE ONLY public.changeset_comments
2798 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2802 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2805 ALTER TABLE ONLY public.changeset_comments
2806 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2810 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2813 ALTER TABLE ONLY public.changeset_tags
2814 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2818 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2821 ALTER TABLE ONLY public.changesets_subscribers
2822 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2826 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2829 ALTER TABLE ONLY public.changesets_subscribers
2830 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2834 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2837 ALTER TABLE ONLY public.changesets
2838 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2842 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2845 ALTER TABLE ONLY public.client_applications
2846 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2850 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2853 ALTER TABLE ONLY public.current_node_tags
2854 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2858 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2861 ALTER TABLE ONLY public.current_nodes
2862 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2866 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2869 ALTER TABLE ONLY public.current_relation_members
2870 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2874 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2877 ALTER TABLE ONLY public.current_relation_tags
2878 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2882 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2885 ALTER TABLE ONLY public.current_relations
2886 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2890 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2893 ALTER TABLE ONLY public.current_way_nodes
2894 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2898 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2901 ALTER TABLE ONLY public.current_way_nodes
2902 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2906 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2909 ALTER TABLE ONLY public.current_way_tags
2910 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2914 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2917 ALTER TABLE ONLY public.current_ways
2918 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2922 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2925 ALTER TABLE ONLY public.diary_comments
2926 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2930 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2933 ALTER TABLE ONLY public.diary_comments
2934 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2938 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2941 ALTER TABLE ONLY public.diary_entries
2942 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
2946 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2949 ALTER TABLE ONLY public.diary_entries
2950 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2954 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2957 ALTER TABLE ONLY public.diary_entry_subscriptions
2958 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2962 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2965 ALTER TABLE ONLY public.diary_entry_subscriptions
2966 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2970 -- Name: oauth_access_grants fk_rails_330c32d8d9; Type: FK CONSTRAINT; Schema: public; Owner: -
2973 ALTER TABLE ONLY public.oauth_access_grants
2974 ADD CONSTRAINT fk_rails_330c32d8d9 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
2978 -- Name: oauth_access_tokens fk_rails_732cb83ab7; Type: FK CONSTRAINT; Schema: public; Owner: -
2981 ALTER TABLE ONLY public.oauth_access_tokens
2982 ADD CONSTRAINT fk_rails_732cb83ab7 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
2986 -- Name: active_storage_variant_records fk_rails_993965df05; Type: FK CONSTRAINT; Schema: public; Owner: -
2989 ALTER TABLE ONLY public.active_storage_variant_records
2990 ADD CONSTRAINT fk_rails_993965df05 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
2994 -- Name: oauth_access_grants fk_rails_b4b53e07b8; Type: FK CONSTRAINT; Schema: public; Owner: -
2997 ALTER TABLE ONLY public.oauth_access_grants
2998 ADD CONSTRAINT fk_rails_b4b53e07b8 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3002 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
3005 ALTER TABLE ONLY public.active_storage_attachments
3006 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3010 -- Name: oauth_applications fk_rails_cc886e315a; Type: FK CONSTRAINT; Schema: public; Owner: -
3013 ALTER TABLE ONLY public.oauth_applications
3014 ADD CONSTRAINT fk_rails_cc886e315a FOREIGN KEY (owner_id) REFERENCES public.users(id) NOT VALID;
3018 -- Name: oauth_access_tokens fk_rails_ee63f25419; Type: FK CONSTRAINT; Schema: public; Owner: -
3021 ALTER TABLE ONLY public.oauth_access_tokens
3022 ADD CONSTRAINT fk_rails_ee63f25419 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3026 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3029 ALTER TABLE ONLY public.friends
3030 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
3034 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3037 ALTER TABLE ONLY public.friends
3038 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3042 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3045 ALTER TABLE ONLY public.gps_points
3046 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3050 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3053 ALTER TABLE ONLY public.gpx_file_tags
3054 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3058 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3061 ALTER TABLE ONLY public.gpx_files
3062 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3066 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3069 ALTER TABLE ONLY public.issue_comments
3070 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3074 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3077 ALTER TABLE ONLY public.issue_comments
3078 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3082 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3085 ALTER TABLE ONLY public.issues
3086 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
3090 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3093 ALTER TABLE ONLY public.issues
3094 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
3098 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3101 ALTER TABLE ONLY public.issues
3102 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
3106 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3109 ALTER TABLE ONLY public.messages
3110 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
3114 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3117 ALTER TABLE ONLY public.messages
3118 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
3122 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3125 ALTER TABLE ONLY public.node_tags
3126 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
3130 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3133 ALTER TABLE ONLY public.nodes
3134 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3138 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3141 ALTER TABLE ONLY public.nodes
3142 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3146 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3149 ALTER TABLE ONLY public.note_comments
3150 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
3154 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3157 ALTER TABLE ONLY public.note_comments
3158 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
3162 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3165 ALTER TABLE ONLY public.oauth_tokens
3166 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
3170 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3173 ALTER TABLE ONLY public.oauth_tokens
3174 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3178 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3181 ALTER TABLE ONLY public.redactions
3182 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3186 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3189 ALTER TABLE ONLY public.relation_members
3190 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3194 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3197 ALTER TABLE ONLY public.relation_tags
3198 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3202 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3205 ALTER TABLE ONLY public.relations
3206 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3210 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3213 ALTER TABLE ONLY public.relations
3214 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3218 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3221 ALTER TABLE ONLY public.reports
3222 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3226 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3229 ALTER TABLE ONLY public.reports
3230 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3234 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3237 ALTER TABLE ONLY public.user_blocks
3238 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
3242 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3245 ALTER TABLE ONLY public.user_blocks
3246 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
3250 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3253 ALTER TABLE ONLY public.user_blocks
3254 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3258 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3261 ALTER TABLE ONLY public.user_preferences
3262 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3266 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3269 ALTER TABLE ONLY public.user_roles
3270 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3274 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3277 ALTER TABLE ONLY public.user_roles
3278 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3282 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3285 ALTER TABLE ONLY public.user_tokens
3286 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3290 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3293 ALTER TABLE ONLY public.way_nodes
3294 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3298 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3301 ALTER TABLE ONLY public.way_tags
3302 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3306 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3309 ALTER TABLE ONLY public.ways
3310 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3314 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3317 ALTER TABLE ONLY public.ways
3318 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3322 -- PostgreSQL database dump complete
3325 SET search_path TO "$user", public;
3327 INSERT INTO "schema_migrations" (version) VALUES