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 xmloption = content;
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: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
135 CREATE FUNCTION public.tile_for_point(scaled_lat integer, scaled_lon integer) RETURNS bigint
136 LANGUAGE plpgsql IMMUTABLE
139 x int8; -- quantized x from lon,
140 y int8; -- quantized y from lat,
142 x := round(((scaled_lon / 10000000.0) + 180.0) * 65535.0 / 360.0);
143 y := round(((scaled_lat / 10000000.0) + 90.0) * 65535.0 / 180.0);
145 -- these bit-masks are special numbers used in the bit interleaving algorithm.
146 -- see https://graphics.stanford.edu/~seander/bithacks.html#InterleaveBMN
147 -- for the original algorithm and more details.
148 x := (x | (x << 8)) & 16711935; -- 0x00FF00FF
149 x := (x | (x << 4)) & 252645135; -- 0x0F0F0F0F
150 x := (x | (x << 2)) & 858993459; -- 0x33333333
151 x := (x | (x << 1)) & 1431655765; -- 0x55555555
153 y := (y | (y << 8)) & 16711935; -- 0x00FF00FF
154 y := (y | (y << 4)) & 252645135; -- 0x0F0F0F0F
155 y := (y | (y << 2)) & 858993459; -- 0x33333333
156 y := (y | (y << 1)) & 1431655765; -- 0x55555555
164 -- Name: xid_to_int4(xid); Type: FUNCTION; Schema: public; Owner: -
167 CREATE FUNCTION public.xid_to_int4(t xid) RETURNS integer
168 LANGUAGE plpgsql STRICT
176 IF tl >= 2147483648 THEN
177 tl := tl - 4294967296;
187 SET default_tablespace = '';
189 SET default_with_oids = false;
192 -- Name: acls; Type: TABLE; Schema: public; Owner: -
195 CREATE TABLE public.acls (
198 k character varying NOT NULL,
200 domain character varying,
206 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
209 CREATE SEQUENCE public.acls_id_seq
218 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
221 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
225 -- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
228 CREATE TABLE public.active_storage_attachments (
230 name character varying NOT NULL,
231 record_type character varying NOT NULL,
232 record_id bigint NOT NULL,
233 blob_id bigint NOT NULL,
234 created_at timestamp without time zone NOT NULL
239 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
242 CREATE SEQUENCE public.active_storage_attachments_id_seq
251 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
254 ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
258 -- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
261 CREATE TABLE public.active_storage_blobs (
263 key character varying NOT NULL,
264 filename character varying NOT NULL,
265 content_type character varying,
267 byte_size bigint NOT NULL,
268 checksum character varying NOT NULL,
269 created_at timestamp without time zone NOT NULL
274 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
277 CREATE SEQUENCE public.active_storage_blobs_id_seq
286 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
289 ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
293 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
296 CREATE TABLE public.ar_internal_metadata (
297 key character varying NOT NULL,
298 value character varying,
299 created_at timestamp(6) without time zone NOT NULL,
300 updated_at timestamp(6) without time zone NOT NULL
305 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
308 CREATE TABLE public.changeset_comments (
310 changeset_id bigint NOT NULL,
311 author_id bigint NOT NULL,
313 created_at timestamp without time zone NOT NULL,
314 visible boolean NOT NULL
319 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
322 CREATE SEQUENCE public.changeset_comments_id_seq
331 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
334 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
338 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
341 CREATE TABLE public.changeset_tags (
342 changeset_id bigint NOT NULL,
343 k character varying DEFAULT ''::character varying NOT NULL,
344 v character varying DEFAULT ''::character varying NOT NULL
349 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
352 CREATE TABLE public.changesets (
354 user_id bigint NOT NULL,
355 created_at timestamp without time zone NOT NULL,
360 closed_at timestamp without time zone NOT NULL,
361 num_changes integer DEFAULT 0 NOT NULL
366 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
369 CREATE SEQUENCE public.changesets_id_seq
378 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
381 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
385 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
388 CREATE TABLE public.changesets_subscribers (
389 subscriber_id bigint NOT NULL,
390 changeset_id bigint NOT NULL
395 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
398 CREATE TABLE public.client_applications (
400 name character varying,
401 url character varying,
402 support_url character varying,
403 callback_url character varying,
404 key character varying(50),
405 secret character varying(50),
407 created_at timestamp without time zone,
408 updated_at timestamp without time zone,
409 allow_read_prefs boolean DEFAULT false NOT NULL,
410 allow_write_prefs boolean DEFAULT false NOT NULL,
411 allow_write_diary boolean DEFAULT false NOT NULL,
412 allow_write_api boolean DEFAULT false NOT NULL,
413 allow_read_gpx boolean DEFAULT false NOT NULL,
414 allow_write_gpx boolean DEFAULT false NOT NULL,
415 allow_write_notes boolean DEFAULT false NOT NULL
420 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
423 CREATE SEQUENCE public.client_applications_id_seq
432 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
435 ALTER SEQUENCE public.client_applications_id_seq OWNED BY public.client_applications.id;
439 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
442 CREATE TABLE public.current_node_tags (
443 node_id bigint NOT NULL,
444 k character varying DEFAULT ''::character varying NOT NULL,
445 v character varying DEFAULT ''::character varying NOT NULL
450 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
453 CREATE TABLE public.current_nodes (
455 latitude integer NOT NULL,
456 longitude integer NOT NULL,
457 changeset_id bigint NOT NULL,
458 visible boolean NOT NULL,
459 "timestamp" timestamp without time zone NOT NULL,
460 tile bigint NOT NULL,
461 version bigint NOT NULL
466 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
469 CREATE SEQUENCE public.current_nodes_id_seq
478 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
481 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
485 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
488 CREATE TABLE public.current_relation_members (
489 relation_id bigint NOT NULL,
490 member_type public.nwr_enum NOT NULL,
491 member_id bigint NOT NULL,
492 member_role character varying NOT NULL,
493 sequence_id integer DEFAULT 0 NOT NULL
498 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
501 CREATE TABLE public.current_relation_tags (
502 relation_id bigint NOT NULL,
503 k character varying DEFAULT ''::character varying NOT NULL,
504 v character varying DEFAULT ''::character varying NOT NULL
509 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
512 CREATE TABLE public.current_relations (
514 changeset_id bigint NOT NULL,
515 "timestamp" timestamp without time zone NOT NULL,
516 visible boolean NOT NULL,
517 version bigint NOT NULL
522 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
525 CREATE SEQUENCE public.current_relations_id_seq
534 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
537 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
541 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
544 CREATE TABLE public.current_way_nodes (
545 way_id bigint NOT NULL,
546 node_id bigint NOT NULL,
547 sequence_id bigint NOT NULL
552 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
555 CREATE TABLE public.current_way_tags (
556 way_id bigint NOT NULL,
557 k character varying DEFAULT ''::character varying NOT NULL,
558 v character varying DEFAULT ''::character varying NOT NULL
563 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
566 CREATE TABLE public.current_ways (
568 changeset_id bigint NOT NULL,
569 "timestamp" timestamp without time zone NOT NULL,
570 visible boolean NOT NULL,
571 version bigint NOT NULL
576 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
579 CREATE SEQUENCE public.current_ways_id_seq
588 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
591 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
595 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
598 CREATE TABLE public.delayed_jobs (
600 priority integer DEFAULT 0 NOT NULL,
601 attempts integer DEFAULT 0 NOT NULL,
602 handler text NOT NULL,
604 run_at timestamp without time zone,
605 locked_at timestamp without time zone,
606 failed_at timestamp without time zone,
607 locked_by character varying,
608 queue character varying,
609 created_at timestamp without time zone,
610 updated_at timestamp without time zone
615 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
618 CREATE SEQUENCE public.delayed_jobs_id_seq
627 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
630 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
634 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
637 CREATE TABLE public.diary_comments (
639 diary_entry_id bigint NOT NULL,
640 user_id bigint NOT NULL,
642 created_at timestamp without time zone NOT NULL,
643 updated_at timestamp without time zone NOT NULL,
644 visible boolean DEFAULT true NOT NULL,
645 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
650 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
653 CREATE SEQUENCE public.diary_comments_id_seq
662 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
665 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
669 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
672 CREATE TABLE public.diary_entries (
674 user_id bigint NOT NULL,
675 title character varying NOT NULL,
677 created_at timestamp without time zone NOT NULL,
678 updated_at timestamp without time zone NOT NULL,
679 latitude double precision,
680 longitude double precision,
681 language_code character varying DEFAULT 'en'::character varying NOT NULL,
682 visible boolean DEFAULT true NOT NULL,
683 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
688 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
691 CREATE SEQUENCE public.diary_entries_id_seq
700 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
703 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
707 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
710 CREATE TABLE public.diary_entry_subscriptions (
711 user_id bigint NOT NULL,
712 diary_entry_id bigint NOT NULL
717 -- Name: friends; Type: TABLE; Schema: public; Owner: -
720 CREATE TABLE public.friends (
722 user_id bigint NOT NULL,
723 friend_user_id bigint NOT NULL,
724 created_at timestamp without time zone
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 (
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 pass_salt character varying,
1375 email_valid boolean DEFAULT false NOT NULL,
1376 new_email character varying,
1377 creation_ip character varying,
1378 languages character varying,
1379 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1380 terms_agreed timestamp without time zone,
1381 consider_pd boolean DEFAULT false NOT NULL,
1382 auth_uid character varying,
1383 preferred_editor character varying,
1384 terms_seen boolean DEFAULT false NOT NULL,
1385 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1386 changesets_count integer DEFAULT 0 NOT NULL,
1387 traces_count integer DEFAULT 0 NOT NULL,
1388 diary_entries_count integer DEFAULT 0 NOT NULL,
1389 image_use_gravatar boolean DEFAULT false NOT NULL,
1390 auth_provider character varying,
1392 tou_agreed timestamp without time zone
1397 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1400 CREATE SEQUENCE public.users_id_seq
1409 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1412 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1416 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1419 CREATE TABLE public.way_nodes (
1420 way_id bigint NOT NULL,
1421 node_id bigint NOT NULL,
1422 version bigint NOT NULL,
1423 sequence_id bigint NOT NULL
1428 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1431 CREATE TABLE public.way_tags (
1432 way_id bigint DEFAULT 0 NOT NULL,
1433 k character varying NOT NULL,
1434 v character varying NOT NULL,
1435 version bigint NOT NULL
1440 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1443 CREATE TABLE public.ways (
1444 way_id bigint DEFAULT 0 NOT NULL,
1445 changeset_id bigint NOT NULL,
1446 "timestamp" timestamp without time zone NOT NULL,
1447 version bigint NOT NULL,
1448 visible boolean DEFAULT true NOT NULL,
1449 redaction_id integer
1454 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1457 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1461 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1464 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1468 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1471 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1475 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1478 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1482 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1485 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1489 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1492 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1496 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1499 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1503 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1506 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1510 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1513 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1517 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1520 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1524 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1527 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1531 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1534 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1538 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1541 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1545 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1548 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1552 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1555 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1559 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1562 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1566 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1569 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1573 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1576 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1580 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1583 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1587 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1590 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1594 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1597 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1601 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1604 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1608 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1611 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1615 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1618 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1622 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1625 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1629 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1632 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1636 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1639 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1643 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1646 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1650 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1653 ALTER TABLE ONLY public.acls
1654 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1658 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1661 ALTER TABLE ONLY public.active_storage_attachments
1662 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1666 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1669 ALTER TABLE ONLY public.active_storage_blobs
1670 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1674 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1677 ALTER TABLE ONLY public.ar_internal_metadata
1678 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1682 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1685 ALTER TABLE ONLY public.changeset_comments
1686 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1690 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1693 ALTER TABLE ONLY public.changesets
1694 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1698 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1701 ALTER TABLE ONLY public.client_applications
1702 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1706 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1709 ALTER TABLE ONLY public.current_node_tags
1710 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1714 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1717 ALTER TABLE ONLY public.current_nodes
1718 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1722 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1725 ALTER TABLE ONLY public.current_relation_members
1726 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1730 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1733 ALTER TABLE ONLY public.current_relation_tags
1734 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1738 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1741 ALTER TABLE ONLY public.current_relations
1742 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1746 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1749 ALTER TABLE ONLY public.current_way_nodes
1750 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1754 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1757 ALTER TABLE ONLY public.current_way_tags
1758 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1762 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1765 ALTER TABLE ONLY public.current_ways
1766 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1770 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1773 ALTER TABLE ONLY public.delayed_jobs
1774 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1778 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1781 ALTER TABLE ONLY public.diary_comments
1782 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1786 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1789 ALTER TABLE ONLY public.diary_entries
1790 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1794 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1797 ALTER TABLE ONLY public.diary_entry_subscriptions
1798 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1802 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1805 ALTER TABLE ONLY public.friends
1806 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1810 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1813 ALTER TABLE ONLY public.gpx_file_tags
1814 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1818 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1821 ALTER TABLE ONLY public.gpx_files
1822 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1826 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1829 ALTER TABLE ONLY public.issue_comments
1830 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1834 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1837 ALTER TABLE ONLY public.issues
1838 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
1842 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1845 ALTER TABLE ONLY public.languages
1846 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1850 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1853 ALTER TABLE ONLY public.messages
1854 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1858 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1861 ALTER TABLE ONLY public.node_tags
1862 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1866 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1869 ALTER TABLE ONLY public.nodes
1870 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1874 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1877 ALTER TABLE ONLY public.note_comments
1878 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1882 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1885 ALTER TABLE ONLY public.notes
1886 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1890 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1893 ALTER TABLE ONLY public.oauth_nonces
1894 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1898 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1901 ALTER TABLE ONLY public.oauth_tokens
1902 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1906 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1909 ALTER TABLE ONLY public.redactions
1910 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1914 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1917 ALTER TABLE ONLY public.relation_members
1918 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1922 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1925 ALTER TABLE ONLY public.relation_tags
1926 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1930 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1933 ALTER TABLE ONLY public.relations
1934 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1938 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1941 ALTER TABLE ONLY public.reports
1942 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
1946 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1949 ALTER TABLE ONLY public.schema_migrations
1950 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
1954 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1957 ALTER TABLE ONLY public.user_blocks
1958 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1962 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1965 ALTER TABLE ONLY public.user_preferences
1966 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1970 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1973 ALTER TABLE ONLY public.user_roles
1974 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1978 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1981 ALTER TABLE ONLY public.user_tokens
1982 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
1986 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1989 ALTER TABLE ONLY public.users
1990 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
1994 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1997 ALTER TABLE ONLY public.way_nodes
1998 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2002 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2005 ALTER TABLE ONLY public.way_tags
2006 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2010 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2013 ALTER TABLE ONLY public.ways
2014 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2018 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2021 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2025 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
2028 CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id);
2032 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2035 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2039 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2042 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2046 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2049 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2053 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2056 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2060 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2063 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2067 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2070 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2074 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2077 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2081 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2084 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2088 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2091 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2095 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2098 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2102 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2105 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2109 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2112 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2116 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2119 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2123 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2126 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2130 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2133 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2137 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2140 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2144 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2147 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2151 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2154 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2158 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2161 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2165 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2168 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2172 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2175 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2179 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2182 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2186 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2189 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2193 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2196 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2200 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2203 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2207 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2210 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2214 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2217 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2221 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2224 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2228 -- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2231 CREATE INDEX index_changeset_comments_on_changeset_id_and_created_at ON public.changeset_comments USING btree (changeset_id, created_at);
2235 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2238 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2242 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2245 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2249 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2252 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2256 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2259 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2263 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2266 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2270 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2273 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2277 -- Name: index_friends_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
2280 CREATE INDEX index_friends_on_user_id_and_created_at ON public.friends USING btree (user_id, created_at);
2284 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2287 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2291 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2294 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2298 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2301 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2305 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2308 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2312 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2315 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2319 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2322 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2326 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2329 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2333 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2336 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2340 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2343 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2347 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2350 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2354 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2357 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2361 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2364 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2368 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2371 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2375 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2378 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2382 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2385 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2389 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2392 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2396 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2399 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2403 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2406 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2410 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2413 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2417 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2420 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2424 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2427 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2431 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2434 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2438 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2441 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2445 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2448 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2452 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2455 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2459 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2462 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2466 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2469 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2473 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2476 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2480 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2483 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2487 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2490 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2494 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2497 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2501 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2504 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2508 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2511 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2515 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2518 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2522 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2525 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2529 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2532 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2536 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2539 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2543 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2546 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2550 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2553 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2557 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2560 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2564 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2567 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2571 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2574 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2578 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2581 ALTER TABLE ONLY public.changeset_comments
2582 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2586 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2589 ALTER TABLE ONLY public.changeset_comments
2590 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2594 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2597 ALTER TABLE ONLY public.changeset_tags
2598 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2602 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2605 ALTER TABLE ONLY public.changesets_subscribers
2606 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2610 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2613 ALTER TABLE ONLY public.changesets_subscribers
2614 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2618 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2621 ALTER TABLE ONLY public.changesets
2622 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2626 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2629 ALTER TABLE ONLY public.client_applications
2630 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2634 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2637 ALTER TABLE ONLY public.current_node_tags
2638 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2642 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2645 ALTER TABLE ONLY public.current_nodes
2646 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2650 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2653 ALTER TABLE ONLY public.current_relation_members
2654 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2658 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2661 ALTER TABLE ONLY public.current_relation_tags
2662 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2666 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2669 ALTER TABLE ONLY public.current_relations
2670 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2674 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2677 ALTER TABLE ONLY public.current_way_nodes
2678 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2682 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2685 ALTER TABLE ONLY public.current_way_nodes
2686 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2690 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2693 ALTER TABLE ONLY public.current_way_tags
2694 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2698 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2701 ALTER TABLE ONLY public.current_ways
2702 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2706 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2709 ALTER TABLE ONLY public.diary_comments
2710 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2714 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2717 ALTER TABLE ONLY public.diary_comments
2718 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2722 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2725 ALTER TABLE ONLY public.diary_entries
2726 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
2730 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2733 ALTER TABLE ONLY public.diary_entries
2734 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2738 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2741 ALTER TABLE ONLY public.diary_entry_subscriptions
2742 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2746 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2749 ALTER TABLE ONLY public.diary_entry_subscriptions
2750 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2754 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
2757 ALTER TABLE ONLY public.active_storage_attachments
2758 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
2762 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2765 ALTER TABLE ONLY public.friends
2766 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
2770 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2773 ALTER TABLE ONLY public.friends
2774 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2778 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2781 ALTER TABLE ONLY public.gps_points
2782 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2786 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2789 ALTER TABLE ONLY public.gpx_file_tags
2790 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2794 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2797 ALTER TABLE ONLY public.gpx_files
2798 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2802 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2805 ALTER TABLE ONLY public.issue_comments
2806 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2810 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2813 ALTER TABLE ONLY public.issue_comments
2814 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2818 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2821 ALTER TABLE ONLY public.issues
2822 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
2826 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2829 ALTER TABLE ONLY public.issues
2830 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
2834 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2837 ALTER TABLE ONLY public.issues
2838 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
2842 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2845 ALTER TABLE ONLY public.messages
2846 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
2850 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2853 ALTER TABLE ONLY public.messages
2854 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
2858 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2861 ALTER TABLE ONLY public.node_tags
2862 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
2866 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2869 ALTER TABLE ONLY public.nodes
2870 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2874 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2877 ALTER TABLE ONLY public.nodes
2878 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2882 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2885 ALTER TABLE ONLY public.note_comments
2886 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2890 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2893 ALTER TABLE ONLY public.note_comments
2894 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
2898 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2901 ALTER TABLE ONLY public.oauth_tokens
2902 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
2906 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2909 ALTER TABLE ONLY public.oauth_tokens
2910 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2914 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2917 ALTER TABLE ONLY public.redactions
2918 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2922 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2925 ALTER TABLE ONLY public.relation_members
2926 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2930 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2933 ALTER TABLE ONLY public.relation_tags
2934 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2938 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2941 ALTER TABLE ONLY public.relations
2942 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2946 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2949 ALTER TABLE ONLY public.relations
2950 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2954 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2957 ALTER TABLE ONLY public.reports
2958 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2962 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2965 ALTER TABLE ONLY public.reports
2966 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2970 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2973 ALTER TABLE ONLY public.user_blocks
2974 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
2978 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2981 ALTER TABLE ONLY public.user_blocks
2982 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
2986 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2989 ALTER TABLE ONLY public.user_blocks
2990 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2994 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2997 ALTER TABLE ONLY public.user_preferences
2998 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3002 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3005 ALTER TABLE ONLY public.user_roles
3006 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3010 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3013 ALTER TABLE ONLY public.user_roles
3014 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3018 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3021 ALTER TABLE ONLY public.user_tokens
3022 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3026 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3029 ALTER TABLE ONLY public.way_nodes
3030 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3034 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3037 ALTER TABLE ONLY public.way_tags
3038 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3042 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3045 ALTER TABLE ONLY public.ways
3046 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3050 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3053 ALTER TABLE ONLY public.ways
3054 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3058 -- PostgreSQL database dump complete
3061 SET search_path TO "$user", public;
3063 INSERT INTO "schema_migrations" (version) VALUES