1 SET statement_timeout = 0;
3 SET idle_in_transaction_session_timeout = 0;
4 SET client_encoding = 'UTF8';
5 SET standard_conforming_strings = on;
6 SELECT pg_catalog.set_config('search_path', '', false);
7 SET check_function_bodies = false;
8 SET client_min_messages = warning;
9 SET row_security = off;
12 -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
15 CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
19 -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
22 COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
26 -- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: -
29 CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public;
33 -- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: -
36 COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST';
40 -- Name: format_enum; Type: TYPE; Schema: public; Owner: -
43 CREATE TYPE public.format_enum AS ENUM (
51 -- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: -
54 CREATE TYPE public.gpx_visibility_enum AS ENUM (
63 -- Name: issue_status_enum; Type: TYPE; Schema: public; Owner: -
66 CREATE TYPE public.issue_status_enum AS ENUM (
74 -- Name: note_event_enum; Type: TYPE; Schema: public; Owner: -
77 CREATE TYPE public.note_event_enum AS ENUM (
87 -- Name: note_status_enum; Type: TYPE; Schema: public; Owner: -
90 CREATE TYPE public.note_status_enum AS ENUM (
98 -- Name: nwr_enum; Type: TYPE; Schema: public; Owner: -
101 CREATE TYPE public.nwr_enum AS ENUM (
109 -- Name: user_role_enum; Type: TYPE; Schema: public; Owner: -
112 CREATE TYPE public.user_role_enum AS ENUM (
119 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
122 CREATE TYPE public.user_status_enum AS ENUM (
132 -- Name: maptile_for_point(bigint, bigint, integer); Type: FUNCTION; Schema: public; Owner: -
135 CREATE FUNCTION public.maptile_for_point(scaled_lat bigint, scaled_lon bigint, zoom integer) RETURNS integer
136 LANGUAGE plpgsql IMMUTABLE
139 lat CONSTANT DOUBLE PRECISION := scaled_lat / 10000000.0;
140 lon CONSTANT DOUBLE PRECISION := scaled_lon / 10000000.0;
141 zscale CONSTANT DOUBLE PRECISION := 2.0 ^ zoom;
142 pi CONSTANT DOUBLE PRECISION := 3.141592653589793;
143 r_per_d CONSTANT DOUBLE PRECISION := pi / 180.0;
147 -- straight port of the C code. see db/functions/maptile.c
148 x := floor((lon + 180.0) * zscale / 360.0);
149 y := floor((1.0 - ln(tan(lat * r_per_d) + 1.0 / cos(lat * r_per_d)) / pi) * zscale / 2.0);
151 RETURN (x << zoom) | y;
157 -- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
160 CREATE FUNCTION public.tile_for_point(scaled_lat integer, scaled_lon integer) RETURNS bigint
161 LANGUAGE plpgsql IMMUTABLE
164 x int8; -- quantized x from lon,
165 y int8; -- quantized y from lat,
167 x := round(((scaled_lon / 10000000.0) + 180.0) * 65535.0 / 360.0);
168 y := round(((scaled_lat / 10000000.0) + 90.0) * 65535.0 / 180.0);
170 -- these bit-masks are special numbers used in the bit interleaving algorithm.
171 -- see https://graphics.stanford.edu/~seander/bithacks.html#InterleaveBMN
172 -- for the original algorithm and more details.
173 x := (x | (x << 8)) & 16711935; -- 0x00FF00FF
174 x := (x | (x << 4)) & 252645135; -- 0x0F0F0F0F
175 x := (x | (x << 2)) & 858993459; -- 0x33333333
176 x := (x | (x << 1)) & 1431655765; -- 0x55555555
178 y := (y | (y << 8)) & 16711935; -- 0x00FF00FF
179 y := (y | (y << 4)) & 252645135; -- 0x0F0F0F0F
180 y := (y | (y << 2)) & 858993459; -- 0x33333333
181 y := (y | (y << 1)) & 1431655765; -- 0x55555555
188 SET default_tablespace = '';
190 SET default_with_oids = false;
193 -- Name: acls; Type: TABLE; Schema: public; Owner: -
196 CREATE TABLE public.acls (
199 k character varying NOT NULL,
201 domain character varying,
207 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
210 CREATE SEQUENCE public.acls_id_seq
219 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
222 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
226 -- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
229 CREATE TABLE public.active_storage_attachments (
231 name character varying NOT NULL,
232 record_type character varying NOT NULL,
233 record_id bigint NOT NULL,
234 blob_id bigint NOT NULL,
235 created_at timestamp without time zone NOT NULL
240 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
243 CREATE SEQUENCE public.active_storage_attachments_id_seq
252 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
255 ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
259 -- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
262 CREATE TABLE public.active_storage_blobs (
264 key character varying NOT NULL,
265 filename character varying NOT NULL,
266 content_type character varying,
268 byte_size bigint NOT NULL,
269 checksum character varying NOT NULL,
270 created_at timestamp without time zone NOT NULL
275 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
278 CREATE SEQUENCE public.active_storage_blobs_id_seq
287 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
290 ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
294 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
297 CREATE TABLE public.ar_internal_metadata (
298 key character varying NOT NULL,
299 value character varying,
300 created_at timestamp without time zone NOT NULL,
301 updated_at timestamp without time zone NOT NULL
306 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
309 CREATE TABLE public.changeset_comments (
311 changeset_id bigint NOT NULL,
312 author_id bigint NOT NULL,
314 created_at timestamp without time zone NOT NULL,
315 visible boolean NOT NULL
320 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
323 CREATE SEQUENCE public.changeset_comments_id_seq
332 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
335 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
339 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
342 CREATE TABLE public.changeset_tags (
343 changeset_id bigint NOT NULL,
344 k character varying DEFAULT ''::character varying NOT NULL,
345 v character varying DEFAULT ''::character varying NOT NULL
350 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
353 CREATE TABLE public.changesets (
355 user_id bigint NOT NULL,
356 created_at timestamp without time zone NOT NULL,
361 closed_at timestamp without time zone NOT NULL,
362 num_changes integer DEFAULT 0 NOT NULL
367 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
370 CREATE SEQUENCE public.changesets_id_seq
379 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
382 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
386 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
389 CREATE TABLE public.changesets_subscribers (
390 subscriber_id bigint NOT NULL,
391 changeset_id bigint NOT NULL
396 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
399 CREATE TABLE public.client_applications (
401 name character varying,
402 url character varying,
403 support_url character varying,
404 callback_url character varying,
405 key character varying(50),
406 secret character varying(50),
408 created_at timestamp without time zone,
409 updated_at timestamp without time zone,
410 allow_read_prefs boolean DEFAULT false NOT NULL,
411 allow_write_prefs boolean DEFAULT false NOT NULL,
412 allow_write_diary boolean DEFAULT false NOT NULL,
413 allow_write_api boolean DEFAULT false NOT NULL,
414 allow_read_gpx boolean DEFAULT false NOT NULL,
415 allow_write_gpx boolean DEFAULT false NOT NULL,
416 allow_write_notes boolean DEFAULT false NOT NULL
421 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
424 CREATE SEQUENCE public.client_applications_id_seq
433 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
436 ALTER SEQUENCE public.client_applications_id_seq OWNED BY public.client_applications.id;
440 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
443 CREATE TABLE public.current_node_tags (
444 node_id bigint NOT NULL,
445 k character varying DEFAULT ''::character varying NOT NULL,
446 v character varying DEFAULT ''::character varying NOT NULL
451 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
454 CREATE TABLE public.current_nodes (
456 latitude integer NOT NULL,
457 longitude integer NOT NULL,
458 changeset_id bigint NOT NULL,
459 visible boolean NOT NULL,
460 "timestamp" timestamp without time zone NOT NULL,
461 tile bigint NOT NULL,
462 version bigint NOT NULL
467 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
470 CREATE SEQUENCE public.current_nodes_id_seq
479 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
482 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
486 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
489 CREATE TABLE public.current_relation_members (
490 relation_id bigint NOT NULL,
491 member_type public.nwr_enum NOT NULL,
492 member_id bigint NOT NULL,
493 member_role character varying NOT NULL,
494 sequence_id integer DEFAULT 0 NOT NULL
499 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
502 CREATE TABLE public.current_relation_tags (
503 relation_id bigint NOT NULL,
504 k character varying DEFAULT ''::character varying NOT NULL,
505 v character varying DEFAULT ''::character varying NOT NULL
510 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
513 CREATE TABLE public.current_relations (
515 changeset_id bigint NOT NULL,
516 "timestamp" timestamp without time zone NOT NULL,
517 visible boolean NOT NULL,
518 version bigint NOT NULL
523 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
526 CREATE SEQUENCE public.current_relations_id_seq
535 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
538 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
542 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
545 CREATE TABLE public.current_way_nodes (
546 way_id bigint NOT NULL,
547 node_id bigint NOT NULL,
548 sequence_id bigint NOT NULL
553 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
556 CREATE TABLE public.current_way_tags (
557 way_id bigint NOT NULL,
558 k character varying DEFAULT ''::character varying NOT NULL,
559 v character varying DEFAULT ''::character varying NOT NULL
564 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
567 CREATE TABLE public.current_ways (
569 changeset_id bigint NOT NULL,
570 "timestamp" timestamp without time zone NOT NULL,
571 visible boolean NOT NULL,
572 version bigint NOT NULL
577 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
580 CREATE SEQUENCE public.current_ways_id_seq
589 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
592 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
596 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
599 CREATE TABLE public.delayed_jobs (
601 priority integer DEFAULT 0 NOT NULL,
602 attempts integer DEFAULT 0 NOT NULL,
603 handler text NOT NULL,
605 run_at timestamp without time zone,
606 locked_at timestamp without time zone,
607 failed_at timestamp without time zone,
608 locked_by character varying,
609 queue character varying,
610 created_at timestamp without time zone,
611 updated_at timestamp without time zone
616 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
619 CREATE SEQUENCE public.delayed_jobs_id_seq
628 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
631 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
635 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
638 CREATE TABLE public.diary_comments (
640 diary_entry_id bigint NOT NULL,
641 user_id bigint NOT NULL,
643 created_at timestamp without time zone NOT NULL,
644 updated_at timestamp without time zone NOT NULL,
645 visible boolean DEFAULT true NOT NULL,
646 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
651 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
654 CREATE SEQUENCE public.diary_comments_id_seq
663 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
666 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
670 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
673 CREATE TABLE public.diary_entries (
675 user_id bigint NOT NULL,
676 title character varying NOT NULL,
678 created_at timestamp without time zone NOT NULL,
679 updated_at timestamp without time zone NOT NULL,
680 latitude double precision,
681 longitude double precision,
682 language_code character varying DEFAULT 'en'::character varying NOT NULL,
683 visible boolean DEFAULT true NOT NULL,
684 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
689 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
692 CREATE SEQUENCE public.diary_entries_id_seq
701 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
704 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
708 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
711 CREATE TABLE public.diary_entry_subscriptions (
712 user_id bigint NOT NULL,
713 diary_entry_id bigint NOT NULL
718 -- Name: friends; Type: TABLE; Schema: public; Owner: -
721 CREATE TABLE public.friends (
723 user_id bigint NOT NULL,
724 friend_user_id bigint NOT NULL
729 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
732 CREATE SEQUENCE public.friends_id_seq
741 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
744 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
748 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
751 CREATE TABLE public.gps_points (
752 altitude double precision,
753 trackid integer NOT NULL,
754 latitude integer NOT NULL,
755 longitude integer NOT NULL,
756 gpx_id bigint NOT NULL,
757 "timestamp" timestamp without time zone,
763 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
766 CREATE TABLE public.gpx_file_tags (
767 gpx_id bigint DEFAULT 0 NOT NULL,
768 tag character varying NOT NULL,
774 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
777 CREATE SEQUENCE public.gpx_file_tags_id_seq
786 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
789 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
793 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
796 CREATE TABLE public.gpx_files (
798 user_id bigint NOT NULL,
799 visible boolean DEFAULT true NOT NULL,
800 name character varying DEFAULT ''::character varying NOT NULL,
802 latitude double precision,
803 longitude double precision,
804 "timestamp" timestamp without time zone NOT NULL,
805 description character varying DEFAULT ''::character varying NOT NULL,
806 inserted boolean NOT NULL,
807 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
812 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
815 CREATE SEQUENCE public.gpx_files_id_seq
824 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
827 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
831 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
834 CREATE TABLE public.issue_comments (
836 issue_id integer NOT NULL,
837 user_id integer NOT NULL,
839 created_at timestamp without time zone NOT NULL,
840 updated_at timestamp without time zone NOT NULL
845 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
848 CREATE SEQUENCE public.issue_comments_id_seq
857 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
860 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
864 -- Name: issues; Type: TABLE; Schema: public; Owner: -
867 CREATE TABLE public.issues (
869 reportable_type character varying NOT NULL,
870 reportable_id integer NOT NULL,
871 reported_user_id integer,
872 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
873 assigned_role public.user_role_enum NOT NULL,
874 resolved_at timestamp without time zone,
877 reports_count integer DEFAULT 0,
878 created_at timestamp without time zone NOT NULL,
879 updated_at timestamp without time zone NOT NULL
884 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
887 CREATE SEQUENCE public.issues_id_seq
896 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
899 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
903 -- Name: languages; Type: TABLE; Schema: public; Owner: -
906 CREATE TABLE public.languages (
907 code character varying NOT NULL,
908 english_name character varying NOT NULL,
909 native_name character varying
914 -- Name: messages; Type: TABLE; Schema: public; Owner: -
917 CREATE TABLE public.messages (
919 from_user_id bigint NOT NULL,
920 title character varying NOT NULL,
922 sent_on timestamp without time zone NOT NULL,
923 message_read boolean DEFAULT false NOT NULL,
924 to_user_id bigint NOT NULL,
925 to_user_visible boolean DEFAULT true NOT NULL,
926 from_user_visible boolean DEFAULT true NOT NULL,
927 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
932 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
935 CREATE SEQUENCE public.messages_id_seq
944 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
947 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
951 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
954 CREATE TABLE public.node_tags (
955 node_id bigint NOT NULL,
956 version bigint NOT NULL,
957 k character varying DEFAULT ''::character varying NOT NULL,
958 v character varying DEFAULT ''::character varying NOT NULL
963 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
966 CREATE TABLE public.nodes (
967 node_id bigint NOT NULL,
968 latitude integer NOT NULL,
969 longitude integer NOT NULL,
970 changeset_id bigint NOT NULL,
971 visible boolean NOT NULL,
972 "timestamp" timestamp without time zone NOT NULL,
973 tile bigint NOT NULL,
974 version bigint NOT NULL,
980 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
983 CREATE TABLE public.note_comments (
985 note_id bigint NOT NULL,
986 visible boolean NOT NULL,
987 created_at timestamp without time zone NOT NULL,
991 event public.note_event_enum
996 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
999 CREATE SEQUENCE public.note_comments_id_seq
1008 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1011 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
1015 -- Name: notes; Type: TABLE; Schema: public; Owner: -
1018 CREATE TABLE public.notes (
1020 latitude integer NOT NULL,
1021 longitude integer NOT NULL,
1022 tile bigint NOT NULL,
1023 updated_at timestamp without time zone NOT NULL,
1024 created_at timestamp without time zone NOT NULL,
1025 status public.note_status_enum NOT NULL,
1026 closed_at timestamp without time zone
1031 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1034 CREATE SEQUENCE public.notes_id_seq
1043 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1046 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
1050 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
1053 CREATE TABLE public.oauth_nonces (
1054 id integer NOT NULL,
1055 nonce character varying,
1056 "timestamp" integer,
1057 created_at timestamp without time zone,
1058 updated_at timestamp without time zone
1063 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1066 CREATE SEQUENCE public.oauth_nonces_id_seq
1075 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1078 ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id;
1082 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
1085 CREATE TABLE public.oauth_tokens (
1086 id integer NOT NULL,
1088 type character varying(20),
1089 client_application_id integer,
1090 token character varying(50),
1091 secret character varying(50),
1092 authorized_at timestamp without time zone,
1093 invalidated_at timestamp without time zone,
1094 created_at timestamp without time zone,
1095 updated_at timestamp without time zone,
1096 allow_read_prefs boolean DEFAULT false NOT NULL,
1097 allow_write_prefs boolean DEFAULT false NOT NULL,
1098 allow_write_diary boolean DEFAULT false NOT NULL,
1099 allow_write_api boolean DEFAULT false NOT NULL,
1100 allow_read_gpx boolean DEFAULT false NOT NULL,
1101 allow_write_gpx boolean DEFAULT false NOT NULL,
1102 callback_url character varying,
1103 verifier character varying(20),
1104 scope character varying,
1105 valid_to timestamp without time zone,
1106 allow_write_notes boolean DEFAULT false NOT NULL
1111 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1114 CREATE SEQUENCE public.oauth_tokens_id_seq
1123 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1126 ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
1130 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1133 CREATE TABLE public.redactions (
1134 id integer NOT NULL,
1135 title character varying,
1137 created_at timestamp without time zone,
1138 updated_at timestamp without time zone,
1139 user_id bigint NOT NULL,
1140 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1145 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1148 CREATE SEQUENCE public.redactions_id_seq
1157 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1160 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1164 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1167 CREATE TABLE public.relation_members (
1168 relation_id bigint DEFAULT 0 NOT NULL,
1169 member_type public.nwr_enum NOT NULL,
1170 member_id bigint NOT NULL,
1171 member_role character varying NOT NULL,
1172 version bigint DEFAULT 0 NOT NULL,
1173 sequence_id integer DEFAULT 0 NOT NULL
1178 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1181 CREATE TABLE public.relation_tags (
1182 relation_id bigint DEFAULT 0 NOT NULL,
1183 k character varying DEFAULT ''::character varying NOT NULL,
1184 v character varying DEFAULT ''::character varying NOT NULL,
1185 version bigint NOT NULL
1190 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1193 CREATE TABLE public.relations (
1194 relation_id bigint DEFAULT 0 NOT NULL,
1195 changeset_id bigint NOT NULL,
1196 "timestamp" timestamp without time zone NOT NULL,
1197 version bigint NOT NULL,
1198 visible boolean DEFAULT true NOT NULL,
1199 redaction_id integer
1204 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1207 CREATE TABLE public.reports (
1208 id integer NOT NULL,
1209 issue_id integer NOT NULL,
1210 user_id integer NOT NULL,
1211 details text NOT NULL,
1212 category character varying NOT NULL,
1213 created_at timestamp without time zone NOT NULL,
1214 updated_at timestamp without time zone NOT NULL
1219 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1222 CREATE SEQUENCE public.reports_id_seq
1231 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1234 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1238 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1241 CREATE TABLE public.schema_migrations (
1242 version character varying NOT NULL
1247 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1250 CREATE TABLE public.user_blocks (
1251 id integer NOT NULL,
1252 user_id bigint NOT NULL,
1253 creator_id bigint NOT NULL,
1254 reason text NOT NULL,
1255 ends_at timestamp without time zone NOT NULL,
1256 needs_view boolean DEFAULT false NOT NULL,
1258 created_at timestamp without time zone,
1259 updated_at timestamp without time zone,
1260 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1265 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1268 CREATE SEQUENCE public.user_blocks_id_seq
1277 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1280 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1284 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1287 CREATE TABLE public.user_preferences (
1288 user_id bigint NOT NULL,
1289 k character varying NOT NULL,
1290 v character varying NOT NULL
1295 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1298 CREATE TABLE public.user_roles (
1299 id integer NOT NULL,
1300 user_id bigint NOT NULL,
1301 role public.user_role_enum NOT NULL,
1302 created_at timestamp without time zone,
1303 updated_at timestamp without time zone,
1304 granter_id bigint NOT NULL
1309 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1312 CREATE SEQUENCE public.user_roles_id_seq
1321 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1324 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1328 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1331 CREATE TABLE public.user_tokens (
1333 user_id bigint NOT NULL,
1334 token character varying NOT NULL,
1335 expiry timestamp without time zone NOT NULL,
1341 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1344 CREATE SEQUENCE public.user_tokens_id_seq
1353 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1356 ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id;
1360 -- Name: users; Type: TABLE; Schema: public; Owner: -
1363 CREATE TABLE public.users (
1364 email character varying NOT NULL,
1366 pass_crypt character varying NOT NULL,
1367 creation_time timestamp without time zone NOT NULL,
1368 display_name character varying DEFAULT ''::character varying NOT NULL,
1369 data_public boolean DEFAULT false NOT NULL,
1370 description text DEFAULT ''::text NOT NULL,
1371 home_lat double precision,
1372 home_lon double precision,
1373 home_zoom smallint DEFAULT 3,
1374 nearby integer DEFAULT 50,
1375 pass_salt character varying,
1376 email_valid boolean DEFAULT false NOT NULL,
1377 new_email character varying,
1378 creation_ip character varying,
1379 languages character varying,
1380 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1381 terms_agreed timestamp without time zone,
1382 consider_pd boolean DEFAULT false NOT NULL,
1383 auth_uid character varying,
1384 preferred_editor character varying,
1385 terms_seen boolean DEFAULT false NOT NULL,
1386 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1387 changesets_count integer DEFAULT 0 NOT NULL,
1388 traces_count integer DEFAULT 0 NOT NULL,
1389 diary_entries_count integer DEFAULT 0 NOT NULL,
1390 image_use_gravatar boolean DEFAULT false NOT NULL,
1391 auth_provider character varying,
1393 tou_agreed timestamp without time zone
1398 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1401 CREATE SEQUENCE public.users_id_seq
1410 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1413 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1417 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1420 CREATE TABLE public.way_nodes (
1421 way_id bigint NOT NULL,
1422 node_id bigint NOT NULL,
1423 version bigint NOT NULL,
1424 sequence_id bigint NOT NULL
1429 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1432 CREATE TABLE public.way_tags (
1433 way_id bigint DEFAULT 0 NOT NULL,
1434 k character varying NOT NULL,
1435 v character varying NOT NULL,
1436 version bigint NOT NULL
1441 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1444 CREATE TABLE public.ways (
1445 way_id bigint DEFAULT 0 NOT NULL,
1446 changeset_id bigint NOT NULL,
1447 "timestamp" timestamp without time zone NOT NULL,
1448 version bigint NOT NULL,
1449 visible boolean DEFAULT true NOT NULL,
1450 redaction_id integer
1455 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1458 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1462 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1465 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1469 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1472 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1476 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1479 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1483 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1486 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1490 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1493 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1497 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1500 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1504 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1507 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1511 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1514 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1518 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1521 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1525 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1528 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1532 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1535 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1539 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1542 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1546 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1549 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1553 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1556 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1560 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1563 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1567 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1570 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1574 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1577 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1581 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1584 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1588 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1591 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1595 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1598 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1602 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1605 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1609 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1612 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1616 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1619 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1623 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1626 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1630 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1633 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1637 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1640 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1644 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1647 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1651 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1654 ALTER TABLE ONLY public.acls
1655 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1659 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1662 ALTER TABLE ONLY public.active_storage_attachments
1663 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1667 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1670 ALTER TABLE ONLY public.active_storage_blobs
1671 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1675 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1678 ALTER TABLE ONLY public.ar_internal_metadata
1679 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1683 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1686 ALTER TABLE ONLY public.changeset_comments
1687 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1691 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1694 ALTER TABLE ONLY public.changesets
1695 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1699 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1702 ALTER TABLE ONLY public.client_applications
1703 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1707 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1710 ALTER TABLE ONLY public.current_node_tags
1711 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1715 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1718 ALTER TABLE ONLY public.current_nodes
1719 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1723 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1726 ALTER TABLE ONLY public.current_relation_members
1727 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1731 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1734 ALTER TABLE ONLY public.current_relation_tags
1735 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1739 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1742 ALTER TABLE ONLY public.current_relations
1743 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1747 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1750 ALTER TABLE ONLY public.current_way_nodes
1751 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1755 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1758 ALTER TABLE ONLY public.current_way_tags
1759 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1763 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1766 ALTER TABLE ONLY public.current_ways
1767 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1771 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1774 ALTER TABLE ONLY public.delayed_jobs
1775 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1779 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1782 ALTER TABLE ONLY public.diary_comments
1783 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1787 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1790 ALTER TABLE ONLY public.diary_entries
1791 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1795 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1798 ALTER TABLE ONLY public.diary_entry_subscriptions
1799 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1803 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1806 ALTER TABLE ONLY public.friends
1807 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1811 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1814 ALTER TABLE ONLY public.gpx_file_tags
1815 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1819 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1822 ALTER TABLE ONLY public.gpx_files
1823 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1827 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1830 ALTER TABLE ONLY public.issue_comments
1831 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1835 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1838 ALTER TABLE ONLY public.issues
1839 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
1843 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1846 ALTER TABLE ONLY public.languages
1847 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1851 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1854 ALTER TABLE ONLY public.messages
1855 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1859 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1862 ALTER TABLE ONLY public.node_tags
1863 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1867 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1870 ALTER TABLE ONLY public.nodes
1871 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1875 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1878 ALTER TABLE ONLY public.note_comments
1879 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1883 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1886 ALTER TABLE ONLY public.notes
1887 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1891 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1894 ALTER TABLE ONLY public.oauth_nonces
1895 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1899 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1902 ALTER TABLE ONLY public.oauth_tokens
1903 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1907 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1910 ALTER TABLE ONLY public.redactions
1911 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1915 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1918 ALTER TABLE ONLY public.relation_members
1919 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1923 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1926 ALTER TABLE ONLY public.relation_tags
1927 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1931 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1934 ALTER TABLE ONLY public.relations
1935 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1939 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1942 ALTER TABLE ONLY public.reports
1943 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
1947 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1950 ALTER TABLE ONLY public.schema_migrations
1951 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
1955 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1958 ALTER TABLE ONLY public.user_blocks
1959 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1963 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1966 ALTER TABLE ONLY public.user_preferences
1967 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1971 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1974 ALTER TABLE ONLY public.user_roles
1975 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1979 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1982 ALTER TABLE ONLY public.user_tokens
1983 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
1987 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1990 ALTER TABLE ONLY public.users
1991 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
1995 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1998 ALTER TABLE ONLY public.way_nodes
1999 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2003 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2006 ALTER TABLE ONLY public.way_tags
2007 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2011 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2014 ALTER TABLE ONLY public.ways
2015 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2019 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2022 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2026 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
2029 CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id);
2033 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2036 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2040 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2043 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2047 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2050 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2054 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2057 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2061 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2064 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2068 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2071 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2075 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2078 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2082 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2085 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2089 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2092 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2096 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2099 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2103 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2106 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2110 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2113 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2117 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2120 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2124 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2127 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2131 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2134 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2138 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2141 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2145 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2148 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2152 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -
2155 CREATE INDEX friends_user_id_idx ON public.friends USING btree (user_id);
2159 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2162 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2166 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2169 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2173 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2176 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2180 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2183 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2187 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2190 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2194 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2197 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2201 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2204 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2208 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2211 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2215 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2218 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2222 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2225 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2229 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2232 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2236 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2239 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2243 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2246 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2250 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2253 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2257 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2260 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2264 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2267 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2271 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2274 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2278 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2281 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2285 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2288 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2292 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2295 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2299 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2302 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2306 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2309 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2313 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2316 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2320 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2323 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2327 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2330 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2334 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2337 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2341 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2344 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2348 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2351 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2355 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2358 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2362 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2365 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2369 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2372 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2376 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2379 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2383 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2386 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2390 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2393 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2397 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2400 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2404 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2407 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2411 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2414 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2418 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2421 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2425 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2428 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2432 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2435 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2439 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2442 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2446 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2449 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2453 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2456 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2460 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2463 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2467 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2470 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2474 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2477 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2481 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2484 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2488 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2491 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2495 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2498 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2502 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2505 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2509 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2512 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2516 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2519 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2523 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2526 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2530 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2533 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2537 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2540 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2544 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2547 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2551 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2554 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2558 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2561 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2565 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2568 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2572 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2575 ALTER TABLE ONLY public.changeset_comments
2576 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2580 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2583 ALTER TABLE ONLY public.changeset_comments
2584 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2588 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2591 ALTER TABLE ONLY public.changeset_tags
2592 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2596 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2599 ALTER TABLE ONLY public.changesets_subscribers
2600 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2604 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2607 ALTER TABLE ONLY public.changesets_subscribers
2608 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2612 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2615 ALTER TABLE ONLY public.changesets
2616 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2620 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2623 ALTER TABLE ONLY public.client_applications
2624 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2628 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2631 ALTER TABLE ONLY public.current_node_tags
2632 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2636 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2639 ALTER TABLE ONLY public.current_nodes
2640 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2644 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2647 ALTER TABLE ONLY public.current_relation_members
2648 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2652 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2655 ALTER TABLE ONLY public.current_relation_tags
2656 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2660 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2663 ALTER TABLE ONLY public.current_relations
2664 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2668 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2671 ALTER TABLE ONLY public.current_way_nodes
2672 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2676 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2679 ALTER TABLE ONLY public.current_way_nodes
2680 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2684 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2687 ALTER TABLE ONLY public.current_way_tags
2688 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2692 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2695 ALTER TABLE ONLY public.current_ways
2696 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2700 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2703 ALTER TABLE ONLY public.diary_comments
2704 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2708 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2711 ALTER TABLE ONLY public.diary_comments
2712 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2716 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2719 ALTER TABLE ONLY public.diary_entries
2720 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
2724 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2727 ALTER TABLE ONLY public.diary_entries
2728 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2732 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2735 ALTER TABLE ONLY public.diary_entry_subscriptions
2736 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2740 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2743 ALTER TABLE ONLY public.diary_entry_subscriptions
2744 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2748 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
2751 ALTER TABLE ONLY public.active_storage_attachments
2752 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
2756 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2759 ALTER TABLE ONLY public.friends
2760 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
2764 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2767 ALTER TABLE ONLY public.friends
2768 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2772 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2775 ALTER TABLE ONLY public.gps_points
2776 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2780 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2783 ALTER TABLE ONLY public.gpx_file_tags
2784 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2788 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2791 ALTER TABLE ONLY public.gpx_files
2792 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2796 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2799 ALTER TABLE ONLY public.issue_comments
2800 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2804 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2807 ALTER TABLE ONLY public.issue_comments
2808 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2812 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2815 ALTER TABLE ONLY public.issues
2816 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
2820 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2823 ALTER TABLE ONLY public.issues
2824 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
2828 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2831 ALTER TABLE ONLY public.issues
2832 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
2836 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2839 ALTER TABLE ONLY public.messages
2840 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
2844 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2847 ALTER TABLE ONLY public.messages
2848 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
2852 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2855 ALTER TABLE ONLY public.node_tags
2856 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
2860 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2863 ALTER TABLE ONLY public.nodes
2864 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2868 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2871 ALTER TABLE ONLY public.nodes
2872 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2876 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2879 ALTER TABLE ONLY public.note_comments
2880 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2884 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2887 ALTER TABLE ONLY public.note_comments
2888 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
2892 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2895 ALTER TABLE ONLY public.oauth_tokens
2896 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
2900 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2903 ALTER TABLE ONLY public.oauth_tokens
2904 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2908 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2911 ALTER TABLE ONLY public.redactions
2912 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2916 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2919 ALTER TABLE ONLY public.relation_members
2920 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2924 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2927 ALTER TABLE ONLY public.relation_tags
2928 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2932 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2935 ALTER TABLE ONLY public.relations
2936 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2940 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2943 ALTER TABLE ONLY public.relations
2944 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2948 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2951 ALTER TABLE ONLY public.reports
2952 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2956 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2959 ALTER TABLE ONLY public.reports
2960 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2964 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2967 ALTER TABLE ONLY public.user_blocks
2968 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
2972 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2975 ALTER TABLE ONLY public.user_blocks
2976 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
2980 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2983 ALTER TABLE ONLY public.user_blocks
2984 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2988 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2991 ALTER TABLE ONLY public.user_preferences
2992 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2996 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2999 ALTER TABLE ONLY public.user_roles
3000 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3004 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3007 ALTER TABLE ONLY public.user_roles
3008 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3012 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3015 ALTER TABLE ONLY public.user_tokens
3016 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3020 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3023 ALTER TABLE ONLY public.way_nodes
3024 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3028 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3031 ALTER TABLE ONLY public.way_tags
3032 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3036 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3039 ALTER TABLE ONLY public.ways
3040 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3044 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3047 ALTER TABLE ONLY public.ways
3048 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3052 -- PostgreSQL database dump complete
3055 SET search_path TO "$user", public;
3057 INSERT INTO "schema_migrations" (version) VALUES