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: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: -
23 COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST';
27 -- Name: format_enum; Type: TYPE; Schema: public; Owner: -
30 CREATE TYPE public.format_enum AS ENUM (
38 -- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: -
41 CREATE TYPE public.gpx_visibility_enum AS ENUM (
50 -- Name: issue_status_enum; Type: TYPE; Schema: public; Owner: -
53 CREATE TYPE public.issue_status_enum AS ENUM (
61 -- Name: note_event_enum; Type: TYPE; Schema: public; Owner: -
64 CREATE TYPE public.note_event_enum AS ENUM (
74 -- Name: note_status_enum; Type: TYPE; Schema: public; Owner: -
77 CREATE TYPE public.note_status_enum AS ENUM (
85 -- Name: nwr_enum; Type: TYPE; Schema: public; Owner: -
88 CREATE TYPE public.nwr_enum AS ENUM (
96 -- Name: user_role_enum; Type: TYPE; Schema: public; Owner: -
99 CREATE TYPE public.user_role_enum AS ENUM (
106 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
109 CREATE TYPE public.user_status_enum AS ENUM (
119 -- Name: maptile_for_point(bigint, bigint, integer); Type: FUNCTION; Schema: public; Owner: -
122 CREATE FUNCTION public.maptile_for_point(scaled_lat bigint, scaled_lon bigint, zoom integer) RETURNS integer
123 LANGUAGE plpgsql IMMUTABLE
126 lat CONSTANT DOUBLE PRECISION := scaled_lat / 10000000.0;
127 lon CONSTANT DOUBLE PRECISION := scaled_lon / 10000000.0;
128 zscale CONSTANT DOUBLE PRECISION := 2.0 ^ zoom;
129 pi CONSTANT DOUBLE PRECISION := 3.141592653589793;
130 r_per_d CONSTANT DOUBLE PRECISION := pi / 180.0;
134 -- straight port of the C code. see db/functions/maptile.c
135 x := floor((lon + 180.0) * zscale / 360.0);
136 y := floor((1.0 - ln(tan(lat * r_per_d) + 1.0 / cos(lat * r_per_d)) / pi) * zscale / 2.0);
138 RETURN (x << zoom) | y;
144 -- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
147 CREATE FUNCTION public.tile_for_point(scaled_lat integer, scaled_lon integer) RETURNS bigint
148 LANGUAGE plpgsql IMMUTABLE
151 x int8; -- quantized x from lon,
152 y int8; -- quantized y from lat,
154 x := round(((scaled_lon / 10000000.0) + 180.0) * 65535.0 / 360.0);
155 y := round(((scaled_lat / 10000000.0) + 90.0) * 65535.0 / 180.0);
157 -- these bit-masks are special numbers used in the bit interleaving algorithm.
158 -- see https://graphics.stanford.edu/~seander/bithacks.html#InterleaveBMN
159 -- for the original algorithm and more details.
160 x := (x | (x << 8)) & 16711935; -- 0x00FF00FF
161 x := (x | (x << 4)) & 252645135; -- 0x0F0F0F0F
162 x := (x | (x << 2)) & 858993459; -- 0x33333333
163 x := (x | (x << 1)) & 1431655765; -- 0x55555555
165 y := (y | (y << 8)) & 16711935; -- 0x00FF00FF
166 y := (y | (y << 4)) & 252645135; -- 0x0F0F0F0F
167 y := (y | (y << 2)) & 858993459; -- 0x33333333
168 y := (y | (y << 1)) & 1431655765; -- 0x55555555
176 -- Name: xid_to_int4(xid); Type: FUNCTION; Schema: public; Owner: -
179 CREATE FUNCTION public.xid_to_int4(t xid) RETURNS integer
180 LANGUAGE plpgsql IMMUTABLE STRICT
188 IF tl >= 2147483648 THEN
189 tl := tl - 4294967296;
199 SET default_tablespace = '';
201 SET default_table_access_method = heap;
204 -- Name: acls; Type: TABLE; Schema: public; Owner: -
207 CREATE TABLE public.acls (
210 k character varying NOT NULL,
212 domain character varying,
218 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
221 CREATE SEQUENCE public.acls_id_seq
230 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
233 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
237 -- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
240 CREATE TABLE public.active_storage_attachments (
242 name character varying NOT NULL,
243 record_type character varying NOT NULL,
244 record_id bigint NOT NULL,
245 blob_id bigint NOT NULL,
246 created_at timestamp without time zone NOT NULL
251 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
254 CREATE SEQUENCE public.active_storage_attachments_id_seq
263 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
266 ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
270 -- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
273 CREATE TABLE public.active_storage_blobs (
275 key character varying NOT NULL,
276 filename character varying NOT NULL,
277 content_type character varying,
279 byte_size bigint NOT NULL,
280 checksum character varying NOT NULL,
281 created_at timestamp without time zone NOT NULL
286 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
289 CREATE SEQUENCE public.active_storage_blobs_id_seq
298 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
301 ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
305 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
308 CREATE TABLE public.ar_internal_metadata (
309 key character varying NOT NULL,
310 value character varying,
311 created_at timestamp without time zone NOT NULL,
312 updated_at timestamp without time zone NOT NULL
317 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
320 CREATE TABLE public.changeset_comments (
322 changeset_id bigint NOT NULL,
323 author_id bigint NOT NULL,
325 created_at timestamp without time zone NOT NULL,
326 visible boolean NOT NULL
331 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
334 CREATE SEQUENCE public.changeset_comments_id_seq
343 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
346 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
350 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
353 CREATE TABLE public.changeset_tags (
354 changeset_id bigint NOT NULL,
355 k character varying DEFAULT ''::character varying NOT NULL,
356 v character varying DEFAULT ''::character varying NOT NULL
361 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
364 CREATE TABLE public.changesets (
366 user_id bigint NOT NULL,
367 created_at timestamp without time zone NOT NULL,
372 closed_at timestamp without time zone NOT NULL,
373 num_changes integer DEFAULT 0 NOT NULL
378 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
381 CREATE SEQUENCE public.changesets_id_seq
390 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
393 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
397 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
400 CREATE TABLE public.changesets_subscribers (
401 subscriber_id bigint NOT NULL,
402 changeset_id bigint NOT NULL
407 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
410 CREATE TABLE public.client_applications (
412 name character varying,
413 url character varying,
414 support_url character varying,
415 callback_url character varying,
416 key character varying(50),
417 secret character varying(50),
419 created_at timestamp without time zone,
420 updated_at timestamp without time zone,
421 allow_read_prefs boolean DEFAULT false NOT NULL,
422 allow_write_prefs boolean DEFAULT false NOT NULL,
423 allow_write_diary boolean DEFAULT false NOT NULL,
424 allow_write_api boolean DEFAULT false NOT NULL,
425 allow_read_gpx boolean DEFAULT false NOT NULL,
426 allow_write_gpx boolean DEFAULT false NOT NULL,
427 allow_write_notes boolean DEFAULT false NOT NULL
432 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
435 CREATE SEQUENCE public.client_applications_id_seq
444 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
447 ALTER SEQUENCE public.client_applications_id_seq OWNED BY public.client_applications.id;
451 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
454 CREATE TABLE public.current_node_tags (
455 node_id bigint NOT NULL,
456 k character varying DEFAULT ''::character varying NOT NULL,
457 v character varying DEFAULT ''::character varying NOT NULL
462 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
465 CREATE TABLE public.current_nodes (
467 latitude integer NOT NULL,
468 longitude integer NOT NULL,
469 changeset_id bigint NOT NULL,
470 visible boolean NOT NULL,
471 "timestamp" timestamp without time zone NOT NULL,
472 tile bigint NOT NULL,
473 version bigint NOT NULL
478 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
481 CREATE SEQUENCE public.current_nodes_id_seq
490 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
493 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
497 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
500 CREATE TABLE public.current_relation_members (
501 relation_id bigint NOT NULL,
502 member_type public.nwr_enum NOT NULL,
503 member_id bigint NOT NULL,
504 member_role character varying NOT NULL,
505 sequence_id integer DEFAULT 0 NOT NULL
510 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
513 CREATE TABLE public.current_relation_tags (
514 relation_id bigint NOT NULL,
515 k character varying DEFAULT ''::character varying NOT NULL,
516 v character varying DEFAULT ''::character varying NOT NULL
521 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
524 CREATE TABLE public.current_relations (
526 changeset_id bigint NOT NULL,
527 "timestamp" timestamp without time zone NOT NULL,
528 visible boolean NOT NULL,
529 version bigint NOT NULL
534 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
537 CREATE SEQUENCE public.current_relations_id_seq
546 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
549 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
553 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
556 CREATE TABLE public.current_way_nodes (
557 way_id bigint NOT NULL,
558 node_id bigint NOT NULL,
559 sequence_id bigint NOT NULL
564 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
567 CREATE TABLE public.current_way_tags (
568 way_id bigint NOT NULL,
569 k character varying DEFAULT ''::character varying NOT NULL,
570 v character varying DEFAULT ''::character varying NOT NULL
575 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
578 CREATE TABLE public.current_ways (
580 changeset_id bigint NOT NULL,
581 "timestamp" timestamp without time zone NOT NULL,
582 visible boolean NOT NULL,
583 version bigint NOT NULL
588 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
591 CREATE SEQUENCE public.current_ways_id_seq
600 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
603 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
607 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
610 CREATE TABLE public.delayed_jobs (
612 priority integer DEFAULT 0 NOT NULL,
613 attempts integer DEFAULT 0 NOT NULL,
614 handler text NOT NULL,
616 run_at timestamp without time zone,
617 locked_at timestamp without time zone,
618 failed_at timestamp without time zone,
619 locked_by character varying,
620 queue character varying,
621 created_at timestamp without time zone,
622 updated_at timestamp without time zone
627 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
630 CREATE SEQUENCE public.delayed_jobs_id_seq
639 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
642 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
646 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
649 CREATE TABLE public.diary_comments (
651 diary_entry_id bigint NOT NULL,
652 user_id bigint NOT NULL,
654 created_at timestamp without time zone NOT NULL,
655 updated_at timestamp without time zone NOT NULL,
656 visible boolean DEFAULT true NOT NULL,
657 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
662 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
665 CREATE SEQUENCE public.diary_comments_id_seq
674 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
677 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
681 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
684 CREATE TABLE public.diary_entries (
686 user_id bigint NOT NULL,
687 title character varying NOT NULL,
689 created_at timestamp without time zone NOT NULL,
690 updated_at timestamp without time zone NOT NULL,
691 latitude double precision,
692 longitude double precision,
693 language_code character varying DEFAULT 'en'::character varying NOT NULL,
694 visible boolean DEFAULT true NOT NULL,
695 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
700 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
703 CREATE SEQUENCE public.diary_entries_id_seq
712 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
715 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
719 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
722 CREATE TABLE public.diary_entry_subscriptions (
723 user_id bigint NOT NULL,
724 diary_entry_id bigint NOT NULL
729 -- Name: friends; Type: TABLE; Schema: public; Owner: -
732 CREATE TABLE public.friends (
734 user_id bigint NOT NULL,
735 friend_user_id bigint NOT NULL
740 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
743 CREATE SEQUENCE public.friends_id_seq
752 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
755 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
759 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
762 CREATE TABLE public.gps_points (
763 altitude double precision,
764 trackid integer NOT NULL,
765 latitude integer NOT NULL,
766 longitude integer NOT NULL,
767 gpx_id bigint NOT NULL,
768 "timestamp" timestamp without time zone,
774 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
777 CREATE TABLE public.gpx_file_tags (
778 gpx_id bigint DEFAULT 0 NOT NULL,
779 tag character varying NOT NULL,
785 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
788 CREATE SEQUENCE public.gpx_file_tags_id_seq
797 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
800 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
804 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
807 CREATE TABLE public.gpx_files (
809 user_id bigint NOT NULL,
810 visible boolean DEFAULT true NOT NULL,
811 name character varying DEFAULT ''::character varying NOT NULL,
813 latitude double precision,
814 longitude double precision,
815 "timestamp" timestamp without time zone NOT NULL,
816 description character varying DEFAULT ''::character varying NOT NULL,
817 inserted boolean NOT NULL,
818 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
823 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
826 CREATE SEQUENCE public.gpx_files_id_seq
835 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
838 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
842 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
845 CREATE TABLE public.issue_comments (
847 issue_id integer NOT NULL,
848 user_id integer NOT NULL,
850 created_at timestamp without time zone NOT NULL,
851 updated_at timestamp without time zone NOT NULL
856 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
859 CREATE SEQUENCE public.issue_comments_id_seq
868 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
871 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
875 -- Name: issues; Type: TABLE; Schema: public; Owner: -
878 CREATE TABLE public.issues (
880 reportable_type character varying NOT NULL,
881 reportable_id integer NOT NULL,
882 reported_user_id integer,
883 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
884 assigned_role public.user_role_enum NOT NULL,
885 resolved_at timestamp without time zone,
888 reports_count integer DEFAULT 0,
889 created_at timestamp without time zone NOT NULL,
890 updated_at timestamp without time zone NOT NULL
895 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
898 CREATE SEQUENCE public.issues_id_seq
907 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
910 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
914 -- Name: languages; Type: TABLE; Schema: public; Owner: -
917 CREATE TABLE public.languages (
918 code character varying NOT NULL,
919 english_name character varying NOT NULL,
920 native_name character varying
925 -- Name: messages; Type: TABLE; Schema: public; Owner: -
928 CREATE TABLE public.messages (
930 from_user_id bigint NOT NULL,
931 title character varying NOT NULL,
933 sent_on timestamp without time zone NOT NULL,
934 message_read boolean DEFAULT false NOT NULL,
935 to_user_id bigint NOT NULL,
936 to_user_visible boolean DEFAULT true NOT NULL,
937 from_user_visible boolean DEFAULT true NOT NULL,
938 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
943 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
946 CREATE SEQUENCE public.messages_id_seq
955 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
958 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
962 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
965 CREATE TABLE public.node_tags (
966 node_id bigint NOT NULL,
967 version bigint NOT NULL,
968 k character varying DEFAULT ''::character varying NOT NULL,
969 v character varying DEFAULT ''::character varying NOT NULL
974 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
977 CREATE TABLE public.nodes (
978 node_id bigint NOT NULL,
979 latitude integer NOT NULL,
980 longitude integer NOT NULL,
981 changeset_id bigint NOT NULL,
982 visible boolean NOT NULL,
983 "timestamp" timestamp without time zone NOT NULL,
984 tile bigint NOT NULL,
985 version bigint NOT NULL,
991 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
994 CREATE TABLE public.note_comments (
996 note_id bigint NOT NULL,
997 visible boolean NOT NULL,
998 created_at timestamp without time zone NOT NULL,
1002 event public.note_event_enum
1007 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1010 CREATE SEQUENCE public.note_comments_id_seq
1019 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1022 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
1026 -- Name: notes; Type: TABLE; Schema: public; Owner: -
1029 CREATE TABLE public.notes (
1031 latitude integer NOT NULL,
1032 longitude integer NOT NULL,
1033 tile bigint NOT NULL,
1034 updated_at timestamp without time zone NOT NULL,
1035 created_at timestamp without time zone NOT NULL,
1036 status public.note_status_enum NOT NULL,
1037 closed_at timestamp without time zone
1042 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1045 CREATE SEQUENCE public.notes_id_seq
1054 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1057 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
1061 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
1064 CREATE TABLE public.oauth_nonces (
1065 id integer NOT NULL,
1066 nonce character varying,
1067 "timestamp" integer,
1068 created_at timestamp without time zone,
1069 updated_at timestamp without time zone
1074 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1077 CREATE SEQUENCE public.oauth_nonces_id_seq
1086 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1089 ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id;
1093 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
1096 CREATE TABLE public.oauth_tokens (
1097 id integer NOT NULL,
1099 type character varying(20),
1100 client_application_id integer,
1101 token character varying(50),
1102 secret character varying(50),
1103 authorized_at timestamp without time zone,
1104 invalidated_at timestamp without time zone,
1105 created_at timestamp without time zone,
1106 updated_at timestamp without time zone,
1107 allow_read_prefs boolean DEFAULT false NOT NULL,
1108 allow_write_prefs boolean DEFAULT false NOT NULL,
1109 allow_write_diary boolean DEFAULT false NOT NULL,
1110 allow_write_api boolean DEFAULT false NOT NULL,
1111 allow_read_gpx boolean DEFAULT false NOT NULL,
1112 allow_write_gpx boolean DEFAULT false NOT NULL,
1113 callback_url character varying,
1114 verifier character varying(20),
1115 scope character varying,
1116 valid_to timestamp without time zone,
1117 allow_write_notes boolean DEFAULT false NOT NULL
1122 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1125 CREATE SEQUENCE public.oauth_tokens_id_seq
1134 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1137 ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
1141 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1144 CREATE TABLE public.redactions (
1145 id integer NOT NULL,
1146 title character varying,
1148 created_at timestamp without time zone,
1149 updated_at timestamp without time zone,
1150 user_id bigint NOT NULL,
1151 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1156 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1159 CREATE SEQUENCE public.redactions_id_seq
1168 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1171 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1175 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1178 CREATE TABLE public.relation_members (
1179 relation_id bigint DEFAULT 0 NOT NULL,
1180 member_type public.nwr_enum NOT NULL,
1181 member_id bigint NOT NULL,
1182 member_role character varying NOT NULL,
1183 version bigint DEFAULT 0 NOT NULL,
1184 sequence_id integer DEFAULT 0 NOT NULL
1189 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1192 CREATE TABLE public.relation_tags (
1193 relation_id bigint DEFAULT 0 NOT NULL,
1194 k character varying DEFAULT ''::character varying NOT NULL,
1195 v character varying DEFAULT ''::character varying NOT NULL,
1196 version bigint NOT NULL
1201 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1204 CREATE TABLE public.relations (
1205 relation_id bigint DEFAULT 0 NOT NULL,
1206 changeset_id bigint NOT NULL,
1207 "timestamp" timestamp without time zone NOT NULL,
1208 version bigint NOT NULL,
1209 visible boolean DEFAULT true NOT NULL,
1210 redaction_id integer
1215 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1218 CREATE TABLE public.reports (
1219 id integer NOT NULL,
1220 issue_id integer NOT NULL,
1221 user_id integer NOT NULL,
1222 details text NOT NULL,
1223 category character varying NOT NULL,
1224 created_at timestamp without time zone NOT NULL,
1225 updated_at timestamp without time zone NOT NULL
1230 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1233 CREATE SEQUENCE public.reports_id_seq
1242 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1245 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1249 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1252 CREATE TABLE public.schema_migrations (
1253 version character varying NOT NULL
1258 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1261 CREATE TABLE public.user_blocks (
1262 id integer NOT NULL,
1263 user_id bigint NOT NULL,
1264 creator_id bigint NOT NULL,
1265 reason text NOT NULL,
1266 ends_at timestamp without time zone NOT NULL,
1267 needs_view boolean DEFAULT false NOT NULL,
1269 created_at timestamp without time zone,
1270 updated_at timestamp without time zone,
1271 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1276 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1279 CREATE SEQUENCE public.user_blocks_id_seq
1288 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1291 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1295 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1298 CREATE TABLE public.user_preferences (
1299 user_id bigint NOT NULL,
1300 k character varying NOT NULL,
1301 v character varying NOT NULL
1306 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1309 CREATE TABLE public.user_roles (
1310 id integer NOT NULL,
1311 user_id bigint NOT NULL,
1312 created_at timestamp without time zone,
1313 updated_at timestamp without time zone,
1314 role public.user_role_enum NOT NULL,
1315 granter_id bigint NOT NULL
1320 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1323 CREATE SEQUENCE public.user_roles_id_seq
1332 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1335 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1339 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1342 CREATE TABLE public.user_tokens (
1344 user_id bigint NOT NULL,
1345 token character varying NOT NULL,
1346 expiry timestamp without time zone NOT NULL,
1352 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1355 CREATE SEQUENCE public.user_tokens_id_seq
1364 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1367 ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id;
1371 -- Name: users; Type: TABLE; Schema: public; Owner: -
1374 CREATE TABLE public.users (
1375 email character varying NOT NULL,
1377 pass_crypt character varying NOT NULL,
1378 creation_time timestamp without time zone NOT NULL,
1379 display_name character varying DEFAULT ''::character varying NOT NULL,
1380 data_public boolean DEFAULT false NOT NULL,
1381 description text DEFAULT ''::text NOT NULL,
1382 home_lat double precision,
1383 home_lon double precision,
1384 home_zoom smallint DEFAULT 3,
1385 pass_salt character varying,
1386 email_valid boolean DEFAULT false NOT NULL,
1387 new_email character varying,
1388 creation_ip character varying,
1389 languages character varying,
1390 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1391 terms_agreed timestamp without time zone,
1392 consider_pd boolean DEFAULT false NOT NULL,
1393 auth_uid character varying,
1394 preferred_editor character varying,
1395 terms_seen boolean DEFAULT false NOT NULL,
1396 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1397 changesets_count integer DEFAULT 0 NOT NULL,
1398 traces_count integer DEFAULT 0 NOT NULL,
1399 diary_entries_count integer DEFAULT 0 NOT NULL,
1400 image_use_gravatar boolean DEFAULT false NOT NULL,
1401 auth_provider character varying,
1403 tou_agreed timestamp without time zone
1408 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1411 CREATE SEQUENCE public.users_id_seq
1420 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1423 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1427 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1430 CREATE TABLE public.way_nodes (
1431 way_id bigint NOT NULL,
1432 node_id bigint NOT NULL,
1433 version bigint NOT NULL,
1434 sequence_id bigint NOT NULL
1439 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1442 CREATE TABLE public.way_tags (
1443 way_id bigint DEFAULT 0 NOT NULL,
1444 k character varying NOT NULL,
1445 v character varying NOT NULL,
1446 version bigint NOT NULL
1451 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1454 CREATE TABLE public.ways (
1455 way_id bigint DEFAULT 0 NOT NULL,
1456 changeset_id bigint NOT NULL,
1457 "timestamp" timestamp without time zone NOT NULL,
1458 version bigint NOT NULL,
1459 visible boolean DEFAULT true NOT NULL,
1460 redaction_id integer
1465 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1468 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1472 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1475 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1479 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1482 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1486 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1489 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1493 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1496 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1500 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1503 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1507 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1510 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1514 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1517 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1521 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1524 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1528 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1531 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1535 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1538 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1542 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1545 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1549 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1552 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1556 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1559 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1563 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1566 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1570 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1573 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1577 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1580 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1584 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1587 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1591 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1594 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1598 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1601 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1605 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1608 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1612 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1615 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1619 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1622 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1626 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1629 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1633 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1636 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1640 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1643 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1647 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1650 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1654 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1657 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1661 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1664 ALTER TABLE ONLY public.acls
1665 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1669 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1672 ALTER TABLE ONLY public.active_storage_attachments
1673 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1677 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1680 ALTER TABLE ONLY public.active_storage_blobs
1681 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1685 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1688 ALTER TABLE ONLY public.ar_internal_metadata
1689 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1693 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1696 ALTER TABLE ONLY public.changeset_comments
1697 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1701 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1704 ALTER TABLE ONLY public.changesets
1705 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1709 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1712 ALTER TABLE ONLY public.client_applications
1713 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1717 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1720 ALTER TABLE ONLY public.current_node_tags
1721 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1725 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1728 ALTER TABLE ONLY public.current_nodes
1729 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1733 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1736 ALTER TABLE ONLY public.current_relation_members
1737 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1741 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1744 ALTER TABLE ONLY public.current_relation_tags
1745 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1749 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1752 ALTER TABLE ONLY public.current_relations
1753 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1757 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1760 ALTER TABLE ONLY public.current_way_nodes
1761 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1765 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1768 ALTER TABLE ONLY public.current_way_tags
1769 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1773 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1776 ALTER TABLE ONLY public.current_ways
1777 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1781 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1784 ALTER TABLE ONLY public.delayed_jobs
1785 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1789 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1792 ALTER TABLE ONLY public.diary_comments
1793 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1797 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1800 ALTER TABLE ONLY public.diary_entries
1801 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1805 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1808 ALTER TABLE ONLY public.diary_entry_subscriptions
1809 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1813 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1816 ALTER TABLE ONLY public.friends
1817 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1821 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1824 ALTER TABLE ONLY public.gpx_file_tags
1825 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1829 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1832 ALTER TABLE ONLY public.gpx_files
1833 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1837 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1840 ALTER TABLE ONLY public.issue_comments
1841 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1845 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1848 ALTER TABLE ONLY public.issues
1849 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
1853 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1856 ALTER TABLE ONLY public.languages
1857 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1861 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1864 ALTER TABLE ONLY public.messages
1865 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1869 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1872 ALTER TABLE ONLY public.node_tags
1873 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1877 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1880 ALTER TABLE ONLY public.nodes
1881 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1885 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1888 ALTER TABLE ONLY public.note_comments
1889 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1893 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1896 ALTER TABLE ONLY public.notes
1897 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1901 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1904 ALTER TABLE ONLY public.oauth_nonces
1905 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1909 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1912 ALTER TABLE ONLY public.oauth_tokens
1913 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1917 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1920 ALTER TABLE ONLY public.redactions
1921 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1925 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1928 ALTER TABLE ONLY public.relation_members
1929 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1933 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1936 ALTER TABLE ONLY public.relation_tags
1937 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1941 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1944 ALTER TABLE ONLY public.relations
1945 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1949 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1952 ALTER TABLE ONLY public.reports
1953 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
1957 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1960 ALTER TABLE ONLY public.schema_migrations
1961 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
1965 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1968 ALTER TABLE ONLY public.user_blocks
1969 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1973 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1976 ALTER TABLE ONLY public.user_preferences
1977 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1981 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1984 ALTER TABLE ONLY public.user_roles
1985 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1989 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1992 ALTER TABLE ONLY public.user_tokens
1993 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
1997 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2000 ALTER TABLE ONLY public.users
2001 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2005 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2008 ALTER TABLE ONLY public.way_nodes
2009 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2013 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2016 ALTER TABLE ONLY public.way_tags
2017 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2021 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2024 ALTER TABLE ONLY public.ways
2025 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2029 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2032 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2036 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
2039 CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id);
2043 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2046 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2050 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2053 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2057 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2060 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2064 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2067 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2071 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2074 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2078 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2081 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2085 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2088 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2092 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2095 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2099 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2102 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2106 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2109 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2113 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2116 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2120 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2123 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2127 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2130 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2134 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2137 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2141 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2144 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2148 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2151 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2155 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2158 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2162 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -
2165 CREATE INDEX friends_user_id_idx ON public.friends USING btree (user_id);
2169 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2172 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2176 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2179 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2183 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2186 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2190 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2193 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2197 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2200 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2204 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2207 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2211 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2214 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2218 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2221 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2225 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2228 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2232 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2235 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2239 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2242 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2246 -- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2249 CREATE INDEX index_changeset_comments_on_changeset_id_and_created_at ON public.changeset_comments USING btree (changeset_id, created_at);
2253 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2256 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2260 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2263 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2267 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2270 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2274 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2277 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2281 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2284 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2288 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2291 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2295 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2298 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2302 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2305 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2309 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2312 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2316 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2319 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2323 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2326 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2330 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2333 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2337 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2340 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2344 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2347 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2351 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2354 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2358 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2361 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2365 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2368 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2372 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2375 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2379 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2382 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2386 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2389 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2393 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2396 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2400 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2403 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2407 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2410 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2414 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2417 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2421 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2424 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2428 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2431 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2435 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2438 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2442 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2445 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2449 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2452 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2456 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2459 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2463 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2466 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2470 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2473 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2477 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2480 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2484 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2487 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2491 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2494 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2498 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2501 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2505 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2508 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2512 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2515 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2519 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2522 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2526 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2529 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2533 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2536 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2540 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2543 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2547 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2550 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2554 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2557 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2561 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2564 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2568 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2571 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2575 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2578 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2582 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2585 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2589 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2592 ALTER TABLE ONLY public.changeset_comments
2593 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2597 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2600 ALTER TABLE ONLY public.changeset_comments
2601 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2605 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2608 ALTER TABLE ONLY public.changeset_tags
2609 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2613 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2616 ALTER TABLE ONLY public.changesets_subscribers
2617 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2621 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2624 ALTER TABLE ONLY public.changesets_subscribers
2625 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2629 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2632 ALTER TABLE ONLY public.changesets
2633 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2637 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2640 ALTER TABLE ONLY public.client_applications
2641 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2645 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2648 ALTER TABLE ONLY public.current_node_tags
2649 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2653 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2656 ALTER TABLE ONLY public.current_nodes
2657 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2661 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2664 ALTER TABLE ONLY public.current_relation_members
2665 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2669 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2672 ALTER TABLE ONLY public.current_relation_tags
2673 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2677 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2680 ALTER TABLE ONLY public.current_relations
2681 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2685 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2688 ALTER TABLE ONLY public.current_way_nodes
2689 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2693 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2696 ALTER TABLE ONLY public.current_way_nodes
2697 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2701 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2704 ALTER TABLE ONLY public.current_way_tags
2705 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2709 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2712 ALTER TABLE ONLY public.current_ways
2713 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2717 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2720 ALTER TABLE ONLY public.diary_comments
2721 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2725 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2728 ALTER TABLE ONLY public.diary_comments
2729 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2733 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2736 ALTER TABLE ONLY public.diary_entries
2737 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
2741 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2744 ALTER TABLE ONLY public.diary_entries
2745 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2749 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2752 ALTER TABLE ONLY public.diary_entry_subscriptions
2753 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2757 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2760 ALTER TABLE ONLY public.diary_entry_subscriptions
2761 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2765 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
2768 ALTER TABLE ONLY public.active_storage_attachments
2769 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
2773 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2776 ALTER TABLE ONLY public.friends
2777 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
2781 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2784 ALTER TABLE ONLY public.friends
2785 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2789 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2792 ALTER TABLE ONLY public.gps_points
2793 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2797 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2800 ALTER TABLE ONLY public.gpx_file_tags
2801 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2805 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2808 ALTER TABLE ONLY public.gpx_files
2809 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2813 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2816 ALTER TABLE ONLY public.issue_comments
2817 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2821 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2824 ALTER TABLE ONLY public.issue_comments
2825 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2829 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2832 ALTER TABLE ONLY public.issues
2833 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
2837 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2840 ALTER TABLE ONLY public.issues
2841 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
2845 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2848 ALTER TABLE ONLY public.issues
2849 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
2853 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2856 ALTER TABLE ONLY public.messages
2857 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
2861 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2864 ALTER TABLE ONLY public.messages
2865 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
2869 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2872 ALTER TABLE ONLY public.node_tags
2873 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
2877 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2880 ALTER TABLE ONLY public.nodes
2881 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2885 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2888 ALTER TABLE ONLY public.nodes
2889 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2893 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2896 ALTER TABLE ONLY public.note_comments
2897 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2901 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2904 ALTER TABLE ONLY public.note_comments
2905 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
2909 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2912 ALTER TABLE ONLY public.oauth_tokens
2913 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
2917 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2920 ALTER TABLE ONLY public.oauth_tokens
2921 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2925 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2928 ALTER TABLE ONLY public.redactions
2929 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2933 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2936 ALTER TABLE ONLY public.relation_members
2937 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2941 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2944 ALTER TABLE ONLY public.relation_tags
2945 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2949 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2952 ALTER TABLE ONLY public.relations
2953 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2957 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2960 ALTER TABLE ONLY public.relations
2961 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2965 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2968 ALTER TABLE ONLY public.reports
2969 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2973 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2976 ALTER TABLE ONLY public.reports
2977 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2981 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2984 ALTER TABLE ONLY public.user_blocks
2985 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
2989 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2992 ALTER TABLE ONLY public.user_blocks
2993 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
2997 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3000 ALTER TABLE ONLY public.user_blocks
3001 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3005 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3008 ALTER TABLE ONLY public.user_preferences
3009 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3013 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3016 ALTER TABLE ONLY public.user_roles
3017 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3021 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3024 ALTER TABLE ONLY public.user_roles
3025 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3029 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3032 ALTER TABLE ONLY public.user_tokens
3033 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3037 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3040 ALTER TABLE ONLY public.way_nodes
3041 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3045 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3048 ALTER TABLE ONLY public.way_tags
3049 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3053 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3056 ALTER TABLE ONLY public.ways
3057 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3061 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3064 ALTER TABLE ONLY public.ways
3065 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3069 -- PostgreSQL database dump complete
3072 SET search_path TO "$user", public;
3074 INSERT INTO "schema_migrations" (version) VALUES