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 (
112 -- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
115 CREATE FUNCTION public.tile_for_point(scaled_lat integer, scaled_lon integer) RETURNS bigint
116 LANGUAGE plpgsql IMMUTABLE
119 x int8; -- quantized x from lon,
120 y int8; -- quantized y from lat,
122 x := round(((scaled_lon / 10000000.0) + 180.0) * 65535.0 / 360.0);
123 y := round(((scaled_lat / 10000000.0) + 90.0) * 65535.0 / 180.0);
125 -- these bit-masks are special numbers used in the bit interleaving algorithm.
126 -- see https://graphics.stanford.edu/~seander/bithacks.html#InterleaveBMN
127 -- for the original algorithm and more details.
128 x := (x | (x << 8)) & 16711935; -- 0x00FF00FF
129 x := (x | (x << 4)) & 252645135; -- 0x0F0F0F0F
130 x := (x | (x << 2)) & 858993459; -- 0x33333333
131 x := (x | (x << 1)) & 1431655765; -- 0x55555555
133 y := (y | (y << 8)) & 16711935; -- 0x00FF00FF
134 y := (y | (y << 4)) & 252645135; -- 0x0F0F0F0F
135 y := (y | (y << 2)) & 858993459; -- 0x33333333
136 y := (y | (y << 1)) & 1431655765; -- 0x55555555
143 SET default_tablespace = '';
145 SET default_table_access_method = heap;
148 -- Name: acls; Type: TABLE; Schema: public; Owner: -
151 CREATE TABLE public.acls (
154 k character varying NOT NULL,
156 domain character varying,
162 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
165 CREATE SEQUENCE public.acls_id_seq
174 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
177 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
181 -- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
184 CREATE TABLE public.active_storage_attachments (
186 name character varying NOT NULL,
187 record_type character varying NOT NULL,
188 record_id bigint NOT NULL,
189 blob_id bigint NOT NULL,
190 created_at timestamp without time zone NOT NULL
195 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
198 CREATE SEQUENCE public.active_storage_attachments_id_seq
207 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
210 ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
214 -- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
217 CREATE TABLE public.active_storage_blobs (
219 key character varying NOT NULL,
220 filename character varying NOT NULL,
221 content_type character varying,
223 byte_size bigint NOT NULL,
224 checksum character varying,
225 created_at timestamp without time zone NOT NULL,
226 service_name character varying NOT NULL
231 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
234 CREATE SEQUENCE public.active_storage_blobs_id_seq
243 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
246 ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
250 -- Name: active_storage_variant_records; Type: TABLE; Schema: public; Owner: -
253 CREATE TABLE public.active_storage_variant_records (
255 blob_id bigint NOT NULL,
256 variation_digest character varying NOT NULL
261 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE; Schema: public; Owner: -
264 CREATE SEQUENCE public.active_storage_variant_records_id_seq
273 -- Name: active_storage_variant_records_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
276 ALTER SEQUENCE public.active_storage_variant_records_id_seq OWNED BY public.active_storage_variant_records.id;
280 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
283 CREATE TABLE public.ar_internal_metadata (
284 key character varying NOT NULL,
285 value character varying,
286 created_at timestamp(6) without time zone NOT NULL,
287 updated_at timestamp(6) without time zone NOT NULL
292 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
295 CREATE TABLE public.changeset_comments (
297 changeset_id bigint NOT NULL,
298 author_id bigint NOT NULL,
300 created_at timestamp without time zone NOT NULL,
301 visible boolean NOT NULL
306 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
309 CREATE SEQUENCE public.changeset_comments_id_seq
319 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
322 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
326 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
329 CREATE TABLE public.changeset_tags (
330 changeset_id bigint NOT NULL,
331 k character varying DEFAULT ''::character varying NOT NULL,
332 v character varying DEFAULT ''::character varying NOT NULL
337 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
340 CREATE TABLE public.changesets (
342 user_id bigint NOT NULL,
343 created_at timestamp without time zone NOT NULL,
348 closed_at timestamp without time zone NOT NULL,
349 num_changes integer DEFAULT 0 NOT NULL
354 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
357 CREATE SEQUENCE public.changesets_id_seq
366 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
369 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
373 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
376 CREATE TABLE public.changesets_subscribers (
377 subscriber_id bigint NOT NULL,
378 changeset_id bigint NOT NULL
383 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
386 CREATE TABLE public.client_applications (
388 name character varying,
389 url character varying,
390 support_url character varying,
391 callback_url character varying,
392 key character varying(50),
393 secret character varying(50),
395 created_at timestamp without time zone,
396 updated_at timestamp without time zone,
397 allow_read_prefs boolean DEFAULT false NOT NULL,
398 allow_write_prefs boolean DEFAULT false NOT NULL,
399 allow_write_diary boolean DEFAULT false NOT NULL,
400 allow_write_api boolean DEFAULT false NOT NULL,
401 allow_read_gpx boolean DEFAULT false NOT NULL,
402 allow_write_gpx boolean DEFAULT false NOT NULL,
403 allow_write_notes boolean DEFAULT false NOT NULL
408 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
411 CREATE SEQUENCE public.client_applications_id_seq
421 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
424 ALTER SEQUENCE public.client_applications_id_seq OWNED BY public.client_applications.id;
428 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
431 CREATE TABLE public.current_node_tags (
432 node_id bigint NOT NULL,
433 k character varying DEFAULT ''::character varying NOT NULL,
434 v character varying DEFAULT ''::character varying NOT NULL
439 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
442 CREATE TABLE public.current_nodes (
444 latitude integer NOT NULL,
445 longitude integer NOT NULL,
446 changeset_id bigint NOT NULL,
447 visible boolean NOT NULL,
448 "timestamp" timestamp without time zone NOT NULL,
449 tile bigint NOT NULL,
450 version bigint NOT NULL
455 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
458 CREATE SEQUENCE public.current_nodes_id_seq
467 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
470 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
474 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
477 CREATE TABLE public.current_relation_members (
478 relation_id bigint NOT NULL,
479 member_type public.nwr_enum NOT NULL,
480 member_id bigint NOT NULL,
481 member_role character varying NOT NULL,
482 sequence_id integer DEFAULT 0 NOT NULL
487 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
490 CREATE TABLE public.current_relation_tags (
491 relation_id bigint NOT NULL,
492 k character varying DEFAULT ''::character varying NOT NULL,
493 v character varying DEFAULT ''::character varying NOT NULL
498 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
501 CREATE TABLE public.current_relations (
503 changeset_id bigint NOT NULL,
504 "timestamp" timestamp without time zone NOT NULL,
505 visible boolean NOT NULL,
506 version bigint NOT NULL
511 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
514 CREATE SEQUENCE public.current_relations_id_seq
523 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
526 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
530 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
533 CREATE TABLE public.current_way_nodes (
534 way_id bigint NOT NULL,
535 node_id bigint NOT NULL,
536 sequence_id bigint NOT NULL
541 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
544 CREATE TABLE public.current_way_tags (
545 way_id bigint NOT NULL,
546 k character varying DEFAULT ''::character varying NOT NULL,
547 v character varying DEFAULT ''::character varying NOT NULL
552 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
555 CREATE TABLE public.current_ways (
557 changeset_id bigint NOT NULL,
558 "timestamp" timestamp without time zone NOT NULL,
559 visible boolean NOT NULL,
560 version bigint NOT NULL
565 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
568 CREATE SEQUENCE public.current_ways_id_seq
577 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
580 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
584 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
587 CREATE TABLE public.delayed_jobs (
589 priority integer DEFAULT 0 NOT NULL,
590 attempts integer DEFAULT 0 NOT NULL,
591 handler text NOT NULL,
593 run_at timestamp without time zone,
594 locked_at timestamp without time zone,
595 failed_at timestamp without time zone,
596 locked_by character varying,
597 queue character varying,
598 created_at timestamp without time zone,
599 updated_at timestamp without time zone
604 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
607 CREATE SEQUENCE public.delayed_jobs_id_seq
616 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
619 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
623 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
626 CREATE TABLE public.diary_comments (
628 diary_entry_id bigint NOT NULL,
629 user_id bigint NOT NULL,
631 created_at timestamp without time zone NOT NULL,
632 updated_at timestamp without time zone NOT NULL,
633 visible boolean DEFAULT true NOT NULL,
634 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
639 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
642 CREATE SEQUENCE public.diary_comments_id_seq
651 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
654 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
658 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
661 CREATE TABLE public.diary_entries (
663 user_id bigint NOT NULL,
664 title character varying NOT NULL,
666 created_at timestamp without time zone NOT NULL,
667 updated_at timestamp without time zone NOT NULL,
668 latitude double precision,
669 longitude double precision,
670 language_code character varying DEFAULT 'en'::character varying NOT NULL,
671 visible boolean DEFAULT true NOT NULL,
672 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
677 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
680 CREATE SEQUENCE public.diary_entries_id_seq
689 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
692 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
696 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
699 CREATE TABLE public.diary_entry_subscriptions (
700 user_id bigint NOT NULL,
701 diary_entry_id bigint NOT NULL
706 -- Name: friends; Type: TABLE; Schema: public; Owner: -
709 CREATE TABLE public.friends (
711 user_id bigint NOT NULL,
712 friend_user_id bigint NOT NULL,
713 created_at timestamp without time zone
718 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
721 CREATE SEQUENCE public.friends_id_seq
730 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
733 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
737 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
740 CREATE TABLE public.gps_points (
741 altitude double precision,
742 trackid integer NOT NULL,
743 latitude integer NOT NULL,
744 longitude integer NOT NULL,
745 gpx_id bigint NOT NULL,
746 "timestamp" timestamp without time zone,
752 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
755 CREATE TABLE public.gpx_file_tags (
756 gpx_id bigint NOT NULL,
757 tag character varying NOT NULL,
763 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
766 CREATE SEQUENCE public.gpx_file_tags_id_seq
775 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
778 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
782 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
785 CREATE TABLE public.gpx_files (
787 user_id bigint NOT NULL,
788 visible boolean DEFAULT true NOT NULL,
789 name character varying DEFAULT ''::character varying NOT NULL,
791 latitude double precision,
792 longitude double precision,
793 "timestamp" timestamp without time zone NOT NULL,
794 description character varying DEFAULT ''::character varying NOT NULL,
795 inserted boolean NOT NULL,
796 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
801 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
804 CREATE SEQUENCE public.gpx_files_id_seq
813 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
816 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
820 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
823 CREATE TABLE public.issue_comments (
825 issue_id integer NOT NULL,
826 user_id integer NOT NULL,
828 created_at timestamp without time zone NOT NULL,
829 updated_at timestamp without time zone NOT NULL
834 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
837 CREATE SEQUENCE public.issue_comments_id_seq
847 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
850 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
854 -- Name: issues; Type: TABLE; Schema: public; Owner: -
857 CREATE TABLE public.issues (
859 reportable_type character varying NOT NULL,
860 reportable_id integer NOT NULL,
861 reported_user_id integer,
862 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
863 assigned_role public.user_role_enum NOT NULL,
864 resolved_at timestamp without time zone,
867 reports_count integer DEFAULT 0,
868 created_at timestamp without time zone NOT NULL,
869 updated_at timestamp without time zone NOT NULL
874 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
877 CREATE SEQUENCE public.issues_id_seq
887 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
890 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
894 -- Name: languages; Type: TABLE; Schema: public; Owner: -
897 CREATE TABLE public.languages (
898 code character varying NOT NULL,
899 english_name character varying NOT NULL,
900 native_name character varying
905 -- Name: messages; Type: TABLE; Schema: public; Owner: -
908 CREATE TABLE public.messages (
910 from_user_id bigint NOT NULL,
911 title character varying NOT NULL,
913 sent_on timestamp without time zone NOT NULL,
914 message_read boolean DEFAULT false NOT NULL,
915 to_user_id bigint NOT NULL,
916 to_user_visible boolean DEFAULT true NOT NULL,
917 from_user_visible boolean DEFAULT true NOT NULL,
918 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
923 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
926 CREATE SEQUENCE public.messages_id_seq
935 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
938 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
942 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
945 CREATE TABLE public.node_tags (
946 node_id bigint NOT NULL,
947 version bigint NOT NULL,
948 k character varying DEFAULT ''::character varying NOT NULL,
949 v character varying DEFAULT ''::character varying NOT NULL
954 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
957 CREATE TABLE public.nodes (
958 node_id bigint NOT NULL,
959 latitude integer NOT NULL,
960 longitude integer NOT NULL,
961 changeset_id bigint NOT NULL,
962 visible boolean NOT NULL,
963 "timestamp" timestamp without time zone NOT NULL,
964 tile bigint NOT NULL,
965 version bigint NOT NULL,
971 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
974 CREATE TABLE public.note_comments (
976 note_id bigint NOT NULL,
977 visible boolean NOT NULL,
978 created_at timestamp without time zone NOT NULL,
982 event public.note_event_enum
987 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
990 CREATE SEQUENCE public.note_comments_id_seq
1000 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1003 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
1007 -- Name: notes; Type: TABLE; Schema: public; Owner: -
1010 CREATE TABLE public.notes (
1012 latitude integer NOT NULL,
1013 longitude integer NOT NULL,
1014 tile bigint NOT NULL,
1015 updated_at timestamp without time zone NOT NULL,
1016 created_at timestamp without time zone NOT NULL,
1017 status public.note_status_enum NOT NULL,
1018 closed_at timestamp without time zone
1023 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1026 CREATE SEQUENCE public.notes_id_seq
1036 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1039 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
1043 -- Name: oauth_access_grants; Type: TABLE; Schema: public; Owner: -
1046 CREATE TABLE public.oauth_access_grants (
1048 resource_owner_id bigint NOT NULL,
1049 application_id bigint NOT NULL,
1050 token character varying NOT NULL,
1051 expires_in integer NOT NULL,
1052 redirect_uri text NOT NULL,
1053 created_at timestamp without time zone NOT NULL,
1054 revoked_at timestamp without time zone,
1055 scopes character varying DEFAULT ''::character varying NOT NULL,
1056 code_challenge character varying,
1057 code_challenge_method character varying
1062 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1065 CREATE SEQUENCE public.oauth_access_grants_id_seq
1074 -- Name: oauth_access_grants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1077 ALTER SEQUENCE public.oauth_access_grants_id_seq OWNED BY public.oauth_access_grants.id;
1081 -- Name: oauth_access_tokens; Type: TABLE; Schema: public; Owner: -
1084 CREATE TABLE public.oauth_access_tokens (
1086 resource_owner_id bigint,
1087 application_id bigint NOT NULL,
1088 token character varying NOT NULL,
1089 refresh_token character varying,
1091 revoked_at timestamp without time zone,
1092 created_at timestamp without time zone NOT NULL,
1093 scopes character varying,
1094 previous_refresh_token character varying DEFAULT ''::character varying NOT NULL
1099 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1102 CREATE SEQUENCE public.oauth_access_tokens_id_seq
1111 -- Name: oauth_access_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1114 ALTER SEQUENCE public.oauth_access_tokens_id_seq OWNED BY public.oauth_access_tokens.id;
1118 -- Name: oauth_applications; Type: TABLE; Schema: public; Owner: -
1121 CREATE TABLE public.oauth_applications (
1123 owner_type character varying NOT NULL,
1124 owner_id bigint NOT NULL,
1125 name character varying NOT NULL,
1126 uid character varying NOT NULL,
1127 secret character varying NOT NULL,
1128 redirect_uri text NOT NULL,
1129 scopes character varying DEFAULT ''::character varying NOT NULL,
1130 confidential boolean DEFAULT true NOT NULL,
1131 created_at timestamp(6) without time zone NOT NULL,
1132 updated_at timestamp(6) without time zone NOT NULL
1137 -- Name: oauth_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1140 CREATE SEQUENCE public.oauth_applications_id_seq
1149 -- Name: oauth_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1152 ALTER SEQUENCE public.oauth_applications_id_seq OWNED BY public.oauth_applications.id;
1156 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
1159 CREATE TABLE public.oauth_nonces (
1161 nonce character varying,
1162 "timestamp" integer,
1163 created_at timestamp without time zone,
1164 updated_at timestamp without time zone
1169 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1172 CREATE SEQUENCE public.oauth_nonces_id_seq
1182 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1185 ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id;
1189 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
1192 CREATE TABLE public.oauth_tokens (
1193 id integer NOT NULL,
1195 type character varying(20),
1196 client_application_id integer,
1197 token character varying(50),
1198 secret character varying(50),
1199 authorized_at timestamp without time zone,
1200 invalidated_at timestamp without time zone,
1201 created_at timestamp without time zone,
1202 updated_at timestamp without time zone,
1203 allow_read_prefs boolean DEFAULT false NOT NULL,
1204 allow_write_prefs boolean DEFAULT false NOT NULL,
1205 allow_write_diary boolean DEFAULT false NOT NULL,
1206 allow_write_api boolean DEFAULT false NOT NULL,
1207 allow_read_gpx boolean DEFAULT false NOT NULL,
1208 allow_write_gpx boolean DEFAULT false NOT NULL,
1209 callback_url character varying,
1210 verifier character varying(20),
1211 scope character varying,
1212 valid_to timestamp without time zone,
1213 allow_write_notes boolean DEFAULT false NOT NULL
1218 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1221 CREATE SEQUENCE public.oauth_tokens_id_seq
1231 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1234 ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
1238 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1241 CREATE TABLE public.redactions (
1242 id integer NOT NULL,
1243 title character varying,
1245 created_at timestamp without time zone,
1246 updated_at timestamp without time zone,
1247 user_id bigint NOT NULL,
1248 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1253 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1256 CREATE SEQUENCE public.redactions_id_seq
1266 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1269 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1273 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1276 CREATE TABLE public.relation_members (
1277 relation_id bigint NOT NULL,
1278 member_type public.nwr_enum NOT NULL,
1279 member_id bigint NOT NULL,
1280 member_role character varying NOT NULL,
1281 version bigint DEFAULT 0 NOT NULL,
1282 sequence_id integer DEFAULT 0 NOT NULL
1287 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1290 CREATE TABLE public.relation_tags (
1291 relation_id bigint NOT NULL,
1292 k character varying DEFAULT ''::character varying NOT NULL,
1293 v character varying DEFAULT ''::character varying NOT NULL,
1294 version bigint NOT NULL
1299 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1302 CREATE TABLE public.relations (
1303 relation_id bigint NOT NULL,
1304 changeset_id bigint NOT NULL,
1305 "timestamp" timestamp without time zone NOT NULL,
1306 version bigint NOT NULL,
1307 visible boolean DEFAULT true NOT NULL,
1308 redaction_id integer
1313 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1316 CREATE TABLE public.reports (
1317 id integer NOT NULL,
1318 issue_id integer NOT NULL,
1319 user_id integer NOT NULL,
1320 details text NOT NULL,
1321 category character varying NOT NULL,
1322 created_at timestamp without time zone NOT NULL,
1323 updated_at timestamp without time zone NOT NULL
1328 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1331 CREATE SEQUENCE public.reports_id_seq
1341 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1344 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1348 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1351 CREATE TABLE public.schema_migrations (
1352 version character varying NOT NULL
1357 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1360 CREATE TABLE public.user_blocks (
1361 id integer NOT NULL,
1362 user_id bigint NOT NULL,
1363 creator_id bigint NOT NULL,
1364 reason text NOT NULL,
1365 ends_at timestamp without time zone NOT NULL,
1366 needs_view boolean DEFAULT false NOT NULL,
1368 created_at timestamp without time zone,
1369 updated_at timestamp without time zone,
1370 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1375 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1378 CREATE SEQUENCE public.user_blocks_id_seq
1388 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1391 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1395 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1398 CREATE TABLE public.user_preferences (
1399 user_id bigint NOT NULL,
1400 k character varying NOT NULL,
1401 v character varying NOT NULL
1406 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1409 CREATE TABLE public.user_roles (
1410 id integer NOT NULL,
1411 user_id bigint NOT NULL,
1412 role public.user_role_enum NOT NULL,
1413 created_at timestamp without time zone,
1414 updated_at timestamp without time zone,
1415 granter_id bigint NOT NULL
1420 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1423 CREATE SEQUENCE public.user_roles_id_seq
1433 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1436 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1440 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1443 CREATE TABLE public.user_tokens (
1445 user_id bigint NOT NULL,
1446 token character varying NOT NULL,
1447 expiry timestamp without time zone NOT NULL,
1453 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1456 CREATE SEQUENCE public.user_tokens_id_seq
1465 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1468 ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id;
1472 -- Name: users; Type: TABLE; Schema: public; Owner: -
1475 CREATE TABLE public.users (
1476 email character varying NOT NULL,
1478 pass_crypt character varying NOT NULL,
1479 creation_time timestamp without time zone NOT NULL,
1480 display_name character varying DEFAULT ''::character varying NOT NULL,
1481 data_public boolean DEFAULT false NOT NULL,
1482 description text DEFAULT ''::text NOT NULL,
1483 home_lat double precision,
1484 home_lon double precision,
1485 home_zoom smallint DEFAULT 3,
1486 pass_salt character varying,
1487 email_valid boolean DEFAULT false NOT NULL,
1488 new_email character varying,
1489 creation_ip character varying,
1490 languages character varying,
1491 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1492 terms_agreed timestamp without time zone,
1493 consider_pd boolean DEFAULT false NOT NULL,
1494 auth_uid character varying,
1495 preferred_editor character varying,
1496 terms_seen boolean DEFAULT false NOT NULL,
1497 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1498 changesets_count integer DEFAULT 0 NOT NULL,
1499 traces_count integer DEFAULT 0 NOT NULL,
1500 diary_entries_count integer DEFAULT 0 NOT NULL,
1501 image_use_gravatar boolean DEFAULT false NOT NULL,
1502 auth_provider character varying,
1504 tou_agreed timestamp without time zone
1509 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1512 CREATE SEQUENCE public.users_id_seq
1521 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1524 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1528 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1531 CREATE TABLE public.way_nodes (
1532 way_id bigint NOT NULL,
1533 node_id bigint NOT NULL,
1534 version bigint NOT NULL,
1535 sequence_id bigint NOT NULL
1540 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1543 CREATE TABLE public.way_tags (
1544 way_id bigint NOT NULL,
1545 k character varying NOT NULL,
1546 v character varying NOT NULL,
1547 version bigint NOT NULL
1552 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1555 CREATE TABLE public.ways (
1556 way_id bigint NOT NULL,
1557 changeset_id bigint NOT NULL,
1558 "timestamp" timestamp without time zone NOT NULL,
1559 version bigint NOT NULL,
1560 visible boolean DEFAULT true NOT NULL,
1561 redaction_id integer
1566 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1569 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1573 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1576 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1580 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1583 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1587 -- Name: active_storage_variant_records id; Type: DEFAULT; Schema: public; Owner: -
1590 ALTER TABLE ONLY public.active_storage_variant_records ALTER COLUMN id SET DEFAULT nextval('public.active_storage_variant_records_id_seq'::regclass);
1594 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1597 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1601 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1604 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1608 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1611 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1615 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1618 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1622 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1625 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1629 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1632 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1636 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1639 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1643 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1646 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1650 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1653 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1657 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1660 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1664 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1667 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1671 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1674 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1678 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1681 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1685 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1688 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1692 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1695 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1699 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1702 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1706 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1709 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1713 -- Name: oauth_access_grants id; Type: DEFAULT; Schema: public; Owner: -
1716 ALTER TABLE ONLY public.oauth_access_grants ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_grants_id_seq'::regclass);
1720 -- Name: oauth_access_tokens id; Type: DEFAULT; Schema: public; Owner: -
1723 ALTER TABLE ONLY public.oauth_access_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_tokens_id_seq'::regclass);
1727 -- Name: oauth_applications id; Type: DEFAULT; Schema: public; Owner: -
1730 ALTER TABLE ONLY public.oauth_applications ALTER COLUMN id SET DEFAULT nextval('public.oauth_applications_id_seq'::regclass);
1734 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1737 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1741 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1744 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1748 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1751 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1755 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1758 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1762 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1765 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1769 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1772 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1776 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1779 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1783 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1786 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1790 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1793 ALTER TABLE ONLY public.acls
1794 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1798 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1801 ALTER TABLE ONLY public.active_storage_attachments
1802 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1806 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1809 ALTER TABLE ONLY public.active_storage_blobs
1810 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1814 -- Name: active_storage_variant_records active_storage_variant_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1817 ALTER TABLE ONLY public.active_storage_variant_records
1818 ADD CONSTRAINT active_storage_variant_records_pkey PRIMARY KEY (id);
1822 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1825 ALTER TABLE ONLY public.ar_internal_metadata
1826 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1830 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1833 ALTER TABLE ONLY public.changeset_comments
1834 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1838 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1841 ALTER TABLE ONLY public.changesets
1842 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1846 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1849 ALTER TABLE ONLY public.client_applications
1850 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1854 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1857 ALTER TABLE ONLY public.current_node_tags
1858 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1862 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1865 ALTER TABLE ONLY public.current_nodes
1866 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1870 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1873 ALTER TABLE ONLY public.current_relation_members
1874 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1878 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1881 ALTER TABLE ONLY public.current_relation_tags
1882 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1886 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1889 ALTER TABLE ONLY public.current_relations
1890 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1894 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1897 ALTER TABLE ONLY public.current_way_nodes
1898 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1902 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1905 ALTER TABLE ONLY public.current_way_tags
1906 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1910 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1913 ALTER TABLE ONLY public.current_ways
1914 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1918 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1921 ALTER TABLE ONLY public.delayed_jobs
1922 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1926 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1929 ALTER TABLE ONLY public.diary_comments
1930 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1934 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1937 ALTER TABLE ONLY public.diary_entries
1938 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1942 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1945 ALTER TABLE ONLY public.diary_entry_subscriptions
1946 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1950 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1953 ALTER TABLE ONLY public.friends
1954 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1958 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1961 ALTER TABLE ONLY public.gpx_file_tags
1962 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1966 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1969 ALTER TABLE ONLY public.gpx_files
1970 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1974 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1977 ALTER TABLE ONLY public.issue_comments
1978 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1982 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1985 ALTER TABLE ONLY public.issues
1986 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
1990 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1993 ALTER TABLE ONLY public.languages
1994 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1998 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2001 ALTER TABLE ONLY public.messages
2002 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
2006 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2009 ALTER TABLE ONLY public.node_tags
2010 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
2014 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2017 ALTER TABLE ONLY public.nodes
2018 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
2022 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2025 ALTER TABLE ONLY public.note_comments
2026 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
2030 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2033 ALTER TABLE ONLY public.notes
2034 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
2038 -- Name: oauth_access_grants oauth_access_grants_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2041 ALTER TABLE ONLY public.oauth_access_grants
2042 ADD CONSTRAINT oauth_access_grants_pkey PRIMARY KEY (id);
2046 -- Name: oauth_access_tokens oauth_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2049 ALTER TABLE ONLY public.oauth_access_tokens
2050 ADD CONSTRAINT oauth_access_tokens_pkey PRIMARY KEY (id);
2054 -- Name: oauth_applications oauth_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2057 ALTER TABLE ONLY public.oauth_applications
2058 ADD CONSTRAINT oauth_applications_pkey PRIMARY KEY (id);
2062 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2065 ALTER TABLE ONLY public.oauth_nonces
2066 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
2070 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2073 ALTER TABLE ONLY public.oauth_tokens
2074 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
2078 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2081 ALTER TABLE ONLY public.redactions
2082 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
2086 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2089 ALTER TABLE ONLY public.relation_members
2090 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
2094 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2097 ALTER TABLE ONLY public.relation_tags
2098 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
2102 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2105 ALTER TABLE ONLY public.relations
2106 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
2110 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2113 ALTER TABLE ONLY public.reports
2114 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
2118 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2121 ALTER TABLE ONLY public.schema_migrations
2122 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
2126 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2129 ALTER TABLE ONLY public.user_blocks
2130 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
2134 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2137 ALTER TABLE ONLY public.user_preferences
2138 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
2142 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2145 ALTER TABLE ONLY public.user_roles
2146 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
2150 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2153 ALTER TABLE ONLY public.user_tokens
2154 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
2158 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2161 ALTER TABLE ONLY public.users
2162 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2166 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2169 ALTER TABLE ONLY public.way_nodes
2170 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2174 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2177 ALTER TABLE ONLY public.way_tags
2178 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2182 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2185 ALTER TABLE ONLY public.ways
2186 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2190 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2193 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2197 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
2200 CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id);
2204 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2207 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2211 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2214 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2218 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2221 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2225 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2228 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2232 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2235 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2239 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2242 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2246 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2249 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2253 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2256 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2260 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2263 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2267 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2270 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2274 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2277 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2281 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2284 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2288 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2291 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2295 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2298 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2302 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2305 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2309 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2312 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2316 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2319 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2323 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2326 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2330 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2333 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2337 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2340 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2344 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2347 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2351 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2354 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2358 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2361 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2365 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2368 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2372 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2375 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2379 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2382 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2386 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2389 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2393 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2396 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2400 -- Name: index_active_storage_variant_records_uniqueness; Type: INDEX; Schema: public; Owner: -
2403 CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.active_storage_variant_records USING btree (blob_id, variation_digest);
2407 -- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2410 CREATE INDEX index_changeset_comments_on_changeset_id_and_created_at ON public.changeset_comments USING btree (changeset_id, created_at);
2414 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2417 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2421 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2424 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2428 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2431 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2435 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2438 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2442 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2445 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2449 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2452 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2456 -- Name: index_friends_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2459 CREATE INDEX index_friends_on_user_id_and_created_at ON public.friends USING btree (user_id, created_at);
2463 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2466 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2470 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2473 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2477 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2480 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2484 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2487 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2491 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2494 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2498 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2501 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2505 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2508 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2512 -- Name: index_note_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2515 CREATE INDEX index_note_comments_on_author_id_and_created_at ON public.note_comments USING btree (author_id, created_at);
2519 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2522 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2526 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2529 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2533 -- Name: index_oauth_access_grants_on_application_id; Type: INDEX; Schema: public; Owner: -
2536 CREATE INDEX index_oauth_access_grants_on_application_id ON public.oauth_access_grants USING btree (application_id);
2540 -- Name: index_oauth_access_grants_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2543 CREATE INDEX index_oauth_access_grants_on_resource_owner_id ON public.oauth_access_grants USING btree (resource_owner_id);
2547 -- Name: index_oauth_access_grants_on_token; Type: INDEX; Schema: public; Owner: -
2550 CREATE UNIQUE INDEX index_oauth_access_grants_on_token ON public.oauth_access_grants USING btree (token);
2554 -- Name: index_oauth_access_tokens_on_application_id; Type: INDEX; Schema: public; Owner: -
2557 CREATE INDEX index_oauth_access_tokens_on_application_id ON public.oauth_access_tokens USING btree (application_id);
2561 -- Name: index_oauth_access_tokens_on_refresh_token; Type: INDEX; Schema: public; Owner: -
2564 CREATE UNIQUE INDEX index_oauth_access_tokens_on_refresh_token ON public.oauth_access_tokens USING btree (refresh_token);
2568 -- Name: index_oauth_access_tokens_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
2571 CREATE INDEX index_oauth_access_tokens_on_resource_owner_id ON public.oauth_access_tokens USING btree (resource_owner_id);
2575 -- Name: index_oauth_access_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2578 CREATE UNIQUE INDEX index_oauth_access_tokens_on_token ON public.oauth_access_tokens USING btree (token);
2582 -- Name: index_oauth_applications_on_owner_type_and_owner_id; Type: INDEX; Schema: public; Owner: -
2585 CREATE INDEX index_oauth_applications_on_owner_type_and_owner_id ON public.oauth_applications USING btree (owner_type, owner_id);
2589 -- Name: index_oauth_applications_on_uid; Type: INDEX; Schema: public; Owner: -
2592 CREATE UNIQUE INDEX index_oauth_applications_on_uid ON public.oauth_applications USING btree (uid);
2596 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2599 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2603 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2606 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2610 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2613 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2617 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2620 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2624 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2627 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2631 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2634 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2638 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2641 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2645 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2648 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2652 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2655 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2659 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2662 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2666 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2669 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2673 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2676 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2680 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2683 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2687 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2690 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2694 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2697 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2701 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2704 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2708 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2711 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2715 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2718 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2722 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2725 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2729 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2732 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2736 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2739 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2743 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2746 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2750 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2753 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2757 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2760 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2764 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2767 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2771 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2774 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2778 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2781 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2785 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2788 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2792 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2795 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2799 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2802 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2806 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2809 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2813 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2816 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2820 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2823 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2827 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2830 ALTER TABLE ONLY public.changeset_comments
2831 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2835 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2838 ALTER TABLE ONLY public.changeset_comments
2839 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2843 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2846 ALTER TABLE ONLY public.changeset_tags
2847 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2851 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2854 ALTER TABLE ONLY public.changesets_subscribers
2855 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2859 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2862 ALTER TABLE ONLY public.changesets_subscribers
2863 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2867 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2870 ALTER TABLE ONLY public.changesets
2871 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2875 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2878 ALTER TABLE ONLY public.client_applications
2879 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2883 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2886 ALTER TABLE ONLY public.current_node_tags
2887 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2891 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2894 ALTER TABLE ONLY public.current_nodes
2895 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2899 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2902 ALTER TABLE ONLY public.current_relation_members
2903 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2907 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2910 ALTER TABLE ONLY public.current_relation_tags
2911 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2915 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2918 ALTER TABLE ONLY public.current_relations
2919 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2923 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2926 ALTER TABLE ONLY public.current_way_nodes
2927 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2931 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2934 ALTER TABLE ONLY public.current_way_nodes
2935 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2939 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2942 ALTER TABLE ONLY public.current_way_tags
2943 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2947 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2950 ALTER TABLE ONLY public.current_ways
2951 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2955 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2958 ALTER TABLE ONLY public.diary_comments
2959 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2963 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2966 ALTER TABLE ONLY public.diary_comments
2967 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2971 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2974 ALTER TABLE ONLY public.diary_entries
2975 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
2979 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2982 ALTER TABLE ONLY public.diary_entries
2983 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2987 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2990 ALTER TABLE ONLY public.diary_entry_subscriptions
2991 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2995 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2998 ALTER TABLE ONLY public.diary_entry_subscriptions
2999 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3003 -- Name: oauth_access_grants fk_rails_330c32d8d9; Type: FK CONSTRAINT; Schema: public; Owner: -
3006 ALTER TABLE ONLY public.oauth_access_grants
3007 ADD CONSTRAINT fk_rails_330c32d8d9 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3011 -- Name: oauth_access_tokens fk_rails_732cb83ab7; Type: FK CONSTRAINT; Schema: public; Owner: -
3014 ALTER TABLE ONLY public.oauth_access_tokens
3015 ADD CONSTRAINT fk_rails_732cb83ab7 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3019 -- Name: active_storage_variant_records fk_rails_993965df05; Type: FK CONSTRAINT; Schema: public; Owner: -
3022 ALTER TABLE ONLY public.active_storage_variant_records
3023 ADD CONSTRAINT fk_rails_993965df05 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3027 -- Name: oauth_access_grants fk_rails_b4b53e07b8; Type: FK CONSTRAINT; Schema: public; Owner: -
3030 ALTER TABLE ONLY public.oauth_access_grants
3031 ADD CONSTRAINT fk_rails_b4b53e07b8 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) NOT VALID;
3035 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
3038 ALTER TABLE ONLY public.active_storage_attachments
3039 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
3043 -- Name: oauth_applications fk_rails_cc886e315a; Type: FK CONSTRAINT; Schema: public; Owner: -
3046 ALTER TABLE ONLY public.oauth_applications
3047 ADD CONSTRAINT fk_rails_cc886e315a FOREIGN KEY (owner_id) REFERENCES public.users(id) NOT VALID;
3051 -- Name: oauth_access_tokens fk_rails_ee63f25419; Type: FK CONSTRAINT; Schema: public; Owner: -
3054 ALTER TABLE ONLY public.oauth_access_tokens
3055 ADD CONSTRAINT fk_rails_ee63f25419 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) NOT VALID;
3059 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3062 ALTER TABLE ONLY public.friends
3063 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
3067 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3070 ALTER TABLE ONLY public.friends
3071 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3075 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3078 ALTER TABLE ONLY public.gps_points
3079 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3083 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3086 ALTER TABLE ONLY public.gpx_file_tags
3087 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
3091 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3094 ALTER TABLE ONLY public.gpx_files
3095 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3099 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3102 ALTER TABLE ONLY public.issue_comments
3103 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3107 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3110 ALTER TABLE ONLY public.issue_comments
3111 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3115 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3118 ALTER TABLE ONLY public.issues
3119 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
3123 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3126 ALTER TABLE ONLY public.issues
3127 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
3131 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3134 ALTER TABLE ONLY public.issues
3135 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
3139 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3142 ALTER TABLE ONLY public.messages
3143 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
3147 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3150 ALTER TABLE ONLY public.messages
3151 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
3155 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3158 ALTER TABLE ONLY public.node_tags
3159 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
3163 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3166 ALTER TABLE ONLY public.nodes
3167 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3171 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3174 ALTER TABLE ONLY public.nodes
3175 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3179 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3182 ALTER TABLE ONLY public.note_comments
3183 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
3187 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3190 ALTER TABLE ONLY public.note_comments
3191 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
3195 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3198 ALTER TABLE ONLY public.oauth_tokens
3199 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
3203 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3206 ALTER TABLE ONLY public.oauth_tokens
3207 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3211 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3214 ALTER TABLE ONLY public.redactions
3215 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3219 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3222 ALTER TABLE ONLY public.relation_members
3223 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3227 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3230 ALTER TABLE ONLY public.relation_tags
3231 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
3235 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3238 ALTER TABLE ONLY public.relations
3239 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3243 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3246 ALTER TABLE ONLY public.relations
3247 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3251 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3254 ALTER TABLE ONLY public.reports
3255 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
3259 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3262 ALTER TABLE ONLY public.reports
3263 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3267 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3270 ALTER TABLE ONLY public.user_blocks
3271 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
3275 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3278 ALTER TABLE ONLY public.user_blocks
3279 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
3283 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3286 ALTER TABLE ONLY public.user_blocks
3287 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3291 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3294 ALTER TABLE ONLY public.user_preferences
3295 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3299 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3302 ALTER TABLE ONLY public.user_roles
3303 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3307 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3310 ALTER TABLE ONLY public.user_roles
3311 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3315 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3318 ALTER TABLE ONLY public.user_tokens
3319 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3323 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3326 ALTER TABLE ONLY public.way_nodes
3327 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3331 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3334 ALTER TABLE ONLY public.way_tags
3335 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3339 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3342 ALTER TABLE ONLY public.ways
3343 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3347 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3350 ALTER TABLE ONLY public.ways
3351 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3355 -- PostgreSQL database dump complete
3358 SET search_path TO "$user", public;
3360 INSERT INTO "schema_migrations" (version) VALUES