1 SET statement_timeout = 0;
3 SET idle_in_transaction_session_timeout = 0;
4 SET client_encoding = 'UTF8';
5 SET standard_conforming_strings = on;
6 SELECT pg_catalog.set_config('search_path', '', false);
7 SET check_function_bodies = false;
8 SET xmloption = content;
9 SET client_min_messages = warning;
10 SET row_security = off;
13 -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
16 CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
20 -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
23 COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
27 -- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: -
30 CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public;
34 -- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: -
37 COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST';
41 -- Name: format_enum; Type: TYPE; Schema: public; Owner: -
44 CREATE TYPE public.format_enum AS ENUM (
52 -- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: -
55 CREATE TYPE public.gpx_visibility_enum AS ENUM (
64 -- Name: issue_status_enum; Type: TYPE; Schema: public; Owner: -
67 CREATE TYPE public.issue_status_enum AS ENUM (
75 -- Name: note_event_enum; Type: TYPE; Schema: public; Owner: -
78 CREATE TYPE public.note_event_enum AS ENUM (
88 -- Name: note_status_enum; Type: TYPE; Schema: public; Owner: -
91 CREATE TYPE public.note_status_enum AS ENUM (
99 -- Name: nwr_enum; Type: TYPE; Schema: public; Owner: -
102 CREATE TYPE public.nwr_enum AS ENUM (
110 -- Name: user_role_enum; Type: TYPE; Schema: public; Owner: -
113 CREATE TYPE public.user_role_enum AS ENUM (
120 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
123 CREATE TYPE public.user_status_enum AS ENUM (
133 -- Name: maptile_for_point(bigint, bigint, integer); Type: FUNCTION; Schema: public; Owner: -
136 CREATE FUNCTION public.maptile_for_point(scaled_lat bigint, scaled_lon bigint, zoom integer) RETURNS integer
137 LANGUAGE plpgsql IMMUTABLE
140 lat CONSTANT DOUBLE PRECISION := scaled_lat / 10000000.0;
141 lon CONSTANT DOUBLE PRECISION := scaled_lon / 10000000.0;
142 zscale CONSTANT DOUBLE PRECISION := 2.0 ^ zoom;
143 pi CONSTANT DOUBLE PRECISION := 3.141592653589793;
144 r_per_d CONSTANT DOUBLE PRECISION := pi / 180.0;
148 -- straight port of the C code. see db/functions/maptile.c
149 x := floor((lon + 180.0) * zscale / 360.0);
150 y := floor((1.0 - ln(tan(lat * r_per_d) + 1.0 / cos(lat * r_per_d)) / pi) * zscale / 2.0);
152 RETURN (x << zoom) | y;
158 -- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
161 CREATE FUNCTION public.tile_for_point(scaled_lat integer, scaled_lon integer) RETURNS bigint
162 LANGUAGE plpgsql IMMUTABLE
165 x int8; -- quantized x from lon,
166 y int8; -- quantized y from lat,
168 x := round(((scaled_lon / 10000000.0) + 180.0) * 65535.0 / 360.0);
169 y := round(((scaled_lat / 10000000.0) + 90.0) * 65535.0 / 180.0);
171 -- these bit-masks are special numbers used in the bit interleaving algorithm.
172 -- see https://graphics.stanford.edu/~seander/bithacks.html#InterleaveBMN
173 -- for the original algorithm and more details.
174 x := (x | (x << 8)) & 16711935; -- 0x00FF00FF
175 x := (x | (x << 4)) & 252645135; -- 0x0F0F0F0F
176 x := (x | (x << 2)) & 858993459; -- 0x33333333
177 x := (x | (x << 1)) & 1431655765; -- 0x55555555
179 y := (y | (y << 8)) & 16711935; -- 0x00FF00FF
180 y := (y | (y << 4)) & 252645135; -- 0x0F0F0F0F
181 y := (y | (y << 2)) & 858993459; -- 0x33333333
182 y := (y | (y << 1)) & 1431655765; -- 0x55555555
189 SET default_tablespace = '';
191 SET default_with_oids = false;
194 -- Name: acls; Type: TABLE; Schema: public; Owner: -
197 CREATE TABLE public.acls (
200 k character varying NOT NULL,
202 domain character varying,
208 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
211 CREATE SEQUENCE public.acls_id_seq
220 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
223 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
227 -- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
230 CREATE TABLE public.active_storage_attachments (
232 name character varying NOT NULL,
233 record_type character varying NOT NULL,
234 record_id bigint NOT NULL,
235 blob_id bigint NOT NULL,
236 created_at timestamp without time zone NOT NULL
241 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
244 CREATE SEQUENCE public.active_storage_attachments_id_seq
253 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
256 ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
260 -- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
263 CREATE TABLE public.active_storage_blobs (
265 key character varying NOT NULL,
266 filename character varying NOT NULL,
267 content_type character varying,
269 byte_size bigint NOT NULL,
270 checksum character varying NOT NULL,
271 created_at timestamp without time zone NOT NULL
276 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
279 CREATE SEQUENCE public.active_storage_blobs_id_seq
288 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
291 ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
295 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
298 CREATE TABLE public.ar_internal_metadata (
299 key character varying NOT NULL,
300 value character varying,
301 created_at timestamp without time zone NOT NULL,
302 updated_at timestamp without time zone NOT NULL
307 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
310 CREATE TABLE public.changeset_comments (
312 changeset_id bigint NOT NULL,
313 author_id bigint NOT NULL,
315 created_at timestamp without time zone NOT NULL,
316 visible boolean NOT NULL
321 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
324 CREATE SEQUENCE public.changeset_comments_id_seq
334 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
337 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
341 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
344 CREATE TABLE public.changeset_tags (
345 changeset_id bigint NOT NULL,
346 k character varying DEFAULT ''::character varying NOT NULL,
347 v character varying DEFAULT ''::character varying NOT NULL
352 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
355 CREATE TABLE public.changesets (
357 user_id bigint NOT NULL,
358 created_at timestamp without time zone NOT NULL,
363 closed_at timestamp without time zone NOT NULL,
364 num_changes integer DEFAULT 0 NOT NULL
369 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
372 CREATE SEQUENCE public.changesets_id_seq
381 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
384 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
388 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
391 CREATE TABLE public.changesets_subscribers (
392 subscriber_id bigint NOT NULL,
393 changeset_id bigint NOT NULL
398 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
401 CREATE TABLE public.client_applications (
403 name character varying,
404 url character varying,
405 support_url character varying,
406 callback_url character varying,
407 key character varying(50),
408 secret character varying(50),
410 created_at timestamp without time zone,
411 updated_at timestamp without time zone,
412 allow_read_prefs boolean DEFAULT false NOT NULL,
413 allow_write_prefs boolean DEFAULT false NOT NULL,
414 allow_write_diary boolean DEFAULT false NOT NULL,
415 allow_write_api boolean DEFAULT false NOT NULL,
416 allow_read_gpx boolean DEFAULT false NOT NULL,
417 allow_write_gpx boolean DEFAULT false NOT NULL,
418 allow_write_notes boolean DEFAULT false NOT NULL
423 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
426 CREATE SEQUENCE public.client_applications_id_seq
436 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
439 ALTER SEQUENCE public.client_applications_id_seq OWNED BY public.client_applications.id;
443 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
446 CREATE TABLE public.current_node_tags (
447 node_id bigint NOT NULL,
448 k character varying DEFAULT ''::character varying NOT NULL,
449 v character varying DEFAULT ''::character varying NOT NULL
454 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
457 CREATE TABLE public.current_nodes (
459 latitude integer NOT NULL,
460 longitude integer NOT NULL,
461 changeset_id bigint NOT NULL,
462 visible boolean NOT NULL,
463 "timestamp" timestamp without time zone NOT NULL,
464 tile bigint NOT NULL,
465 version bigint NOT NULL
470 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
473 CREATE SEQUENCE public.current_nodes_id_seq
482 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
485 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
489 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
492 CREATE TABLE public.current_relation_members (
493 relation_id bigint NOT NULL,
494 member_type public.nwr_enum NOT NULL,
495 member_id bigint NOT NULL,
496 member_role character varying NOT NULL,
497 sequence_id integer DEFAULT 0 NOT NULL
502 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
505 CREATE TABLE public.current_relation_tags (
506 relation_id bigint NOT NULL,
507 k character varying DEFAULT ''::character varying NOT NULL,
508 v character varying DEFAULT ''::character varying NOT NULL
513 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
516 CREATE TABLE public.current_relations (
518 changeset_id bigint NOT NULL,
519 "timestamp" timestamp without time zone NOT NULL,
520 visible boolean NOT NULL,
521 version bigint NOT NULL
526 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
529 CREATE SEQUENCE public.current_relations_id_seq
538 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
541 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
545 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
548 CREATE TABLE public.current_way_nodes (
549 way_id bigint NOT NULL,
550 node_id bigint NOT NULL,
551 sequence_id bigint NOT NULL
556 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
559 CREATE TABLE public.current_way_tags (
560 way_id bigint NOT NULL,
561 k character varying DEFAULT ''::character varying NOT NULL,
562 v character varying DEFAULT ''::character varying NOT NULL
567 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
570 CREATE TABLE public.current_ways (
572 changeset_id bigint NOT NULL,
573 "timestamp" timestamp without time zone NOT NULL,
574 visible boolean NOT NULL,
575 version bigint NOT NULL
580 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
583 CREATE SEQUENCE public.current_ways_id_seq
592 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
595 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
599 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
602 CREATE TABLE public.delayed_jobs (
604 priority integer DEFAULT 0 NOT NULL,
605 attempts integer DEFAULT 0 NOT NULL,
606 handler text NOT NULL,
608 run_at timestamp without time zone,
609 locked_at timestamp without time zone,
610 failed_at timestamp without time zone,
611 locked_by character varying,
612 queue character varying,
613 created_at timestamp without time zone,
614 updated_at timestamp without time zone
619 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
622 CREATE SEQUENCE public.delayed_jobs_id_seq
631 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
634 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
638 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
641 CREATE TABLE public.diary_comments (
643 diary_entry_id bigint NOT NULL,
644 user_id bigint NOT NULL,
646 created_at timestamp without time zone NOT NULL,
647 updated_at timestamp without time zone NOT NULL,
648 visible boolean DEFAULT true NOT NULL,
649 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
654 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
657 CREATE SEQUENCE public.diary_comments_id_seq
666 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
669 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
673 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
676 CREATE TABLE public.diary_entries (
678 user_id bigint NOT NULL,
679 title character varying NOT NULL,
681 created_at timestamp without time zone NOT NULL,
682 updated_at timestamp without time zone NOT NULL,
683 latitude double precision,
684 longitude double precision,
685 language_code character varying DEFAULT 'en'::character varying NOT NULL,
686 visible boolean DEFAULT true NOT NULL,
687 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
692 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
695 CREATE SEQUENCE public.diary_entries_id_seq
704 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
707 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
711 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
714 CREATE TABLE public.diary_entry_subscriptions (
715 user_id bigint NOT NULL,
716 diary_entry_id bigint NOT NULL
721 -- Name: friends; Type: TABLE; Schema: public; Owner: -
724 CREATE TABLE public.friends (
726 user_id bigint NOT NULL,
727 friend_user_id bigint NOT NULL
732 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
735 CREATE SEQUENCE public.friends_id_seq
744 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
747 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
751 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
754 CREATE TABLE public.gps_points (
755 altitude double precision,
756 trackid integer NOT NULL,
757 latitude integer NOT NULL,
758 longitude integer NOT NULL,
759 gpx_id bigint NOT NULL,
760 "timestamp" timestamp without time zone,
766 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
769 CREATE TABLE public.gpx_file_tags (
770 gpx_id bigint DEFAULT 0 NOT NULL,
771 tag character varying NOT NULL,
777 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
780 CREATE SEQUENCE public.gpx_file_tags_id_seq
789 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
792 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
796 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
799 CREATE TABLE public.gpx_files (
801 user_id bigint NOT NULL,
802 visible boolean DEFAULT true NOT NULL,
803 name character varying DEFAULT ''::character varying NOT NULL,
805 latitude double precision,
806 longitude double precision,
807 "timestamp" timestamp without time zone NOT NULL,
808 description character varying DEFAULT ''::character varying NOT NULL,
809 inserted boolean NOT NULL,
810 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
815 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
818 CREATE SEQUENCE public.gpx_files_id_seq
827 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
830 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
834 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
837 CREATE TABLE public.issue_comments (
839 issue_id integer NOT NULL,
840 user_id integer NOT NULL,
842 created_at timestamp without time zone NOT NULL,
843 updated_at timestamp without time zone NOT NULL
848 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
851 CREATE SEQUENCE public.issue_comments_id_seq
861 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
864 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
868 -- Name: issues; Type: TABLE; Schema: public; Owner: -
871 CREATE TABLE public.issues (
873 reportable_type character varying NOT NULL,
874 reportable_id integer NOT NULL,
875 reported_user_id integer,
876 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
877 assigned_role public.user_role_enum NOT NULL,
878 resolved_at timestamp without time zone,
881 reports_count integer DEFAULT 0,
882 created_at timestamp without time zone NOT NULL,
883 updated_at timestamp without time zone NOT NULL
888 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
891 CREATE SEQUENCE public.issues_id_seq
901 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
904 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
908 -- Name: languages; Type: TABLE; Schema: public; Owner: -
911 CREATE TABLE public.languages (
912 code character varying NOT NULL,
913 english_name character varying NOT NULL,
914 native_name character varying
919 -- Name: messages; Type: TABLE; Schema: public; Owner: -
922 CREATE TABLE public.messages (
924 from_user_id bigint NOT NULL,
925 title character varying NOT NULL,
927 sent_on timestamp without time zone NOT NULL,
928 message_read boolean DEFAULT false NOT NULL,
929 to_user_id bigint NOT NULL,
930 to_user_visible boolean DEFAULT true NOT NULL,
931 from_user_visible boolean DEFAULT true NOT NULL,
932 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
937 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
940 CREATE SEQUENCE public.messages_id_seq
949 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
952 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
956 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
959 CREATE TABLE public.node_tags (
960 node_id bigint NOT NULL,
961 version bigint NOT NULL,
962 k character varying DEFAULT ''::character varying NOT NULL,
963 v character varying DEFAULT ''::character varying NOT NULL
968 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
971 CREATE TABLE public.nodes (
972 node_id bigint NOT NULL,
973 latitude integer NOT NULL,
974 longitude integer NOT NULL,
975 changeset_id bigint NOT NULL,
976 visible boolean NOT NULL,
977 "timestamp" timestamp without time zone NOT NULL,
978 tile bigint NOT NULL,
979 version bigint NOT NULL,
985 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
988 CREATE TABLE public.note_comments (
990 note_id bigint NOT NULL,
991 visible boolean NOT NULL,
992 created_at timestamp without time zone NOT NULL,
996 event public.note_event_enum
1001 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1004 CREATE SEQUENCE public.note_comments_id_seq
1014 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1017 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
1021 -- Name: notes; Type: TABLE; Schema: public; Owner: -
1024 CREATE TABLE public.notes (
1026 latitude integer NOT NULL,
1027 longitude integer NOT NULL,
1028 tile bigint NOT NULL,
1029 updated_at timestamp without time zone NOT NULL,
1030 created_at timestamp without time zone NOT NULL,
1031 status public.note_status_enum NOT NULL,
1032 closed_at timestamp without time zone
1037 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1040 CREATE SEQUENCE public.notes_id_seq
1050 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1053 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
1057 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
1060 CREATE TABLE public.oauth_nonces (
1061 id integer NOT NULL,
1062 nonce character varying,
1063 "timestamp" integer,
1064 created_at timestamp without time zone,
1065 updated_at timestamp without time zone
1070 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1073 CREATE SEQUENCE public.oauth_nonces_id_seq
1083 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1086 ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id;
1090 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
1093 CREATE TABLE public.oauth_tokens (
1094 id integer NOT NULL,
1096 type character varying(20),
1097 client_application_id integer,
1098 token character varying(50),
1099 secret character varying(50),
1100 authorized_at timestamp without time zone,
1101 invalidated_at timestamp without time zone,
1102 created_at timestamp without time zone,
1103 updated_at timestamp without time zone,
1104 allow_read_prefs boolean DEFAULT false NOT NULL,
1105 allow_write_prefs boolean DEFAULT false NOT NULL,
1106 allow_write_diary boolean DEFAULT false NOT NULL,
1107 allow_write_api boolean DEFAULT false NOT NULL,
1108 allow_read_gpx boolean DEFAULT false NOT NULL,
1109 allow_write_gpx boolean DEFAULT false NOT NULL,
1110 callback_url character varying,
1111 verifier character varying(20),
1112 scope character varying,
1113 valid_to timestamp without time zone,
1114 allow_write_notes boolean DEFAULT false NOT NULL
1119 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1122 CREATE SEQUENCE public.oauth_tokens_id_seq
1132 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1135 ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
1139 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1142 CREATE TABLE public.redactions (
1143 id integer NOT NULL,
1144 title character varying,
1146 created_at timestamp without time zone,
1147 updated_at timestamp without time zone,
1148 user_id bigint NOT NULL,
1149 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1154 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1157 CREATE SEQUENCE public.redactions_id_seq
1167 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1170 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1174 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1177 CREATE TABLE public.relation_members (
1178 relation_id bigint DEFAULT 0 NOT NULL,
1179 member_type public.nwr_enum NOT NULL,
1180 member_id bigint NOT NULL,
1181 member_role character varying NOT NULL,
1182 version bigint DEFAULT 0 NOT NULL,
1183 sequence_id integer DEFAULT 0 NOT NULL
1188 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1191 CREATE TABLE public.relation_tags (
1192 relation_id bigint DEFAULT 0 NOT NULL,
1193 k character varying DEFAULT ''::character varying NOT NULL,
1194 v character varying DEFAULT ''::character varying NOT NULL,
1195 version bigint NOT NULL
1200 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1203 CREATE TABLE public.relations (
1204 relation_id bigint DEFAULT 0 NOT NULL,
1205 changeset_id bigint NOT NULL,
1206 "timestamp" timestamp without time zone NOT NULL,
1207 version bigint NOT NULL,
1208 visible boolean DEFAULT true NOT NULL,
1209 redaction_id integer
1214 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1217 CREATE TABLE public.reports (
1218 id integer NOT NULL,
1219 issue_id integer NOT NULL,
1220 user_id integer NOT NULL,
1221 details text NOT NULL,
1222 category character varying NOT NULL,
1223 created_at timestamp without time zone NOT NULL,
1224 updated_at timestamp without time zone NOT NULL
1229 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1232 CREATE SEQUENCE public.reports_id_seq
1242 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1245 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1249 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1252 CREATE TABLE public.schema_migrations (
1253 version character varying NOT NULL
1258 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1261 CREATE TABLE public.user_blocks (
1262 id integer NOT NULL,
1263 user_id bigint NOT NULL,
1264 creator_id bigint NOT NULL,
1265 reason text NOT NULL,
1266 ends_at timestamp without time zone NOT NULL,
1267 needs_view boolean DEFAULT false NOT NULL,
1269 created_at timestamp without time zone,
1270 updated_at timestamp without time zone,
1271 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1276 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1279 CREATE SEQUENCE public.user_blocks_id_seq
1289 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1292 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1296 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1299 CREATE TABLE public.user_preferences (
1300 user_id bigint NOT NULL,
1301 k character varying NOT NULL,
1302 v character varying NOT NULL
1307 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1310 CREATE TABLE public.user_roles (
1311 id integer NOT NULL,
1312 user_id bigint NOT NULL,
1313 role public.user_role_enum NOT NULL,
1314 created_at timestamp without time zone,
1315 updated_at timestamp without time zone,
1316 granter_id bigint NOT NULL
1321 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1324 CREATE SEQUENCE public.user_roles_id_seq
1334 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1337 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1341 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1344 CREATE TABLE public.user_tokens (
1346 user_id bigint NOT NULL,
1347 token character varying NOT NULL,
1348 expiry timestamp without time zone NOT NULL,
1354 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1357 CREATE SEQUENCE public.user_tokens_id_seq
1366 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1369 ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id;
1373 -- Name: users; Type: TABLE; Schema: public; Owner: -
1376 CREATE TABLE public.users (
1377 email character varying NOT NULL,
1379 pass_crypt character varying NOT NULL,
1380 creation_time timestamp without time zone NOT NULL,
1381 display_name character varying DEFAULT ''::character varying NOT NULL,
1382 data_public boolean DEFAULT false NOT NULL,
1383 description text DEFAULT ''::text NOT NULL,
1384 home_lat double precision,
1385 home_lon double precision,
1386 home_zoom smallint DEFAULT 3,
1387 nearby integer DEFAULT 50,
1388 pass_salt character varying,
1389 email_valid boolean DEFAULT false NOT NULL,
1390 new_email character varying,
1391 creation_ip character varying,
1392 languages character varying,
1393 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1394 terms_agreed timestamp without time zone,
1395 consider_pd boolean DEFAULT false NOT NULL,
1396 auth_uid character varying,
1397 preferred_editor character varying,
1398 terms_seen boolean DEFAULT false NOT NULL,
1399 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1400 changesets_count integer DEFAULT 0 NOT NULL,
1401 traces_count integer DEFAULT 0 NOT NULL,
1402 diary_entries_count integer DEFAULT 0 NOT NULL,
1403 image_use_gravatar boolean DEFAULT false NOT NULL,
1404 auth_provider character varying,
1406 tou_agreed timestamp without time zone
1411 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1414 CREATE SEQUENCE public.users_id_seq
1423 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1426 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1430 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1433 CREATE TABLE public.way_nodes (
1434 way_id bigint NOT NULL,
1435 node_id bigint NOT NULL,
1436 version bigint NOT NULL,
1437 sequence_id bigint NOT NULL
1442 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1445 CREATE TABLE public.way_tags (
1446 way_id bigint DEFAULT 0 NOT NULL,
1447 k character varying NOT NULL,
1448 v character varying NOT NULL,
1449 version bigint NOT NULL
1454 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1457 CREATE TABLE public.ways (
1458 way_id bigint DEFAULT 0 NOT NULL,
1459 changeset_id bigint NOT NULL,
1460 "timestamp" timestamp without time zone NOT NULL,
1461 version bigint NOT NULL,
1462 visible boolean DEFAULT true NOT NULL,
1463 redaction_id integer
1468 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1471 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1475 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1478 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1482 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1485 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1489 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1492 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1496 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1499 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1503 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1506 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1510 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1513 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1517 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1520 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1524 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1527 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1531 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1534 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1538 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1541 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1545 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1548 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1552 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1555 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1559 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1562 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1566 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1569 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1573 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1576 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1580 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1583 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1587 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1590 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1594 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1597 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1601 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1604 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1608 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1611 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1615 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1618 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1622 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1625 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1629 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1632 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1636 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1639 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1643 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1646 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1650 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1653 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1657 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1660 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1664 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1667 ALTER TABLE ONLY public.acls
1668 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1672 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1675 ALTER TABLE ONLY public.active_storage_attachments
1676 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1680 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1683 ALTER TABLE ONLY public.active_storage_blobs
1684 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1688 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1691 ALTER TABLE ONLY public.ar_internal_metadata
1692 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1696 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1699 ALTER TABLE ONLY public.changeset_comments
1700 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1704 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1707 ALTER TABLE ONLY public.changesets
1708 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1712 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1715 ALTER TABLE ONLY public.client_applications
1716 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1720 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1723 ALTER TABLE ONLY public.current_node_tags
1724 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1728 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1731 ALTER TABLE ONLY public.current_nodes
1732 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1736 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1739 ALTER TABLE ONLY public.current_relation_members
1740 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1744 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1747 ALTER TABLE ONLY public.current_relation_tags
1748 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1752 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1755 ALTER TABLE ONLY public.current_relations
1756 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1760 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1763 ALTER TABLE ONLY public.current_way_nodes
1764 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1768 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1771 ALTER TABLE ONLY public.current_way_tags
1772 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1776 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1779 ALTER TABLE ONLY public.current_ways
1780 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1784 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1787 ALTER TABLE ONLY public.delayed_jobs
1788 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1792 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1795 ALTER TABLE ONLY public.diary_comments
1796 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1800 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1803 ALTER TABLE ONLY public.diary_entries
1804 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1808 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1811 ALTER TABLE ONLY public.diary_entry_subscriptions
1812 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1816 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1819 ALTER TABLE ONLY public.friends
1820 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1824 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1827 ALTER TABLE ONLY public.gpx_file_tags
1828 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1832 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1835 ALTER TABLE ONLY public.gpx_files
1836 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1840 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1843 ALTER TABLE ONLY public.issue_comments
1844 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1848 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1851 ALTER TABLE ONLY public.issues
1852 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
1856 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1859 ALTER TABLE ONLY public.languages
1860 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1864 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1867 ALTER TABLE ONLY public.messages
1868 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1872 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1875 ALTER TABLE ONLY public.node_tags
1876 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1880 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1883 ALTER TABLE ONLY public.nodes
1884 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1888 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1891 ALTER TABLE ONLY public.note_comments
1892 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1896 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1899 ALTER TABLE ONLY public.notes
1900 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1904 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1907 ALTER TABLE ONLY public.oauth_nonces
1908 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1912 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1915 ALTER TABLE ONLY public.oauth_tokens
1916 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1920 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1923 ALTER TABLE ONLY public.redactions
1924 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1928 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1931 ALTER TABLE ONLY public.relation_members
1932 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1936 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1939 ALTER TABLE ONLY public.relation_tags
1940 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1944 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1947 ALTER TABLE ONLY public.relations
1948 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1952 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1955 ALTER TABLE ONLY public.reports
1956 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
1960 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1963 ALTER TABLE ONLY public.schema_migrations
1964 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
1968 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1971 ALTER TABLE ONLY public.user_blocks
1972 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1976 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1979 ALTER TABLE ONLY public.user_preferences
1980 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1984 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1987 ALTER TABLE ONLY public.user_roles
1988 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1992 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1995 ALTER TABLE ONLY public.user_tokens
1996 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
2000 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2003 ALTER TABLE ONLY public.users
2004 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
2008 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2011 ALTER TABLE ONLY public.way_nodes
2012 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
2016 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2019 ALTER TABLE ONLY public.way_tags
2020 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
2024 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
2027 ALTER TABLE ONLY public.ways
2028 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
2032 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
2035 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
2039 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
2042 CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id);
2046 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
2049 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2053 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2056 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2060 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2063 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2067 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2070 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2074 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2077 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2081 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2084 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2088 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2091 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2095 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2098 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2102 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2105 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2109 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2112 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2116 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2119 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2123 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2126 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2130 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2133 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2137 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2140 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2144 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2147 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2151 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2154 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2158 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2161 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2165 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -
2168 CREATE INDEX friends_user_id_idx ON public.friends USING btree (user_id);
2172 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2175 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2179 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2182 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2186 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2189 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2193 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2196 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2200 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2203 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2207 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2210 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2214 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2217 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2221 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2224 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2228 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2231 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2235 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2238 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2242 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2245 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2249 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2252 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2256 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2259 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2263 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2266 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2270 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2273 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2277 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2280 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2284 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2287 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2291 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2294 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2298 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2301 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2305 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2308 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2312 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2315 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2319 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2322 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2326 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2329 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2333 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2336 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2340 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2343 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2347 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2350 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2354 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2357 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2361 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2364 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2368 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2371 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2375 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2378 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2382 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2385 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2389 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2392 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2396 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2399 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2403 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2406 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2410 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2413 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2417 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2420 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2424 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2427 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2431 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2434 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2438 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2441 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2445 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2448 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2452 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2455 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2459 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2462 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2466 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2469 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2473 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2476 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2480 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2483 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2487 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2490 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2494 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2497 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2501 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2504 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2508 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2511 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2515 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2518 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2522 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2525 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2529 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2532 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2536 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2539 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2543 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2546 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2550 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2553 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2557 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2560 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2564 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2567 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2571 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2574 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2578 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2581 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2585 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2588 ALTER TABLE ONLY public.changeset_comments
2589 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2593 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2596 ALTER TABLE ONLY public.changeset_comments
2597 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2601 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2604 ALTER TABLE ONLY public.changeset_tags
2605 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2609 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2612 ALTER TABLE ONLY public.changesets_subscribers
2613 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2617 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2620 ALTER TABLE ONLY public.changesets_subscribers
2621 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2625 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2628 ALTER TABLE ONLY public.changesets
2629 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2633 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2636 ALTER TABLE ONLY public.client_applications
2637 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2641 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2644 ALTER TABLE ONLY public.current_node_tags
2645 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2649 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2652 ALTER TABLE ONLY public.current_nodes
2653 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2657 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2660 ALTER TABLE ONLY public.current_relation_members
2661 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2665 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2668 ALTER TABLE ONLY public.current_relation_tags
2669 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2673 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2676 ALTER TABLE ONLY public.current_relations
2677 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2681 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2684 ALTER TABLE ONLY public.current_way_nodes
2685 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2689 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2692 ALTER TABLE ONLY public.current_way_nodes
2693 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2697 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2700 ALTER TABLE ONLY public.current_way_tags
2701 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2705 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2708 ALTER TABLE ONLY public.current_ways
2709 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2713 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2716 ALTER TABLE ONLY public.diary_comments
2717 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2721 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2724 ALTER TABLE ONLY public.diary_comments
2725 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2729 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2732 ALTER TABLE ONLY public.diary_entries
2733 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
2737 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2740 ALTER TABLE ONLY public.diary_entries
2741 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2745 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2748 ALTER TABLE ONLY public.diary_entry_subscriptions
2749 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2753 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2756 ALTER TABLE ONLY public.diary_entry_subscriptions
2757 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2761 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
2764 ALTER TABLE ONLY public.active_storage_attachments
2765 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
2769 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2772 ALTER TABLE ONLY public.friends
2773 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
2777 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2780 ALTER TABLE ONLY public.friends
2781 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2785 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2788 ALTER TABLE ONLY public.gps_points
2789 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2793 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2796 ALTER TABLE ONLY public.gpx_file_tags
2797 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2801 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2804 ALTER TABLE ONLY public.gpx_files
2805 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2809 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2812 ALTER TABLE ONLY public.issue_comments
2813 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2817 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2820 ALTER TABLE ONLY public.issue_comments
2821 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2825 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2828 ALTER TABLE ONLY public.issues
2829 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
2833 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2836 ALTER TABLE ONLY public.issues
2837 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
2841 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2844 ALTER TABLE ONLY public.issues
2845 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
2849 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2852 ALTER TABLE ONLY public.messages
2853 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
2857 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2860 ALTER TABLE ONLY public.messages
2861 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
2865 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2868 ALTER TABLE ONLY public.node_tags
2869 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
2873 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2876 ALTER TABLE ONLY public.nodes
2877 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2881 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2884 ALTER TABLE ONLY public.nodes
2885 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2889 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2892 ALTER TABLE ONLY public.note_comments
2893 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2897 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2900 ALTER TABLE ONLY public.note_comments
2901 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
2905 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2908 ALTER TABLE ONLY public.oauth_tokens
2909 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
2913 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2916 ALTER TABLE ONLY public.oauth_tokens
2917 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2921 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2924 ALTER TABLE ONLY public.redactions
2925 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2929 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2932 ALTER TABLE ONLY public.relation_members
2933 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2937 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2940 ALTER TABLE ONLY public.relation_tags
2941 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2945 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2948 ALTER TABLE ONLY public.relations
2949 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2953 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2956 ALTER TABLE ONLY public.relations
2957 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2961 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2964 ALTER TABLE ONLY public.reports
2965 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2969 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2972 ALTER TABLE ONLY public.reports
2973 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2977 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2980 ALTER TABLE ONLY public.user_blocks
2981 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
2985 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2988 ALTER TABLE ONLY public.user_blocks
2989 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
2993 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2996 ALTER TABLE ONLY public.user_blocks
2997 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3001 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3004 ALTER TABLE ONLY public.user_preferences
3005 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3009 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3012 ALTER TABLE ONLY public.user_roles
3013 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
3017 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3020 ALTER TABLE ONLY public.user_roles
3021 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3025 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3028 ALTER TABLE ONLY public.user_tokens
3029 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
3033 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3036 ALTER TABLE ONLY public.way_nodes
3037 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3041 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3044 ALTER TABLE ONLY public.way_tags
3045 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
3049 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3052 ALTER TABLE ONLY public.ways
3053 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3057 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3060 ALTER TABLE ONLY public.ways
3061 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3065 -- PostgreSQL database dump complete
3068 SET search_path TO "$user", public;
3070 INSERT INTO "schema_migrations" (version) VALUES