1 SET statement_timeout = 0;
3 SET client_encoding = 'UTF8';
4 SET standard_conforming_strings = on;
5 SELECT pg_catalog.set_config('search_path', '', false);
6 SET check_function_bodies = false;
7 SET client_min_messages = warning;
8 SET row_security = off;
11 -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
14 CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
18 -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
21 COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
25 -- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: -
28 CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public;
32 -- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: -
35 COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST';
39 -- Name: format_enum; Type: TYPE; Schema: public; Owner: -
42 CREATE TYPE public.format_enum AS ENUM (
50 -- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: -
53 CREATE TYPE public.gpx_visibility_enum AS ENUM (
62 -- Name: issue_status_enum; Type: TYPE; Schema: public; Owner: -
65 CREATE TYPE public.issue_status_enum AS ENUM (
73 -- Name: note_event_enum; Type: TYPE; Schema: public; Owner: -
76 CREATE TYPE public.note_event_enum AS ENUM (
86 -- Name: note_status_enum; Type: TYPE; Schema: public; Owner: -
89 CREATE TYPE public.note_status_enum AS ENUM (
97 -- Name: nwr_enum; Type: TYPE; Schema: public; Owner: -
100 CREATE TYPE public.nwr_enum AS ENUM (
108 -- Name: user_role_enum; Type: TYPE; Schema: public; Owner: -
111 CREATE TYPE public.user_role_enum AS ENUM (
118 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
121 CREATE TYPE public.user_status_enum AS ENUM (
131 -- Name: maptile_for_point(bigint, bigint, integer); Type: FUNCTION; Schema: public; Owner: -
134 CREATE FUNCTION public.maptile_for_point(scaled_lat bigint, scaled_lon bigint, zoom integer) RETURNS integer
135 LANGUAGE plpgsql IMMUTABLE
138 lat CONSTANT DOUBLE PRECISION := scaled_lat / 10000000.0;
139 lon CONSTANT DOUBLE PRECISION := scaled_lon / 10000000.0;
140 zscale CONSTANT DOUBLE PRECISION := 2.0 ^ zoom;
141 pi CONSTANT DOUBLE PRECISION := 3.141592653589793;
142 r_per_d CONSTANT DOUBLE PRECISION := pi / 180.0;
146 -- straight port of the C code. see db/functions/maptile.c
147 x := floor((lon + 180.0) * zscale / 360.0);
148 y := floor((1.0 - ln(tan(lat * r_per_d) + 1.0 / cos(lat * r_per_d)) / pi) * zscale / 2.0);
150 RETURN (x << zoom) | y;
156 -- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
159 CREATE FUNCTION public.tile_for_point(scaled_lat integer, scaled_lon integer) RETURNS bigint
160 LANGUAGE plpgsql IMMUTABLE
163 x int8; -- quantized x from lon,
164 y int8; -- quantized y from lat,
166 x := round(((scaled_lon / 10000000.0) + 180.0) * 65535.0 / 360.0);
167 y := round(((scaled_lat / 10000000.0) + 90.0) * 65535.0 / 180.0);
169 -- these bit-masks are special numbers used in the bit interleaving algorithm.
170 -- see https://graphics.stanford.edu/~seander/bithacks.html#InterleaveBMN
171 -- for the original algorithm and more details.
172 x := (x | (x << 8)) & 16711935; -- 0x00FF00FF
173 x := (x | (x << 4)) & 252645135; -- 0x0F0F0F0F
174 x := (x | (x << 2)) & 858993459; -- 0x33333333
175 x := (x | (x << 1)) & 1431655765; -- 0x55555555
177 y := (y | (y << 8)) & 16711935; -- 0x00FF00FF
178 y := (y | (y << 4)) & 252645135; -- 0x0F0F0F0F
179 y := (y | (y << 2)) & 858993459; -- 0x33333333
180 y := (y | (y << 1)) & 1431655765; -- 0x55555555
188 -- Name: xid_to_int4(xid); Type: FUNCTION; Schema: public; Owner: -
191 CREATE FUNCTION public.xid_to_int4(t xid) RETURNS integer
192 LANGUAGE plpgsql STRICT
200 IF tl >= 2147483648 THEN
201 tl := tl - 4294967296;
211 SET default_tablespace = '';
213 SET default_with_oids = false;
216 -- Name: acls; Type: TABLE; Schema: public; Owner: -
219 CREATE TABLE public.acls (
222 k character varying NOT NULL,
224 domain character varying,
230 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
233 CREATE SEQUENCE public.acls_id_seq
242 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
245 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
249 -- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
252 CREATE TABLE public.active_storage_attachments (
254 name character varying NOT NULL,
255 record_type character varying NOT NULL,
256 record_id bigint NOT NULL,
257 blob_id bigint NOT NULL,
258 created_at timestamp without time zone NOT NULL
263 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
266 CREATE SEQUENCE public.active_storage_attachments_id_seq
275 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
278 ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
282 -- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
285 CREATE TABLE public.active_storage_blobs (
287 key character varying NOT NULL,
288 filename character varying NOT NULL,
289 content_type character varying,
291 byte_size bigint NOT NULL,
292 checksum character varying NOT NULL,
293 created_at timestamp without time zone NOT NULL
298 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
301 CREATE SEQUENCE public.active_storage_blobs_id_seq
310 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
313 ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
317 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
320 CREATE TABLE public.ar_internal_metadata (
321 key character varying NOT NULL,
322 value character varying,
323 created_at timestamp(6) without time zone NOT NULL,
324 updated_at timestamp(6) without time zone NOT NULL
329 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
332 CREATE TABLE public.changeset_comments (
334 changeset_id bigint NOT NULL,
335 author_id bigint NOT NULL,
337 created_at timestamp without time zone NOT NULL,
338 visible boolean NOT NULL
343 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
346 CREATE SEQUENCE public.changeset_comments_id_seq
355 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
358 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
362 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
365 CREATE TABLE public.changeset_tags (
366 changeset_id bigint NOT NULL,
367 k character varying DEFAULT ''::character varying NOT NULL,
368 v character varying DEFAULT ''::character varying NOT NULL
373 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
376 CREATE TABLE public.changesets (
378 user_id bigint NOT NULL,
379 created_at timestamp without time zone NOT NULL,
384 closed_at timestamp without time zone NOT NULL,
385 num_changes integer DEFAULT 0 NOT NULL
390 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
393 CREATE SEQUENCE public.changesets_id_seq
402 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
405 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
409 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
412 CREATE TABLE public.changesets_subscribers (
413 subscriber_id bigint NOT NULL,
414 changeset_id bigint NOT NULL
419 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
422 CREATE TABLE public.client_applications (
424 name character varying,
425 url character varying,
426 support_url character varying,
427 callback_url character varying,
428 key character varying(50),
429 secret character varying(50),
431 created_at timestamp without time zone,
432 updated_at timestamp without time zone,
433 allow_read_prefs boolean DEFAULT false NOT NULL,
434 allow_write_prefs boolean DEFAULT false NOT NULL,
435 allow_write_diary boolean DEFAULT false NOT NULL,
436 allow_write_api boolean DEFAULT false NOT NULL,
437 allow_read_gpx boolean DEFAULT false NOT NULL,
438 allow_write_gpx boolean DEFAULT false NOT NULL,
439 allow_write_notes boolean DEFAULT false NOT NULL
444 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
447 CREATE SEQUENCE public.client_applications_id_seq
456 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
459 ALTER SEQUENCE public.client_applications_id_seq OWNED BY public.client_applications.id;
463 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
466 CREATE TABLE public.current_node_tags (
467 node_id bigint NOT NULL,
468 k character varying DEFAULT ''::character varying NOT NULL,
469 v character varying DEFAULT ''::character varying NOT NULL
474 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
477 CREATE TABLE public.current_nodes (
479 latitude integer NOT NULL,
480 longitude integer NOT NULL,
481 changeset_id bigint NOT NULL,
482 visible boolean NOT NULL,
483 "timestamp" timestamp without time zone NOT NULL,
484 tile bigint NOT NULL,
485 version bigint NOT NULL
490 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
493 CREATE SEQUENCE public.current_nodes_id_seq
502 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
505 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
509 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
512 CREATE TABLE public.current_relation_members (
513 relation_id bigint NOT NULL,
514 member_type public.nwr_enum NOT NULL,
515 member_id bigint NOT NULL,
516 member_role character varying NOT NULL,
517 sequence_id integer DEFAULT 0 NOT NULL
522 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
525 CREATE TABLE public.current_relation_tags (
526 relation_id bigint NOT NULL,
527 k character varying DEFAULT ''::character varying NOT NULL,
528 v character varying DEFAULT ''::character varying NOT NULL
533 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
536 CREATE TABLE public.current_relations (
538 changeset_id bigint NOT NULL,
539 "timestamp" timestamp without time zone NOT NULL,
540 visible boolean NOT NULL,
541 version bigint NOT NULL
546 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
549 CREATE SEQUENCE public.current_relations_id_seq
558 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
561 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
565 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
568 CREATE TABLE public.current_way_nodes (
569 way_id bigint NOT NULL,
570 node_id bigint NOT NULL,
571 sequence_id bigint NOT NULL
576 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
579 CREATE TABLE public.current_way_tags (
580 way_id bigint NOT NULL,
581 k character varying DEFAULT ''::character varying NOT NULL,
582 v character varying DEFAULT ''::character varying NOT NULL
587 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
590 CREATE TABLE public.current_ways (
592 changeset_id bigint NOT NULL,
593 "timestamp" timestamp without time zone NOT NULL,
594 visible boolean NOT NULL,
595 version bigint NOT NULL
600 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
603 CREATE SEQUENCE public.current_ways_id_seq
612 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
615 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
619 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
622 CREATE TABLE public.delayed_jobs (
624 priority integer DEFAULT 0 NOT NULL,
625 attempts integer DEFAULT 0 NOT NULL,
626 handler text NOT NULL,
628 run_at timestamp without time zone,
629 locked_at timestamp without time zone,
630 failed_at timestamp without time zone,
631 locked_by character varying,
632 queue character varying,
633 created_at timestamp without time zone,
634 updated_at timestamp without time zone
639 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
642 CREATE SEQUENCE public.delayed_jobs_id_seq
651 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
654 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
658 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
661 CREATE TABLE public.diary_comments (
663 diary_entry_id bigint NOT NULL,
664 user_id bigint NOT NULL,
666 created_at timestamp without time zone NOT NULL,
667 updated_at timestamp without time zone NOT NULL,
668 visible boolean DEFAULT true NOT NULL,
669 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
674 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
677 CREATE SEQUENCE public.diary_comments_id_seq
686 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
689 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
693 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
696 CREATE TABLE public.diary_entries (
698 user_id bigint NOT NULL,
699 title character varying NOT NULL,
701 created_at timestamp without time zone NOT NULL,
702 updated_at timestamp without time zone NOT NULL,
703 latitude double precision,
704 longitude double precision,
705 language_code character varying DEFAULT 'en'::character varying NOT NULL,
706 visible boolean DEFAULT true NOT NULL,
707 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
712 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
715 CREATE SEQUENCE public.diary_entries_id_seq
724 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
727 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
731 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
734 CREATE TABLE public.diary_entry_subscriptions (
735 user_id bigint NOT NULL,
736 diary_entry_id bigint NOT NULL
741 -- Name: friends; Type: TABLE; Schema: public; Owner: -
744 CREATE TABLE public.friends (
746 user_id bigint NOT NULL,
747 friend_user_id bigint NOT NULL
752 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
755 CREATE SEQUENCE public.friends_id_seq
764 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
767 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
771 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
774 CREATE TABLE public.gps_points (
775 altitude double precision,
776 trackid integer NOT NULL,
777 latitude integer NOT NULL,
778 longitude integer NOT NULL,
779 gpx_id bigint NOT NULL,
780 "timestamp" timestamp without time zone,
786 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
789 CREATE TABLE public.gpx_file_tags (
790 gpx_id bigint DEFAULT 0 NOT NULL,
791 tag character varying NOT NULL,
797 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
800 CREATE SEQUENCE public.gpx_file_tags_id_seq
809 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
812 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
816 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
819 CREATE TABLE public.gpx_files (
821 user_id bigint NOT NULL,
822 visible boolean DEFAULT true NOT NULL,
823 name character varying DEFAULT ''::character varying NOT NULL,
825 latitude double precision,
826 longitude double precision,
827 "timestamp" timestamp without time zone NOT NULL,
828 description character varying DEFAULT ''::character varying NOT NULL,
829 inserted boolean NOT NULL,
830 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
835 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
838 CREATE SEQUENCE public.gpx_files_id_seq
847 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
850 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
854 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
857 CREATE TABLE public.issue_comments (
859 issue_id integer NOT NULL,
860 user_id integer NOT NULL,
862 created_at timestamp without time zone NOT NULL,
863 updated_at timestamp without time zone NOT NULL
868 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
871 CREATE SEQUENCE public.issue_comments_id_seq
880 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
883 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
887 -- Name: issues; Type: TABLE; Schema: public; Owner: -
890 CREATE TABLE public.issues (
892 reportable_type character varying NOT NULL,
893 reportable_id integer NOT NULL,
894 reported_user_id integer,
895 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
896 assigned_role public.user_role_enum NOT NULL,
897 resolved_at timestamp without time zone,
900 reports_count integer DEFAULT 0,
901 created_at timestamp without time zone NOT NULL,
902 updated_at timestamp without time zone NOT NULL
907 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
910 CREATE SEQUENCE public.issues_id_seq
919 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
922 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
926 -- Name: languages; Type: TABLE; Schema: public; Owner: -
929 CREATE TABLE public.languages (
930 code character varying NOT NULL,
931 english_name character varying NOT NULL,
932 native_name character varying
937 -- Name: messages; Type: TABLE; Schema: public; Owner: -
940 CREATE TABLE public.messages (
942 from_user_id bigint NOT NULL,
943 title character varying NOT NULL,
945 sent_on timestamp without time zone NOT NULL,
946 message_read boolean DEFAULT false NOT NULL,
947 to_user_id bigint NOT NULL,
948 to_user_visible boolean DEFAULT true NOT NULL,
949 from_user_visible boolean DEFAULT true NOT NULL,
950 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
955 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
958 CREATE SEQUENCE public.messages_id_seq
967 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
970 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
974 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
977 CREATE TABLE public.node_tags (
978 node_id bigint NOT NULL,
979 version bigint NOT NULL,
980 k character varying DEFAULT ''::character varying NOT NULL,
981 v character varying DEFAULT ''::character varying NOT NULL
986 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
989 CREATE TABLE public.nodes (
990 node_id bigint NOT NULL,
991 latitude integer NOT NULL,
992 longitude integer NOT NULL,
993 changeset_id bigint NOT NULL,
994 visible boolean NOT NULL,
995 "timestamp" timestamp without time zone NOT NULL,
996 tile bigint NOT NULL,
997 version bigint NOT NULL,
1003 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
1006 CREATE TABLE public.note_comments (
1008 note_id bigint NOT NULL,
1009 visible boolean NOT NULL,
1010 created_at timestamp without time zone NOT NULL,
1014 event public.note_event_enum
1019 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1022 CREATE SEQUENCE public.note_comments_id_seq
1031 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1034 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
1038 -- Name: notes; Type: TABLE; Schema: public; Owner: -
1041 CREATE TABLE public.notes (
1043 latitude integer NOT NULL,
1044 longitude integer NOT NULL,
1045 tile bigint NOT NULL,
1046 updated_at timestamp without time zone NOT NULL,
1047 created_at timestamp without time zone NOT NULL,
1048 status public.note_status_enum NOT NULL,
1049 closed_at timestamp without time zone
1054 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1057 CREATE SEQUENCE public.notes_id_seq
1066 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1069 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
1073 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
1076 CREATE TABLE public.oauth_nonces (
1077 id integer NOT NULL,
1078 nonce character varying,
1079 "timestamp" integer,
1080 created_at timestamp without time zone,
1081 updated_at timestamp without time zone
1086 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1089 CREATE SEQUENCE public.oauth_nonces_id_seq
1098 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1101 ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id;
1105 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
1108 CREATE TABLE public.oauth_tokens (
1109 id integer NOT NULL,
1111 type character varying(20),
1112 client_application_id integer,
1113 token character varying(50),
1114 secret character varying(50),
1115 authorized_at timestamp without time zone,
1116 invalidated_at timestamp without time zone,
1117 created_at timestamp without time zone,
1118 updated_at timestamp without time zone,
1119 allow_read_prefs boolean DEFAULT false NOT NULL,
1120 allow_write_prefs boolean DEFAULT false NOT NULL,
1121 allow_write_diary boolean DEFAULT false NOT NULL,
1122 allow_write_api boolean DEFAULT false NOT NULL,
1123 allow_read_gpx boolean DEFAULT false NOT NULL,
1124 allow_write_gpx boolean DEFAULT false NOT NULL,
1125 callback_url character varying,
1126 verifier character varying(20),
1127 scope character varying,
1128 valid_to timestamp without time zone,
1129 allow_write_notes boolean DEFAULT false NOT NULL
1134 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1137 CREATE SEQUENCE public.oauth_tokens_id_seq
1146 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1149 ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
1153 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1156 CREATE TABLE public.redactions (
1157 id integer NOT NULL,
1158 title character varying,
1160 created_at timestamp without time zone,
1161 updated_at timestamp without time zone,
1162 user_id bigint NOT NULL,
1163 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1168 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1171 CREATE SEQUENCE public.redactions_id_seq
1180 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1183 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1187 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1190 CREATE TABLE public.relation_members (
1191 relation_id bigint DEFAULT 0 NOT NULL,
1192 member_type public.nwr_enum NOT NULL,
1193 member_id bigint NOT NULL,
1194 member_role character varying NOT NULL,
1195 version bigint DEFAULT 0 NOT NULL,
1196 sequence_id integer DEFAULT 0 NOT NULL
1201 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1204 CREATE TABLE public.relation_tags (
1205 relation_id bigint DEFAULT 0 NOT NULL,
1206 k character varying DEFAULT ''::character varying NOT NULL,
1207 v character varying DEFAULT ''::character varying NOT NULL,
1208 version bigint NOT NULL
1213 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1216 CREATE TABLE public.relations (
1217 relation_id bigint DEFAULT 0 NOT NULL,
1218 changeset_id bigint NOT NULL,
1219 "timestamp" timestamp without time zone NOT NULL,
1220 version bigint NOT NULL,
1221 visible boolean DEFAULT true NOT NULL,
1222 redaction_id integer
1227 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1230 CREATE TABLE public.reports (
1231 id integer NOT NULL,
1232 issue_id integer NOT NULL,
1233 user_id integer NOT NULL,
1234 details text NOT NULL,
1235 category character varying NOT NULL,
1236 created_at timestamp without time zone NOT NULL,
1237 updated_at timestamp without time zone NOT NULL
1242 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1245 CREATE SEQUENCE public.reports_id_seq
1254 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1257 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1261 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1264 CREATE TABLE public.schema_migrations (
1265 version character varying NOT NULL
1270 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1273 CREATE TABLE public.user_blocks (
1274 id integer NOT NULL,
1275 user_id bigint NOT NULL,
1276 creator_id bigint NOT NULL,
1277 reason text NOT NULL,
1278 ends_at timestamp without time zone NOT NULL,
1279 needs_view boolean DEFAULT false NOT NULL,
1281 created_at timestamp without time zone,
1282 updated_at timestamp without time zone,
1283 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1288 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1291 CREATE SEQUENCE public.user_blocks_id_seq
1300 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1303 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1307 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1310 CREATE TABLE public.user_preferences (
1311 user_id bigint NOT NULL,
1312 k character varying NOT NULL,
1313 v character varying NOT NULL
1318 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1321 CREATE TABLE public.user_roles (
1322 id integer NOT NULL,
1323 user_id bigint NOT NULL,
1324 role public.user_role_enum NOT NULL,
1325 created_at timestamp without time zone,
1326 updated_at timestamp without time zone,
1327 granter_id bigint NOT NULL
1332 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1335 CREATE SEQUENCE public.user_roles_id_seq
1344 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1347 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1351 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1354 CREATE TABLE public.user_tokens (
1356 user_id bigint NOT NULL,
1357 token character varying NOT NULL,
1358 expiry timestamp without time zone NOT NULL,
1364 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1367 CREATE SEQUENCE public.user_tokens_id_seq
1376 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1379 ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id;
1383 -- Name: users; Type: TABLE; Schema: public; Owner: -
1386 CREATE TABLE public.users (
1387 email character varying NOT NULL,
1389 pass_crypt character varying NOT NULL,
1390 creation_time timestamp without time zone NOT NULL,
1391 display_name character varying DEFAULT ''::character varying NOT NULL,
1392 data_public boolean DEFAULT false NOT NULL,
1393 description text DEFAULT ''::text NOT NULL,
1394 home_lat double precision,
1395 home_lon double precision,
1396 home_zoom smallint DEFAULT 3,
1397 pass_salt character varying,
1398 email_valid boolean DEFAULT false NOT NULL,
1399 new_email character varying,
1400 creation_ip character varying,
1401 languages character varying,
1402 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1403 terms_agreed timestamp without time zone,
1404 consider_pd boolean DEFAULT false NOT NULL,
1405 auth_uid character varying,
1406 preferred_editor character varying,
1407 terms_seen boolean DEFAULT false NOT NULL,
1408 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1409 changesets_count integer DEFAULT 0 NOT NULL,
1410 traces_count integer DEFAULT 0 NOT NULL,
1411 diary_entries_count integer DEFAULT 0 NOT NULL,
1412 image_use_gravatar boolean DEFAULT false NOT NULL,
1413 auth_provider character varying,
1415 tou_agreed timestamp without time zone
1420 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1423 CREATE SEQUENCE public.users_id_seq
1432 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1435 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1439 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1442 CREATE TABLE public.way_nodes (
1443 way_id bigint NOT NULL,
1444 node_id bigint NOT NULL,
1445 version bigint NOT NULL,
1446 sequence_id bigint NOT NULL
1451 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1454 CREATE TABLE public.way_tags (
1455 way_id bigint DEFAULT 0 NOT NULL,
1456 k character varying NOT NULL,
1457 v character varying NOT NULL,
1458 version bigint NOT NULL
1463 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1466 CREATE TABLE public.ways (
1467 way_id bigint DEFAULT 0 NOT NULL,
1468 changeset_id bigint NOT NULL,
1469 "timestamp" timestamp without time zone NOT NULL,
1470 version bigint NOT NULL,
1471 visible boolean DEFAULT true NOT NULL,
1472 redaction_id integer
1477 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1480 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1484 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1487 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1491 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1494 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1498 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1501 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1505 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1508 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1512 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1515 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1519 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1522 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1526 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1529 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1533 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1536 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1540 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1543 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1547 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1550 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1554 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1557 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1561 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1564 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1568 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1571 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1575 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1578 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1582 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1585 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1589 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1592 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1596 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1599 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1603 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1606 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1610 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1613 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1617 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1620 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1624 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1627 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1631 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1634 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1638 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1641 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1645 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1648 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1652 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1655 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1659 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1662 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1666 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1669 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1673 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1676 ALTER TABLE ONLY public.acls
1677 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1681 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1684 ALTER TABLE ONLY public.active_storage_attachments
1685 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1689 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1692 ALTER TABLE ONLY public.active_storage_blobs
1693 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1697 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1700 ALTER TABLE ONLY public.ar_internal_metadata
1701 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1705 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1708 ALTER TABLE ONLY public.changeset_comments
1709 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1713 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1716 ALTER TABLE ONLY public.changesets
1717 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1721 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1724 ALTER TABLE ONLY public.client_applications
1725 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1729 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1732 ALTER TABLE ONLY public.current_node_tags
1733 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1737 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1740 ALTER TABLE ONLY public.current_nodes
1741 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1745 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1748 ALTER TABLE ONLY public.current_relation_members
1749 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1753 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1756 ALTER TABLE ONLY public.current_relation_tags
1757 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1761 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1764 ALTER TABLE ONLY public.current_relations
1765 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1769 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1772 ALTER TABLE ONLY public.current_way_nodes
1773 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1777 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1780 ALTER TABLE ONLY public.current_way_tags
1781 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1785 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1788 ALTER TABLE ONLY public.current_ways
1789 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1793 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1796 ALTER TABLE ONLY public.delayed_jobs
1797 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1801 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1804 ALTER TABLE ONLY public.diary_comments
1805 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1809 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1812 ALTER TABLE ONLY public.diary_entries
1813 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1817 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1820 ALTER TABLE ONLY public.diary_entry_subscriptions
1821 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1825 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1828 ALTER TABLE ONLY public.friends
1829 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1833 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1836 ALTER TABLE ONLY public.gpx_file_tags
1837 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1841 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1844 ALTER TABLE ONLY public.gpx_files
1845 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1849 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1852 ALTER TABLE ONLY public.issue_comments
1853 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1857 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1860 ALTER TABLE ONLY public.issues
1861 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
1865 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1868 ALTER TABLE ONLY public.languages
1869 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1873 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1876 ALTER TABLE ONLY public.messages
1877 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1881 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1884 ALTER TABLE ONLY public.node_tags
1885 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1889 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1892 ALTER TABLE ONLY public.nodes
1893 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1897 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1900 ALTER TABLE ONLY public.note_comments
1901 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1905 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1908 ALTER TABLE ONLY public.notes
1909 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1913 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1916 ALTER TABLE ONLY public.oauth_nonces
1917 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1921 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1924 ALTER TABLE ONLY public.oauth_tokens
1925 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1929 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1932 ALTER TABLE ONLY public.redactions
1933 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1937 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1940 ALTER TABLE ONLY public.relation_members
1941 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1945 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1948 ALTER TABLE ONLY public.relation_tags
1949 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1953 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1956 ALTER TABLE ONLY public.relations
1957 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1961 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1964 ALTER TABLE ONLY public.reports
1965 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
1969 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1972 ALTER TABLE ONLY public.schema_migrations
1973 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
1977 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1980 ALTER TABLE ONLY public.user_blocks
1981 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1985 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1988 ALTER TABLE ONLY public.user_preferences
1989 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1993 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1996 ALTER TABLE ONLY public.user_roles
1997 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
2001 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2004 ALTER TABLE ONLY public.user_tokens
2005 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
2009 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2012 ALTER TABLE ONLY public.users
2013 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2017 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2020 ALTER TABLE ONLY public.way_nodes
2021 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2025 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2028 ALTER TABLE ONLY public.way_tags
2029 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2033 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2036 ALTER TABLE ONLY public.ways
2037 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2041 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2044 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2048 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
2051 CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id);
2055 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2058 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2062 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2065 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2069 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2072 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2076 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2079 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2083 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2086 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2090 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2093 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2097 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2100 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2104 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2107 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2111 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2114 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2118 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2121 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2125 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2128 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2132 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2135 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2139 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2142 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2146 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2149 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2153 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2156 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2160 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2163 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2167 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2170 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2174 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -
2177 CREATE INDEX friends_user_id_idx ON public.friends USING btree (user_id);
2181 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2184 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2188 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2191 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2195 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2198 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2202 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2205 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2209 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2212 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2216 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2219 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2223 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2226 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2230 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2233 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2237 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2240 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2244 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2247 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2251 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2254 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2258 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2261 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2265 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2268 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2272 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2275 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2279 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2282 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2286 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2289 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2293 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2296 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2300 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2303 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2307 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2310 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2314 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2317 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2321 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2324 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2328 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2331 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2335 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2338 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2342 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2345 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2349 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2352 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2356 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2359 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2363 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2366 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2370 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2373 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2377 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2380 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2384 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2387 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2391 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2394 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2398 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2401 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2405 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2408 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2412 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2415 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2419 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2422 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2426 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2429 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2433 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2436 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2440 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2443 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2447 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2450 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2454 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2457 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2461 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2464 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2468 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2471 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2475 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2478 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2482 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2485 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2489 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2492 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2496 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2499 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2503 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2506 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2510 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2513 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2517 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2520 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2524 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2527 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2531 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2534 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2538 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2541 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2545 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2548 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2552 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2555 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2559 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2562 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2566 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2569 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2573 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2576 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2580 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2583 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2587 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2590 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2594 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2597 ALTER TABLE ONLY public.changeset_comments
2598 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2602 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2605 ALTER TABLE ONLY public.changeset_comments
2606 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2610 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2613 ALTER TABLE ONLY public.changeset_tags
2614 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2618 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2621 ALTER TABLE ONLY public.changesets_subscribers
2622 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2626 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2629 ALTER TABLE ONLY public.changesets_subscribers
2630 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2634 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2637 ALTER TABLE ONLY public.changesets
2638 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2642 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2645 ALTER TABLE ONLY public.client_applications
2646 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2650 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2653 ALTER TABLE ONLY public.current_node_tags
2654 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2658 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2661 ALTER TABLE ONLY public.current_nodes
2662 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2666 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2669 ALTER TABLE ONLY public.current_relation_members
2670 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2674 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2677 ALTER TABLE ONLY public.current_relation_tags
2678 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2682 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2685 ALTER TABLE ONLY public.current_relations
2686 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2690 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2693 ALTER TABLE ONLY public.current_way_nodes
2694 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2698 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2701 ALTER TABLE ONLY public.current_way_nodes
2702 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2706 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2709 ALTER TABLE ONLY public.current_way_tags
2710 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2714 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2717 ALTER TABLE ONLY public.current_ways
2718 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2722 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2725 ALTER TABLE ONLY public.diary_comments
2726 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2730 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2733 ALTER TABLE ONLY public.diary_comments
2734 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2738 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2741 ALTER TABLE ONLY public.diary_entries
2742 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
2746 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2749 ALTER TABLE ONLY public.diary_entries
2750 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2754 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2757 ALTER TABLE ONLY public.diary_entry_subscriptions
2758 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2762 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2765 ALTER TABLE ONLY public.diary_entry_subscriptions
2766 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2770 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
2773 ALTER TABLE ONLY public.active_storage_attachments
2774 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
2778 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2781 ALTER TABLE ONLY public.friends
2782 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
2786 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2789 ALTER TABLE ONLY public.friends
2790 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2794 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2797 ALTER TABLE ONLY public.gps_points
2798 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2802 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2805 ALTER TABLE ONLY public.gpx_file_tags
2806 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2810 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2813 ALTER TABLE ONLY public.gpx_files
2814 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2818 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2821 ALTER TABLE ONLY public.issue_comments
2822 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2826 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2829 ALTER TABLE ONLY public.issue_comments
2830 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2834 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2837 ALTER TABLE ONLY public.issues
2838 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
2842 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2845 ALTER TABLE ONLY public.issues
2846 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
2850 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2853 ALTER TABLE ONLY public.issues
2854 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
2858 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2861 ALTER TABLE ONLY public.messages
2862 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
2866 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2869 ALTER TABLE ONLY public.messages
2870 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
2874 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2877 ALTER TABLE ONLY public.node_tags
2878 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
2882 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2885 ALTER TABLE ONLY public.nodes
2886 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2890 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2893 ALTER TABLE ONLY public.nodes
2894 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2898 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2901 ALTER TABLE ONLY public.note_comments
2902 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2906 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2909 ALTER TABLE ONLY public.note_comments
2910 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
2914 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2917 ALTER TABLE ONLY public.oauth_tokens
2918 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
2922 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2925 ALTER TABLE ONLY public.oauth_tokens
2926 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2930 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2933 ALTER TABLE ONLY public.redactions
2934 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2938 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2941 ALTER TABLE ONLY public.relation_members
2942 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2946 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2949 ALTER TABLE ONLY public.relation_tags
2950 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2954 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2957 ALTER TABLE ONLY public.relations
2958 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2962 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2965 ALTER TABLE ONLY public.relations
2966 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2970 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2973 ALTER TABLE ONLY public.reports
2974 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2978 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2981 ALTER TABLE ONLY public.reports
2982 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2986 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2989 ALTER TABLE ONLY public.user_blocks
2990 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
2994 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2997 ALTER TABLE ONLY public.user_blocks
2998 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
3002 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3005 ALTER TABLE ONLY public.user_blocks
3006 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3010 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3013 ALTER TABLE ONLY public.user_preferences
3014 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3018 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3021 ALTER TABLE ONLY public.user_roles
3022 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3026 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3029 ALTER TABLE ONLY public.user_roles
3030 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3034 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3037 ALTER TABLE ONLY public.user_tokens
3038 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3042 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3045 ALTER TABLE ONLY public.way_nodes
3046 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3050 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3053 ALTER TABLE ONLY public.way_tags
3054 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3058 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3061 ALTER TABLE ONLY public.ways
3062 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3066 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3069 ALTER TABLE ONLY public.ways
3070 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3074 -- PostgreSQL database dump complete
3077 SET search_path TO "$user", public;
3079 INSERT INTO "schema_migrations" (version) VALUES