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 without time zone NOT NULL,
324 updated_at timestamp 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 nearby integer DEFAULT 50,
1398 pass_salt character varying,
1399 email_valid boolean DEFAULT false NOT NULL,
1400 new_email character varying,
1401 creation_ip character varying,
1402 languages character varying,
1403 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1404 terms_agreed timestamp without time zone,
1405 consider_pd boolean DEFAULT false NOT NULL,
1406 auth_uid character varying,
1407 preferred_editor character varying,
1408 terms_seen boolean DEFAULT false NOT NULL,
1409 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1410 changesets_count integer DEFAULT 0 NOT NULL,
1411 traces_count integer DEFAULT 0 NOT NULL,
1412 diary_entries_count integer DEFAULT 0 NOT NULL,
1413 image_use_gravatar boolean DEFAULT false NOT NULL,
1414 auth_provider character varying,
1416 tou_agreed timestamp without time zone
1421 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1424 CREATE SEQUENCE public.users_id_seq
1433 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1436 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1440 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1443 CREATE TABLE public.way_nodes (
1444 way_id bigint NOT NULL,
1445 node_id bigint NOT NULL,
1446 version bigint NOT NULL,
1447 sequence_id bigint NOT NULL
1452 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1455 CREATE TABLE public.way_tags (
1456 way_id bigint DEFAULT 0 NOT NULL,
1457 k character varying NOT NULL,
1458 v character varying NOT NULL,
1459 version bigint NOT NULL
1464 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1467 CREATE TABLE public.ways (
1468 way_id bigint DEFAULT 0 NOT NULL,
1469 changeset_id bigint NOT NULL,
1470 "timestamp" timestamp without time zone NOT NULL,
1471 version bigint NOT NULL,
1472 visible boolean DEFAULT true NOT NULL,
1473 redaction_id integer
1478 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1481 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1485 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1488 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1492 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1495 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1499 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1502 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1506 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1509 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1513 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1516 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1520 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1523 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1527 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1530 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1534 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1537 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1541 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1544 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1548 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1551 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1555 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1558 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1562 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1565 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1569 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1572 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1576 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1579 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1583 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1586 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1590 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1593 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1597 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1600 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1604 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1607 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1611 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1614 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1618 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1621 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1625 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1628 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1632 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1635 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1639 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1642 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1646 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1649 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1653 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1656 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1660 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1663 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1667 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1670 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1674 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1677 ALTER TABLE ONLY public.acls
1678 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1682 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1685 ALTER TABLE ONLY public.active_storage_attachments
1686 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1690 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1693 ALTER TABLE ONLY public.active_storage_blobs
1694 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1698 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1701 ALTER TABLE ONLY public.ar_internal_metadata
1702 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1706 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1709 ALTER TABLE ONLY public.changeset_comments
1710 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1714 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1717 ALTER TABLE ONLY public.changesets
1718 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1722 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1725 ALTER TABLE ONLY public.client_applications
1726 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1730 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1733 ALTER TABLE ONLY public.current_node_tags
1734 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1738 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1741 ALTER TABLE ONLY public.current_nodes
1742 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1746 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1749 ALTER TABLE ONLY public.current_relation_members
1750 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1754 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1757 ALTER TABLE ONLY public.current_relation_tags
1758 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1762 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1765 ALTER TABLE ONLY public.current_relations
1766 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1770 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1773 ALTER TABLE ONLY public.current_way_nodes
1774 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1778 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1781 ALTER TABLE ONLY public.current_way_tags
1782 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1786 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1789 ALTER TABLE ONLY public.current_ways
1790 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1794 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1797 ALTER TABLE ONLY public.delayed_jobs
1798 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1802 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1805 ALTER TABLE ONLY public.diary_comments
1806 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1810 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1813 ALTER TABLE ONLY public.diary_entries
1814 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1818 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1821 ALTER TABLE ONLY public.diary_entry_subscriptions
1822 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1826 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1829 ALTER TABLE ONLY public.friends
1830 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1834 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1837 ALTER TABLE ONLY public.gpx_file_tags
1838 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1842 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1845 ALTER TABLE ONLY public.gpx_files
1846 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1850 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1853 ALTER TABLE ONLY public.issue_comments
1854 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1858 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1861 ALTER TABLE ONLY public.issues
1862 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
1866 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1869 ALTER TABLE ONLY public.languages
1870 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1874 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1877 ALTER TABLE ONLY public.messages
1878 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1882 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1885 ALTER TABLE ONLY public.node_tags
1886 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1890 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1893 ALTER TABLE ONLY public.nodes
1894 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1898 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1901 ALTER TABLE ONLY public.note_comments
1902 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1906 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1909 ALTER TABLE ONLY public.notes
1910 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1914 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1917 ALTER TABLE ONLY public.oauth_nonces
1918 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1922 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1925 ALTER TABLE ONLY public.oauth_tokens
1926 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1930 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1933 ALTER TABLE ONLY public.redactions
1934 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1938 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1941 ALTER TABLE ONLY public.relation_members
1942 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1946 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1949 ALTER TABLE ONLY public.relation_tags
1950 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1954 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1957 ALTER TABLE ONLY public.relations
1958 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1962 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1965 ALTER TABLE ONLY public.reports
1966 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
1970 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1973 ALTER TABLE ONLY public.schema_migrations
1974 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
1978 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1981 ALTER TABLE ONLY public.user_blocks
1982 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1986 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1989 ALTER TABLE ONLY public.user_preferences
1990 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1994 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1997 ALTER TABLE ONLY public.user_roles
1998 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
2002 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2005 ALTER TABLE ONLY public.user_tokens
2006 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
2010 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2013 ALTER TABLE ONLY public.users
2014 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2018 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2021 ALTER TABLE ONLY public.way_nodes
2022 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2026 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2029 ALTER TABLE ONLY public.way_tags
2030 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2034 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2037 ALTER TABLE ONLY public.ways
2038 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2042 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2045 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2049 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
2052 CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id);
2056 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2059 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2063 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2066 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2070 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2073 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2077 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2080 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2084 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2087 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2091 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2094 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2098 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2101 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2105 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2108 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2112 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2115 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2119 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2122 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2126 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2129 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2133 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2136 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2140 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2143 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2147 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2150 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2154 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2157 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2161 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2164 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2168 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2171 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2175 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -
2178 CREATE INDEX friends_user_id_idx ON public.friends USING btree (user_id);
2182 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2185 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2189 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2192 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2196 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2199 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2203 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2206 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2210 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2213 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2217 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2220 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2224 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2227 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2231 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2234 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2238 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2241 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2245 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2248 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2252 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2255 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2259 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2262 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2266 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2269 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2273 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2276 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2280 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2283 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2287 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2290 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2294 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2297 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2301 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2304 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2308 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2311 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2315 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2318 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2322 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2325 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2329 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2332 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2336 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2339 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2343 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2346 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2350 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2353 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2357 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2360 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2364 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2367 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2371 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2374 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2378 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2381 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2385 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2388 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2392 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2395 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2399 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2402 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2406 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2409 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2413 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2416 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2420 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2423 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2427 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2430 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2434 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2437 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2441 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2444 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2448 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2451 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2455 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2458 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2462 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2465 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2469 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2472 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2476 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2479 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2483 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2486 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2490 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2493 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2497 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2500 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2504 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2507 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2511 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2514 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2518 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2521 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2525 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2528 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2532 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2535 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2539 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2542 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2546 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2549 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2553 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2556 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2560 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2563 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2567 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2570 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2574 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2577 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2581 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2584 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2588 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2591 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2595 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2598 ALTER TABLE ONLY public.changeset_comments
2599 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2603 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2606 ALTER TABLE ONLY public.changeset_comments
2607 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2611 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2614 ALTER TABLE ONLY public.changeset_tags
2615 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2619 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2622 ALTER TABLE ONLY public.changesets_subscribers
2623 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2627 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2630 ALTER TABLE ONLY public.changesets_subscribers
2631 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2635 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2638 ALTER TABLE ONLY public.changesets
2639 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2643 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2646 ALTER TABLE ONLY public.client_applications
2647 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2651 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2654 ALTER TABLE ONLY public.current_node_tags
2655 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2659 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2662 ALTER TABLE ONLY public.current_nodes
2663 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2667 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2670 ALTER TABLE ONLY public.current_relation_members
2671 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2675 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2678 ALTER TABLE ONLY public.current_relation_tags
2679 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2683 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2686 ALTER TABLE ONLY public.current_relations
2687 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2691 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2694 ALTER TABLE ONLY public.current_way_nodes
2695 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2699 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2702 ALTER TABLE ONLY public.current_way_nodes
2703 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2707 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2710 ALTER TABLE ONLY public.current_way_tags
2711 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2715 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2718 ALTER TABLE ONLY public.current_ways
2719 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2723 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2726 ALTER TABLE ONLY public.diary_comments
2727 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2731 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2734 ALTER TABLE ONLY public.diary_comments
2735 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2739 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2742 ALTER TABLE ONLY public.diary_entries
2743 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
2747 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2750 ALTER TABLE ONLY public.diary_entries
2751 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2755 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2758 ALTER TABLE ONLY public.diary_entry_subscriptions
2759 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2763 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2766 ALTER TABLE ONLY public.diary_entry_subscriptions
2767 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2771 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
2774 ALTER TABLE ONLY public.active_storage_attachments
2775 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
2779 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2782 ALTER TABLE ONLY public.friends
2783 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
2787 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2790 ALTER TABLE ONLY public.friends
2791 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2795 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2798 ALTER TABLE ONLY public.gps_points
2799 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2803 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2806 ALTER TABLE ONLY public.gpx_file_tags
2807 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2811 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2814 ALTER TABLE ONLY public.gpx_files
2815 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2819 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2822 ALTER TABLE ONLY public.issue_comments
2823 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2827 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2830 ALTER TABLE ONLY public.issue_comments
2831 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2835 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2838 ALTER TABLE ONLY public.issues
2839 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
2843 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2846 ALTER TABLE ONLY public.issues
2847 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
2851 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2854 ALTER TABLE ONLY public.issues
2855 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
2859 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2862 ALTER TABLE ONLY public.messages
2863 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
2867 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2870 ALTER TABLE ONLY public.messages
2871 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
2875 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2878 ALTER TABLE ONLY public.node_tags
2879 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
2883 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2886 ALTER TABLE ONLY public.nodes
2887 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2891 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2894 ALTER TABLE ONLY public.nodes
2895 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2899 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2902 ALTER TABLE ONLY public.note_comments
2903 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2907 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2910 ALTER TABLE ONLY public.note_comments
2911 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
2915 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2918 ALTER TABLE ONLY public.oauth_tokens
2919 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
2923 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2926 ALTER TABLE ONLY public.oauth_tokens
2927 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2931 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2934 ALTER TABLE ONLY public.redactions
2935 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2939 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2942 ALTER TABLE ONLY public.relation_members
2943 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2947 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2950 ALTER TABLE ONLY public.relation_tags
2951 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2955 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2958 ALTER TABLE ONLY public.relations
2959 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2963 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2966 ALTER TABLE ONLY public.relations
2967 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2971 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2974 ALTER TABLE ONLY public.reports
2975 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2979 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2982 ALTER TABLE ONLY public.reports
2983 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2987 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2990 ALTER TABLE ONLY public.user_blocks
2991 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
2995 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2998 ALTER TABLE ONLY public.user_blocks
2999 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
3003 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3006 ALTER TABLE ONLY public.user_blocks
3007 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3011 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3014 ALTER TABLE ONLY public.user_preferences
3015 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3019 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3022 ALTER TABLE ONLY public.user_roles
3023 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3027 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3030 ALTER TABLE ONLY public.user_roles
3031 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3035 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3038 ALTER TABLE ONLY public.user_tokens
3039 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3043 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3046 ALTER TABLE ONLY public.way_nodes
3047 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3051 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3054 ALTER TABLE ONLY public.way_tags
3055 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3059 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3062 ALTER TABLE ONLY public.ways
3063 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3067 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3070 ALTER TABLE ONLY public.ways
3071 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3075 -- PostgreSQL database dump complete
3078 SET search_path TO "$user", public;
3080 INSERT INTO "schema_migrations" (version) VALUES