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 (
100 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
103 CREATE TYPE public.user_status_enum AS ENUM (
111 SET default_tablespace = '';
113 SET default_table_access_method = heap;
116 -- Name: acls; Type: TABLE; Schema: public; Owner: -
119 CREATE TABLE public.acls (
122 k character varying NOT NULL,
124 domain character varying,
130 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
133 CREATE SEQUENCE public.acls_id_seq
142 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
145 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
149 -- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
152 CREATE TABLE public.active_storage_attachments (
154 name character varying NOT NULL,
155 record_type character varying NOT NULL,
156 record_id bigint NOT NULL,
157 blob_id bigint NOT NULL,
158 created_at timestamp without time zone NOT NULL
163 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
166 CREATE SEQUENCE public.active_storage_attachments_id_seq
175 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
178 ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
182 -- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
185 CREATE TABLE public.active_storage_blobs (
187 key character varying NOT NULL,
188 filename character varying NOT NULL,
189 content_type character varying,
191 byte_size bigint NOT NULL,
192 checksum character varying,
193 created_at timestamp without time zone NOT NULL,
194 service_name character varying NOT NULL
199 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
202 CREATE SEQUENCE public.active_storage_blobs_id_seq
211 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
214 ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
218 -- Name: active_storage_variant_records; Type: TABLE; Schema: public; Owner: -
221 CREATE TABLE public.active_storage_variant_records (
223 blob_id bigint NOT NULL,
224 variation_digest character varying NOT NULL
229 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE; Schema: public; Owner: -
232 CREATE SEQUENCE public.active_storage_variant_records_id_seq
241 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
244 ALTER SEQUENCE public.active_storage_variant_records_id_seq OWNED BY public.active_storage_variant_records.id;
248 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
251 CREATE TABLE public.ar_internal_metadata (
252 key character varying NOT NULL,
253 value character varying,
254 created_at timestamp(6) without time zone NOT NULL,
255 updated_at timestamp(6) without time zone NOT NULL
260 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
263 CREATE TABLE public.changeset_comments (
265 changeset_id bigint NOT NULL,
266 author_id bigint NOT NULL,
268 created_at timestamp without time zone NOT NULL,
269 visible boolean NOT NULL
274 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
277 CREATE SEQUENCE public.changeset_comments_id_seq
287 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
290 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
294 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
297 CREATE TABLE public.changeset_tags (
298 changeset_id bigint NOT NULL,
299 k character varying DEFAULT ''::character varying NOT NULL,
300 v character varying DEFAULT ''::character varying NOT NULL
305 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
308 CREATE TABLE public.changesets (
310 user_id bigint NOT NULL,
311 created_at timestamp without time zone NOT NULL,
316 closed_at timestamp without time zone NOT NULL,
317 num_changes integer DEFAULT 0 NOT NULL
322 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
325 CREATE SEQUENCE public.changesets_id_seq
334 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
337 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
341 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
344 CREATE TABLE public.changesets_subscribers (
345 subscriber_id bigint NOT NULL,
346 changeset_id bigint NOT NULL
351 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
354 CREATE TABLE public.client_applications (
356 name character varying,
357 url character varying,
358 support_url character varying,
359 callback_url character varying,
360 key character varying(50),
361 secret character varying(50),
363 created_at timestamp without time zone,
364 updated_at timestamp without time zone,
365 allow_read_prefs boolean DEFAULT false NOT NULL,
366 allow_write_prefs boolean DEFAULT false NOT NULL,
367 allow_write_diary boolean DEFAULT false NOT NULL,
368 allow_write_api boolean DEFAULT false NOT NULL,
369 allow_read_gpx boolean DEFAULT false NOT NULL,
370 allow_write_gpx boolean DEFAULT false NOT NULL,
371 allow_write_notes boolean DEFAULT false NOT NULL
376 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
379 CREATE SEQUENCE public.client_applications_id_seq
389 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
392 ALTER SEQUENCE public.client_applications_id_seq OWNED BY public.client_applications.id;
396 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
399 CREATE TABLE public.current_node_tags (
400 node_id bigint NOT NULL,
401 k character varying DEFAULT ''::character varying NOT NULL,
402 v character varying DEFAULT ''::character varying NOT NULL
407 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
410 CREATE TABLE public.current_nodes (
412 latitude integer NOT NULL,
413 longitude integer NOT NULL,
414 changeset_id bigint NOT NULL,
415 visible boolean NOT NULL,
416 "timestamp" timestamp without time zone NOT NULL,
417 tile bigint NOT NULL,
418 version bigint NOT NULL
423 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
426 CREATE SEQUENCE public.current_nodes_id_seq
435 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
438 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
442 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
445 CREATE TABLE public.current_relation_members (
446 relation_id bigint NOT NULL,
447 member_type public.nwr_enum NOT NULL,
448 member_id bigint NOT NULL,
449 member_role character varying NOT NULL,
450 sequence_id integer DEFAULT 0 NOT NULL
455 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
458 CREATE TABLE public.current_relation_tags (
459 relation_id bigint NOT NULL,
460 k character varying DEFAULT ''::character varying NOT NULL,
461 v character varying DEFAULT ''::character varying NOT NULL
466 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
469 CREATE TABLE public.current_relations (
471 changeset_id bigint NOT NULL,
472 "timestamp" timestamp without time zone NOT NULL,
473 visible boolean NOT NULL,
474 version bigint NOT NULL
479 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
482 CREATE SEQUENCE public.current_relations_id_seq
491 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
494 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
498 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
501 CREATE TABLE public.current_way_nodes (
502 way_id bigint NOT NULL,
503 node_id bigint NOT NULL,
504 sequence_id bigint NOT NULL
509 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
512 CREATE TABLE public.current_way_tags (
513 way_id bigint NOT NULL,
514 k character varying DEFAULT ''::character varying NOT NULL,
515 v character varying DEFAULT ''::character varying NOT NULL
520 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
523 CREATE TABLE public.current_ways (
525 changeset_id bigint NOT NULL,
526 "timestamp" timestamp without time zone NOT NULL,
527 visible boolean NOT NULL,
528 version bigint NOT NULL
533 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
536 CREATE SEQUENCE public.current_ways_id_seq
545 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
548 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
552 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
555 CREATE TABLE public.delayed_jobs (
557 priority integer DEFAULT 0 NOT NULL,
558 attempts integer DEFAULT 0 NOT NULL,
559 handler text NOT NULL,
561 run_at timestamp without time zone,
562 locked_at timestamp without time zone,
563 failed_at timestamp without time zone,
564 locked_by character varying,
565 queue character varying,
566 created_at timestamp without time zone,
567 updated_at timestamp without time zone
572 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
575 CREATE SEQUENCE public.delayed_jobs_id_seq
584 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
587 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
591 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
594 CREATE TABLE public.diary_comments (
596 diary_entry_id bigint NOT NULL,
597 user_id bigint NOT NULL,
599 created_at timestamp without time zone NOT NULL,
600 updated_at timestamp without time zone NOT NULL,
601 visible boolean DEFAULT true NOT NULL,
602 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
607 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
610 CREATE SEQUENCE public.diary_comments_id_seq
619 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
622 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
626 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
629 CREATE TABLE public.diary_entries (
631 user_id bigint NOT NULL,
632 title character varying NOT NULL,
634 created_at timestamp without time zone NOT NULL,
635 updated_at timestamp without time zone NOT NULL,
636 latitude double precision,
637 longitude double precision,
638 language_code character varying DEFAULT 'en'::character varying NOT NULL,
639 visible boolean DEFAULT true NOT NULL,
640 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
645 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
648 CREATE SEQUENCE public.diary_entries_id_seq
657 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
660 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
664 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
667 CREATE TABLE public.diary_entry_subscriptions (
668 user_id bigint NOT NULL,
669 diary_entry_id bigint NOT NULL
674 -- Name: friends; Type: TABLE; Schema: public; Owner: -
677 CREATE TABLE public.friends (
679 user_id bigint NOT NULL,
680 friend_user_id bigint NOT NULL,
681 created_at timestamp without time zone
686 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
689 CREATE SEQUENCE public.friends_id_seq
698 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
701 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
705 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
708 CREATE TABLE public.gps_points (
709 altitude double precision,
710 trackid integer NOT NULL,
711 latitude integer NOT NULL,
712 longitude integer NOT NULL,
713 gpx_id bigint NOT NULL,
714 "timestamp" timestamp without time zone,
720 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
723 CREATE TABLE public.gpx_file_tags (
724 gpx_id bigint NOT NULL,
725 tag character varying NOT NULL,
731 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
734 CREATE SEQUENCE public.gpx_file_tags_id_seq
743 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
746 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
750 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
753 CREATE TABLE public.gpx_files (
755 user_id bigint NOT NULL,
756 visible boolean DEFAULT true NOT NULL,
757 name character varying DEFAULT ''::character varying NOT NULL,
759 latitude double precision,
760 longitude double precision,
761 "timestamp" timestamp without time zone NOT NULL,
762 description character varying DEFAULT ''::character varying NOT NULL,
763 inserted boolean NOT NULL,
764 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
769 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
772 CREATE SEQUENCE public.gpx_files_id_seq
781 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
784 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
788 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
791 CREATE TABLE public.issue_comments (
793 issue_id integer NOT NULL,
794 user_id integer NOT NULL,
796 created_at timestamp without time zone NOT NULL,
797 updated_at timestamp without time zone NOT NULL
802 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
805 CREATE SEQUENCE public.issue_comments_id_seq
815 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
818 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
822 -- Name: issues; Type: TABLE; Schema: public; Owner: -
825 CREATE TABLE public.issues (
827 reportable_type character varying NOT NULL,
828 reportable_id integer NOT NULL,
829 reported_user_id integer,
830 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
831 assigned_role public.user_role_enum NOT NULL,
832 resolved_at timestamp without time zone,
835 reports_count integer DEFAULT 0,
836 created_at timestamp without time zone NOT NULL,
837 updated_at timestamp without time zone NOT NULL
842 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
845 CREATE SEQUENCE public.issues_id_seq
855 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
858 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
862 -- Name: languages; Type: TABLE; Schema: public; Owner: -
865 CREATE TABLE public.languages (
866 code character varying NOT NULL,
867 english_name character varying NOT NULL,
868 native_name character varying
873 -- Name: messages; Type: TABLE; Schema: public; Owner: -
876 CREATE TABLE public.messages (
878 from_user_id bigint NOT NULL,
879 title character varying NOT NULL,
881 sent_on timestamp without time zone NOT NULL,
882 message_read boolean DEFAULT false NOT NULL,
883 to_user_id bigint NOT NULL,
884 to_user_visible boolean DEFAULT true NOT NULL,
885 from_user_visible boolean DEFAULT true NOT NULL,
886 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
891 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
894 CREATE SEQUENCE public.messages_id_seq
903 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
906 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
910 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
913 CREATE TABLE public.node_tags (
914 node_id bigint NOT NULL,
915 version bigint NOT NULL,
916 k character varying DEFAULT ''::character varying NOT NULL,
917 v character varying DEFAULT ''::character varying NOT NULL
922 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
925 CREATE TABLE public.nodes (
926 node_id bigint NOT NULL,
927 latitude integer NOT NULL,
928 longitude integer NOT NULL,
929 changeset_id bigint NOT NULL,
930 visible boolean NOT NULL,
931 "timestamp" timestamp without time zone NOT NULL,
932 tile bigint NOT NULL,
933 version bigint NOT NULL,
939 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
942 CREATE TABLE public.note_comments (
944 note_id bigint NOT NULL,
945 visible boolean NOT NULL,
946 created_at timestamp without time zone NOT NULL,
950 event public.note_event_enum
955 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
958 CREATE SEQUENCE public.note_comments_id_seq
968 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
971 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
975 -- Name: notes; Type: TABLE; Schema: public; Owner: -
978 CREATE TABLE public.notes (
980 latitude integer NOT NULL,
981 longitude integer NOT NULL,
982 tile bigint NOT NULL,
983 updated_at timestamp without time zone NOT NULL,
984 created_at timestamp without time zone NOT NULL,
985 status public.note_status_enum NOT NULL,
986 closed_at timestamp without time zone
991 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
994 CREATE SEQUENCE public.notes_id_seq
1004 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1007 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
1011 -- Name: oauth_access_grants; Type: TABLE; Schema: public; Owner: -
1014 CREATE TABLE public.oauth_access_grants (
1016 resource_owner_id bigint NOT NULL,
1017 application_id bigint NOT NULL,
1018 token character varying NOT NULL,
1019 expires_in integer NOT NULL,
1020 redirect_uri text NOT NULL,
1021 created_at timestamp without time zone NOT NULL,
1022 revoked_at timestamp without time zone,
1023 scopes character varying DEFAULT ''::character varying NOT NULL,
1024 code_challenge character varying,
1025 code_challenge_method character varying
1030 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1033 CREATE SEQUENCE public.oauth_access_grants_id_seq
1042 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1045 ALTER SEQUENCE public.oauth_access_grants_id_seq OWNED BY public.oauth_access_grants.id;
1049 -- Name: oauth_access_tokens; Type: TABLE; Schema: public; Owner: -
1052 CREATE TABLE public.oauth_access_tokens (
1054 resource_owner_id bigint,
1055 application_id bigint NOT NULL,
1056 token character varying NOT NULL,
1057 refresh_token character varying,
1059 revoked_at timestamp without time zone,
1060 created_at timestamp without time zone NOT NULL,
1061 scopes character varying,
1062 previous_refresh_token character varying DEFAULT ''::character varying NOT NULL
1067 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1070 CREATE SEQUENCE public.oauth_access_tokens_id_seq
1079 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1082 ALTER SEQUENCE public.oauth_access_tokens_id_seq OWNED BY public.oauth_access_tokens.id;
1086 -- Name: oauth_applications; Type: TABLE; Schema: public; Owner: -
1089 CREATE TABLE public.oauth_applications (
1091 owner_type character varying NOT NULL,
1092 owner_id bigint NOT NULL,
1093 name character varying NOT NULL,
1094 uid character varying NOT NULL,
1095 secret character varying NOT NULL,
1096 redirect_uri text NOT NULL,
1097 scopes character varying DEFAULT ''::character varying NOT NULL,
1098 confidential boolean DEFAULT true NOT NULL,
1099 created_at timestamp(6) without time zone NOT NULL,
1100 updated_at timestamp(6) without time zone NOT NULL
1105 -- Name: oauth_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1108 CREATE SEQUENCE public.oauth_applications_id_seq
1117 -- Name: oauth_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1120 ALTER SEQUENCE public.oauth_applications_id_seq OWNED BY public.oauth_applications.id;
1124 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
1127 CREATE TABLE public.oauth_nonces (
1129 nonce character varying,
1130 "timestamp" integer,
1131 created_at timestamp without time zone,
1132 updated_at timestamp without time zone
1137 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1140 CREATE SEQUENCE public.oauth_nonces_id_seq
1150 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1153 ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id;
1157 -- Name: oauth_openid_requests; Type: TABLE; Schema: public; Owner: -
1160 CREATE TABLE public.oauth_openid_requests (
1162 access_grant_id bigint NOT NULL,
1163 nonce character varying NOT NULL
1168 -- Name: oauth_openid_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1171 CREATE SEQUENCE public.oauth_openid_requests_id_seq
1180 -- Name: oauth_openid_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1183 ALTER SEQUENCE public.oauth_openid_requests_id_seq OWNED BY public.oauth_openid_requests.id;
1187 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
1190 CREATE TABLE public.oauth_tokens (
1191 id integer NOT NULL,
1193 type character varying(20),
1194 client_application_id integer,
1195 token character varying(50),
1196 secret character varying(50),
1197 authorized_at timestamp without time zone,
1198 invalidated_at timestamp without time zone,
1199 created_at timestamp without time zone,
1200 updated_at timestamp without time zone,
1201 allow_read_prefs boolean DEFAULT false NOT NULL,
1202 allow_write_prefs boolean DEFAULT false NOT NULL,
1203 allow_write_diary boolean DEFAULT false NOT NULL,
1204 allow_write_api boolean DEFAULT false NOT NULL,
1205 allow_read_gpx boolean DEFAULT false NOT NULL,
1206 allow_write_gpx boolean DEFAULT false NOT NULL,
1207 callback_url character varying,
1208 verifier character varying(20),
1209 scope character varying,
1210 valid_to timestamp without time zone,
1211 allow_write_notes boolean DEFAULT false NOT NULL
1216 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1219 CREATE SEQUENCE public.oauth_tokens_id_seq
1229 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1232 ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
1236 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1239 CREATE TABLE public.redactions (
1240 id integer NOT NULL,
1241 title character varying,
1243 created_at timestamp without time zone,
1244 updated_at timestamp without time zone,
1245 user_id bigint NOT NULL,
1246 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1251 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1254 CREATE SEQUENCE public.redactions_id_seq
1264 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1267 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1271 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1274 CREATE TABLE public.relation_members (
1275 relation_id bigint NOT NULL,
1276 member_type public.nwr_enum NOT NULL,
1277 member_id bigint NOT NULL,
1278 member_role character varying NOT NULL,
1279 version bigint DEFAULT 0 NOT NULL,
1280 sequence_id integer DEFAULT 0 NOT NULL
1285 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1288 CREATE TABLE public.relation_tags (
1289 relation_id bigint NOT NULL,
1290 k character varying DEFAULT ''::character varying NOT NULL,
1291 v character varying DEFAULT ''::character varying NOT NULL,
1292 version bigint NOT NULL
1297 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1300 CREATE TABLE public.relations (
1301 relation_id bigint NOT NULL,
1302 changeset_id bigint NOT NULL,
1303 "timestamp" timestamp without time zone NOT NULL,
1304 version bigint NOT NULL,
1305 visible boolean DEFAULT true NOT NULL,
1306 redaction_id integer
1311 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1314 CREATE TABLE public.reports (
1315 id integer NOT NULL,
1316 issue_id integer NOT NULL,
1317 user_id integer NOT NULL,
1318 details text NOT NULL,
1319 category character varying NOT NULL,
1320 created_at timestamp without time zone NOT NULL,
1321 updated_at timestamp without time zone NOT NULL
1326 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1329 CREATE SEQUENCE public.reports_id_seq
1339 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1342 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1346 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1349 CREATE TABLE public.schema_migrations (
1350 version character varying NOT NULL
1355 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1358 CREATE TABLE public.user_blocks (
1359 id integer NOT NULL,
1360 user_id bigint NOT NULL,
1361 creator_id bigint NOT NULL,
1362 reason text NOT NULL,
1363 ends_at timestamp without time zone NOT NULL,
1364 needs_view boolean DEFAULT false NOT NULL,
1366 created_at timestamp without time zone,
1367 updated_at timestamp without time zone,
1368 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1373 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1376 CREATE SEQUENCE public.user_blocks_id_seq
1386 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1389 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1393 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1396 CREATE TABLE public.user_preferences (
1397 user_id bigint NOT NULL,
1398 k character varying NOT NULL,
1399 v character varying NOT NULL
1404 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1407 CREATE TABLE public.user_roles (
1408 id integer NOT NULL,
1409 user_id bigint NOT NULL,
1410 role public.user_role_enum NOT NULL,
1411 created_at timestamp without time zone,
1412 updated_at timestamp without time zone,
1413 granter_id bigint NOT NULL
1418 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1421 CREATE SEQUENCE public.user_roles_id_seq
1431 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1434 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1438 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1441 CREATE TABLE public.user_tokens (
1443 user_id bigint NOT NULL,
1444 token character varying NOT NULL,
1445 expiry timestamp without time zone NOT NULL,
1451 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1454 CREATE SEQUENCE public.user_tokens_id_seq
1463 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1466 ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id;
1470 -- Name: users; Type: TABLE; Schema: public; Owner: -
1473 CREATE TABLE public.users (
1474 email character varying NOT NULL,
1476 pass_crypt character varying NOT NULL,
1477 creation_time timestamp without time zone NOT NULL,
1478 display_name character varying DEFAULT ''::character varying NOT NULL,
1479 data_public boolean DEFAULT false NOT NULL,
1480 description text DEFAULT ''::text NOT NULL,
1481 home_lat double precision,
1482 home_lon double precision,
1483 home_zoom smallint DEFAULT 3,
1484 pass_salt character varying,
1485 email_valid boolean DEFAULT false NOT NULL,
1486 new_email character varying,
1487 creation_ip character varying,
1488 languages character varying,
1489 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1490 terms_agreed timestamp without time zone,
1491 consider_pd boolean DEFAULT false NOT NULL,
1492 auth_uid character varying,
1493 preferred_editor character varying,
1494 terms_seen boolean DEFAULT false NOT NULL,
1495 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1496 changesets_count integer DEFAULT 0 NOT NULL,
1497 traces_count integer DEFAULT 0 NOT NULL,
1498 diary_entries_count integer DEFAULT 0 NOT NULL,
1499 image_use_gravatar boolean DEFAULT false NOT NULL,
1500 auth_provider character varying,
1502 tou_agreed timestamp without time zone
1507 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1510 CREATE SEQUENCE public.users_id_seq
1519 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1522 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1526 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1529 CREATE TABLE public.way_nodes (
1530 way_id bigint NOT NULL,
1531 node_id bigint NOT NULL,
1532 version bigint NOT NULL,
1533 sequence_id bigint NOT NULL
1538 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1541 CREATE TABLE public.way_tags (
1542 way_id bigint NOT NULL,
1543 k character varying NOT NULL,
1544 v character varying NOT NULL,
1545 version bigint NOT NULL
1550 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1553 CREATE TABLE public.ways (
1554 way_id bigint NOT NULL,
1555 changeset_id bigint NOT NULL,
1556 "timestamp" timestamp without time zone NOT NULL,
1557 version bigint NOT NULL,
1558 visible boolean DEFAULT true NOT NULL,
1559 redaction_id integer
1564 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1567 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1571 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1574 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1578 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1581 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1585 -- Name: active_storage_variant_records id; Type: DEFAULT; Schema: public; Owner: -
1588 ALTER TABLE ONLY public.active_storage_variant_records ALTER COLUMN id SET DEFAULT nextval('public.active_storage_variant_records_id_seq'::regclass);
1592 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1595 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1599 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1602 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1606 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1609 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1613 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1616 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1620 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1623 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1627 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1630 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1634 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1637 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1641 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1644 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1648 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1651 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1655 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1658 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1662 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1665 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1669 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1672 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1676 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1679 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1683 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1686 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1690 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1693 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1697 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1700 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1704 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1707 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1711 -- Name: oauth_access_grants id; Type: DEFAULT; Schema: public; Owner: -
1714 ALTER TABLE ONLY public.oauth_access_grants ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_grants_id_seq'::regclass);
1718 -- Name: oauth_access_tokens id; Type: DEFAULT; Schema: public; Owner: -
1721 ALTER TABLE ONLY public.oauth_access_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_tokens_id_seq'::regclass);
1725 -- Name: oauth_applications id; Type: DEFAULT; Schema: public; Owner: -
1728 ALTER TABLE ONLY public.oauth_applications ALTER COLUMN id SET DEFAULT nextval('public.oauth_applications_id_seq'::regclass);
1732 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1735 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1739 -- Name: oauth_openid_requests id; Type: DEFAULT; Schema: public; Owner: -
1742 ALTER TABLE ONLY public.oauth_openid_requests ALTER COLUMN id SET DEFAULT nextval('public.oauth_openid_requests_id_seq'::regclass);
1746 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1749 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1753 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1756 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1760 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1763 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1767 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1770 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1774 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1777 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1781 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1784 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1788 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1791 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1795 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1798 ALTER TABLE ONLY public.acls
1799 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1803 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1806 ALTER TABLE ONLY public.active_storage_attachments
1807 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1811 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1814 ALTER TABLE ONLY public.active_storage_blobs
1815 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1819 -- Name: active_storage_variant_records active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1822 ALTER TABLE ONLY public.active_storage_variant_records
1823 ADD CONSTRAINT active_storage_variant_records_pkey PRIMARY KEY (id);
1827 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1830 ALTER TABLE ONLY public.ar_internal_metadata
1831 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1835 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1838 ALTER TABLE ONLY public.changeset_comments
1839 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1843 -- Name: changeset_tags changeset_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1846 ALTER TABLE ONLY public.changeset_tags
1847 ADD CONSTRAINT changeset_tags_pkey PRIMARY KEY (changeset_id, k);
1851 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1854 ALTER TABLE ONLY public.changesets
1855 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1859 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1862 ALTER TABLE ONLY public.client_applications
1863 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1867 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1870 ALTER TABLE ONLY public.current_node_tags
1871 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1875 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1878 ALTER TABLE ONLY public.current_nodes
1879 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1883 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1886 ALTER TABLE ONLY public.current_relation_members
1887 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, sequence_id);
1891 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1894 ALTER TABLE ONLY public.current_relation_tags
1895 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1899 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1902 ALTER TABLE ONLY public.current_relations
1903 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1907 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1910 ALTER TABLE ONLY public.current_way_nodes
1911 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1915 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1918 ALTER TABLE ONLY public.current_way_tags
1919 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1923 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1926 ALTER TABLE ONLY public.current_ways
1927 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1931 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1934 ALTER TABLE ONLY public.delayed_jobs
1935 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1939 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1942 ALTER TABLE ONLY public.diary_comments
1943 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1947 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1950 ALTER TABLE ONLY public.diary_entries
1951 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1955 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1958 ALTER TABLE ONLY public.diary_entry_subscriptions
1959 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1963 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1966 ALTER TABLE ONLY public.friends
1967 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1971 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1974 ALTER TABLE ONLY public.gpx_file_tags
1975 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1979 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1982 ALTER TABLE ONLY public.gpx_files
1983 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1987 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1990 ALTER TABLE ONLY public.issue_comments
1991 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1995 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1998 ALTER TABLE ONLY public.issues
1999 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
2003 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2006 ALTER TABLE ONLY public.languages
2007 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
2011 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2014 ALTER TABLE ONLY public.messages
2015 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
2019 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2022 ALTER TABLE ONLY public.node_tags
2023 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
2027 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2030 ALTER TABLE ONLY public.nodes
2031 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
2035 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2038 ALTER TABLE ONLY public.note_comments
2039 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
2043 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2046 ALTER TABLE ONLY public.notes
2047 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
2051 -- Name: oauth_access_grants oauth_access_grants_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2054 ALTER TABLE ONLY public.oauth_access_grants
2055 ADD CONSTRAINT oauth_access_grants_pkey PRIMARY KEY (id);
2059 -- Name: oauth_access_tokens oauth_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2062 ALTER TABLE ONLY public.oauth_access_tokens
2063 ADD CONSTRAINT oauth_access_tokens_pkey PRIMARY KEY (id);
2067 -- Name: oauth_applications oauth_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2070 ALTER TABLE ONLY public.oauth_applications
2071 ADD CONSTRAINT oauth_applications_pkey PRIMARY KEY (id);
2075 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2078 ALTER TABLE ONLY public.oauth_nonces
2079 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
2083 -- Name: oauth_openid_requests oauth_openid_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2086 ALTER TABLE ONLY public.oauth_openid_requests
2087 ADD CONSTRAINT oauth_openid_requests_pkey PRIMARY KEY (id);
2091 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2094 ALTER TABLE ONLY public.oauth_tokens
2095 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
2099 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2102 ALTER TABLE ONLY public.redactions
2103 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
2107 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2110 ALTER TABLE ONLY public.relation_members
2111 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, sequence_id);
2115 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2118 ALTER TABLE ONLY public.relation_tags
2119 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
2123 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2126 ALTER TABLE ONLY public.relations
2127 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
2131 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2134 ALTER TABLE ONLY public.reports
2135 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
2139 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2142 ALTER TABLE ONLY public.schema_migrations
2143 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
2147 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2150 ALTER TABLE ONLY public.user_blocks
2151 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
2155 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2158 ALTER TABLE ONLY public.user_preferences
2159 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
2163 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2166 ALTER TABLE ONLY public.user_roles
2167 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
2171 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2174 ALTER TABLE ONLY public.user_tokens
2175 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
2179 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2182 ALTER TABLE ONLY public.users
2183 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2187 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2190 ALTER TABLE ONLY public.way_nodes
2191 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2195 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2198 ALTER TABLE ONLY public.way_tags
2199 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2203 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2206 ALTER TABLE ONLY public.ways
2207 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2211 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2214 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2218 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2221 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2225 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2228 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2232 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2235 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2239 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2242 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2246 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2249 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2253 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2256 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2260 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2263 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2267 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2270 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2274 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2277 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2281 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2284 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2288 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2291 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2295 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2298 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2302 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2305 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2309 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2312 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2316 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2319 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2323 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2326 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2330 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2333 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2337 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2340 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2344 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2347 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2351 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2354 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2358 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2361 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2365 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2368 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2372 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2375 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2379 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2382 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2386 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2389 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2393 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2396 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2400 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2403 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2407 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2410 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2414 -- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
2417 CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest);
2421 -- Name: index_changeset_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2424 CREATE INDEX index_changeset_comments_on_author_id_and_created_at ON public.changeset_comments USING btree (author_id, created_at);
2428 -- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2431 CREATE INDEX index_changeset_comments_on_changeset_id_and_created_at ON public.changeset_comments USING btree (changeset_id, created_at);
2435 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2438 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2442 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2445 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2449 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2452 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2456 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2459 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2463 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2466 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2470 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2473 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2477 -- Name: index_friends_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2480 CREATE INDEX index_friends_on_user_id_and_created_at ON public.friends USING btree (user_id, created_at);
2484 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2487 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2491 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2494 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2498 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2501 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2505 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2508 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2512 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2515 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2519 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2522 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2526 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2529 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2533 -- Name: index_note_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2536 CREATE INDEX index_note_comments_on_author_id_and_created_at ON public.note_comments USING btree (author_id, created_at);
2540 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2543 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2547 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2550 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2554 -- Name: index_oauth_access_grants_on_application_id; Type: INDEX; Schema: public; Owner: -
2557 CREATE INDEX index_oauth_access_grants_on_application_id ON public.oauth_access_grants USING btree (application_id);
2561 -- Name: index_oauth_access_grants_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2564 CREATE INDEX index_oauth_access_grants_on_resource_owner_id ON public.oauth_access_grants USING btree (resource_owner_id);
2568 -- Name: index_oauth_access_grants_on_token; Type: INDEX; Schema: public; Owner: -
2571 CREATE UNIQUE INDEX index_oauth_access_grants_on_token ON public.oauth_access_grants USING btree (token);
2575 -- Name: index_oauth_access_tokens_on_application_id; Type: INDEX; Schema: public; Owner: -
2578 CREATE INDEX index_oauth_access_tokens_on_application_id ON public.oauth_access_tokens USING btree (application_id);
2582 -- Name: index_oauth_access_tokens_on_refresh_token; Type: INDEX; Schema: public; Owner: -
2585 CREATE UNIQUE INDEX index_oauth_access_tokens_on_refresh_token ON public.oauth_access_tokens USING btree (refresh_token);
2589 -- Name: index_oauth_access_tokens_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2592 CREATE INDEX index_oauth_access_tokens_on_resource_owner_id ON public.oauth_access_tokens USING btree (resource_owner_id);
2596 -- Name: index_oauth_access_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2599 CREATE UNIQUE INDEX index_oauth_access_tokens_on_token ON public.oauth_access_tokens USING btree (token);
2603 -- Name: index_oauth_applications_on_owner_type_and_owner_id; Type: INDEX; Schema: public; Owner: -
2606 CREATE INDEX index_oauth_applications_on_owner_type_and_owner_id ON public.oauth_applications USING btree (owner_type, owner_id);
2610 -- Name: index_oauth_applications_on_uid; Type: INDEX; Schema: public; Owner: -
2613 CREATE UNIQUE INDEX index_oauth_applications_on_uid ON public.oauth_applications USING btree (uid);
2617 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2620 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2624 -- Name: index_oauth_openid_requests_on_access_grant_id; Type: INDEX; Schema: public; Owner: -
2627 CREATE INDEX index_oauth_openid_requests_on_access_grant_id ON public.oauth_openid_requests USING btree (access_grant_id);
2631 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2634 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2638 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2641 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2645 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2648 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2652 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2655 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2659 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2662 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2666 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2669 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2673 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2676 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2680 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2683 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2687 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2690 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2694 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2697 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2701 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2704 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2708 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2711 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2715 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2718 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2722 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2725 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2729 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2732 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2736 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2739 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2743 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2746 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2750 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2753 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2757 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2760 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2764 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2767 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2771 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2774 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2778 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2781 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2785 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2788 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2792 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2795 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2799 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2802 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2806 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2809 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2813 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2816 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2820 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2823 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2827 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2830 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2834 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2837 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2841 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2844 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2848 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2851 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2855 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2858 ALTER TABLE ONLY public.changeset_comments
2859 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2863 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2866 ALTER TABLE ONLY public.changeset_comments
2867 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2871 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2874 ALTER TABLE ONLY public.changeset_tags
2875 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2879 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2882 ALTER TABLE ONLY public.changesets_subscribers
2883 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2887 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2890 ALTER TABLE ONLY public.changesets_subscribers
2891 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2895 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2898 ALTER TABLE ONLY public.changesets
2899 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2903 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2906 ALTER TABLE ONLY public.client_applications
2907 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2911 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2914 ALTER TABLE ONLY public.current_node_tags
2915 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2919 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2922 ALTER TABLE ONLY public.current_nodes
2923 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2927 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2930 ALTER TABLE ONLY public.current_relation_members
2931 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2935 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2938 ALTER TABLE ONLY public.current_relation_tags
2939 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2943 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2946 ALTER TABLE ONLY public.current_relations
2947 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2951 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2954 ALTER TABLE ONLY public.current_way_nodes
2955 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2959 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2962 ALTER TABLE ONLY public.current_way_nodes
2963 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2967 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2970 ALTER TABLE ONLY public.current_way_tags
2971 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2975 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2978 ALTER TABLE ONLY public.current_ways
2979 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2983 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2986 ALTER TABLE ONLY public.diary_comments
2987 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2991 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2994 ALTER TABLE ONLY public.diary_comments
2995 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2999 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3002 ALTER TABLE ONLY public.diary_entries
3003 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
3007 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3010 ALTER TABLE ONLY public.diary_entries
3011 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3015 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3018 ALTER TABLE ONLY public.diary_entry_subscriptions
3019 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
3023 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3026 ALTER TABLE ONLY public.diary_entry_subscriptions
3027 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3031 -- Name: oauth_access_grants fk_rails_330c32d8d9; Type: FK CONSTRAINT; Schema: public; Owner: -
3034 ALTER TABLE ONLY public.oauth_access_grants
3035 ADD CONSTRAINT fk_rails_330c32d8d9 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3039 -- Name: oauth_access_tokens fk_rails_732cb83ab7; Type: FK CONSTRAINT; Schema: public; Owner: -
3042 ALTER TABLE ONLY public.oauth_access_tokens
3043 ADD CONSTRAINT fk_rails_732cb83ab7 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3047 -- Name: oauth_openid_requests fk_rails_77114b3b09; Type: FK CONSTRAINT; Schema: public; Owner: -
3050 ALTER TABLE ONLY public.oauth_openid_requests
3051 ADD CONSTRAINT fk_rails_77114b3b09 FOREIGN KEY (access_grant_id) REFERENCES public.oauth_access_grants(id) ON DELETE CASCADE;
3055 -- Name: active_storage_variant_records fk_rails_993965df05; Type: FK CONSTRAINT; Schema: public; Owner: -
3058 ALTER TABLE ONLY public.active_storage_variant_records
3059 ADD CONSTRAINT fk_rails_993965df05 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3063 -- Name: oauth_access_grants fk_rails_b4b53e07b8; Type: FK CONSTRAINT; Schema: public; Owner: -
3066 ALTER TABLE ONLY public.oauth_access_grants
3067 ADD CONSTRAINT fk_rails_b4b53e07b8 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3071 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
3074 ALTER TABLE ONLY public.active_storage_attachments
3075 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3079 -- Name: oauth_applications fk_rails_cc886e315a; Type: FK CONSTRAINT; Schema: public; Owner: -
3082 ALTER TABLE ONLY public.oauth_applications
3083 ADD CONSTRAINT fk_rails_cc886e315a FOREIGN KEY (owner_id) REFERENCES public.users(id) NOT VALID;
3087 -- Name: oauth_access_tokens fk_rails_ee63f25419; Type: FK CONSTRAINT; Schema: public; Owner: -
3090 ALTER TABLE ONLY public.oauth_access_tokens
3091 ADD CONSTRAINT fk_rails_ee63f25419 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3095 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3098 ALTER TABLE ONLY public.friends
3099 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
3103 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3106 ALTER TABLE ONLY public.friends
3107 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3111 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3114 ALTER TABLE ONLY public.gps_points
3115 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3119 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3122 ALTER TABLE ONLY public.gpx_file_tags
3123 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3127 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3130 ALTER TABLE ONLY public.gpx_files
3131 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3135 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3138 ALTER TABLE ONLY public.issue_comments
3139 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3143 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3146 ALTER TABLE ONLY public.issue_comments
3147 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3151 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3154 ALTER TABLE ONLY public.issues
3155 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
3159 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3162 ALTER TABLE ONLY public.issues
3163 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
3167 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3170 ALTER TABLE ONLY public.issues
3171 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
3175 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3178 ALTER TABLE ONLY public.messages
3179 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
3183 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3186 ALTER TABLE ONLY public.messages
3187 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
3191 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3194 ALTER TABLE ONLY public.node_tags
3195 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
3199 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3202 ALTER TABLE ONLY public.nodes
3203 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3207 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3210 ALTER TABLE ONLY public.nodes
3211 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3215 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3218 ALTER TABLE ONLY public.note_comments
3219 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
3223 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3226 ALTER TABLE ONLY public.note_comments
3227 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
3231 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3234 ALTER TABLE ONLY public.oauth_tokens
3235 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
3239 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3242 ALTER TABLE ONLY public.oauth_tokens
3243 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3247 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3250 ALTER TABLE ONLY public.redactions
3251 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3255 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3258 ALTER TABLE ONLY public.relation_members
3259 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3263 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3266 ALTER TABLE ONLY public.relation_tags
3267 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3271 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3274 ALTER TABLE ONLY public.relations
3275 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3279 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3282 ALTER TABLE ONLY public.relations
3283 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3287 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3290 ALTER TABLE ONLY public.reports
3291 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3295 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3298 ALTER TABLE ONLY public.reports
3299 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3303 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3306 ALTER TABLE ONLY public.user_blocks
3307 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
3311 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3314 ALTER TABLE ONLY public.user_blocks
3315 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
3319 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3322 ALTER TABLE ONLY public.user_blocks
3323 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3327 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3330 ALTER TABLE ONLY public.user_preferences
3331 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3335 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3338 ALTER TABLE ONLY public.user_roles
3339 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3343 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3346 ALTER TABLE ONLY public.user_roles
3347 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3351 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3354 ALTER TABLE ONLY public.user_tokens
3355 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3359 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3362 ALTER TABLE ONLY public.way_nodes
3363 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3367 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3370 ALTER TABLE ONLY public.way_tags
3371 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3375 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3378 ALTER TABLE ONLY public.ways
3379 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3383 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3386 ALTER TABLE ONLY public.ways
3387 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3391 -- PostgreSQL database dump complete
3394 SET search_path TO "$user", public;
3396 INSERT INTO "schema_migrations" (version) VALUES