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: btree_gist; Type: EXTENSION; Schema: -; Owner: -
16 CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public;
20 -- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: -
23 COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST';
27 -- Name: format_enum; Type: TYPE; Schema: public; Owner: -
30 CREATE TYPE public.format_enum AS ENUM (
38 -- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: -
41 CREATE TYPE public.gpx_visibility_enum AS ENUM (
50 -- Name: issue_status_enum; Type: TYPE; Schema: public; Owner: -
53 CREATE TYPE public.issue_status_enum AS ENUM (
61 -- Name: note_event_enum; Type: TYPE; Schema: public; Owner: -
64 CREATE TYPE public.note_event_enum AS ENUM (
74 -- Name: note_status_enum; Type: TYPE; Schema: public; Owner: -
77 CREATE TYPE public.note_status_enum AS ENUM (
85 -- Name: nwr_enum; Type: TYPE; Schema: public; Owner: -
88 CREATE TYPE public.nwr_enum AS ENUM (
96 -- Name: user_role_enum; Type: TYPE; Schema: public; Owner: -
99 CREATE TYPE public.user_role_enum AS ENUM (
106 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
109 CREATE TYPE public.user_status_enum AS ENUM (
119 -- Name: maptile_for_point(bigint, bigint, integer); Type: FUNCTION; Schema: public; Owner: -
122 CREATE FUNCTION public.maptile_for_point(bigint, bigint, integer) RETURNS integer
124 AS '$libdir/libpgosm', 'maptile_for_point';
128 -- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
131 CREATE FUNCTION public.tile_for_point(integer, integer) RETURNS bigint
133 AS '$libdir/libpgosm', 'tile_for_point';
137 -- Name: xid_to_int4(xid); Type: FUNCTION; Schema: public; Owner: -
140 CREATE FUNCTION public.xid_to_int4(xid) RETURNS integer
141 LANGUAGE c IMMUTABLE STRICT
142 AS '$libdir/libpgosm', 'xid_to_int4';
145 SET default_tablespace = '';
147 SET default_with_oids = false;
150 -- Name: acls; Type: TABLE; Schema: public; Owner: -
153 CREATE TABLE public.acls (
156 k character varying NOT NULL,
158 domain character varying,
164 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
167 CREATE SEQUENCE public.acls_id_seq
176 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
179 ALTER SEQUENCE public.acls_id_seq OWNED BY public.acls.id;
183 -- Name: active_storage_attachments; Type: TABLE; Schema: public; Owner: -
186 CREATE TABLE public.active_storage_attachments (
188 name character varying NOT NULL,
189 record_type character varying NOT NULL,
190 record_id bigint NOT NULL,
191 blob_id bigint NOT NULL,
192 created_at timestamp without time zone NOT NULL
197 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
200 CREATE SEQUENCE public.active_storage_attachments_id_seq
209 -- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
212 ALTER SEQUENCE public.active_storage_attachments_id_seq OWNED BY public.active_storage_attachments.id;
216 -- Name: active_storage_blobs; Type: TABLE; Schema: public; Owner: -
219 CREATE TABLE public.active_storage_blobs (
221 key character varying NOT NULL,
222 filename character varying NOT NULL,
223 content_type character varying,
225 byte_size bigint NOT NULL,
226 checksum character varying NOT NULL,
227 created_at timestamp without time zone NOT NULL
232 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
235 CREATE SEQUENCE public.active_storage_blobs_id_seq
244 -- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
247 ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage_blobs.id;
251 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
254 CREATE TABLE public.ar_internal_metadata (
255 key character varying NOT NULL,
256 value character varying,
257 created_at timestamp without time zone NOT NULL,
258 updated_at timestamp without time zone NOT NULL
263 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
266 CREATE TABLE public.changeset_comments (
268 changeset_id bigint NOT NULL,
269 author_id bigint NOT NULL,
271 created_at timestamp without time zone NOT NULL,
272 visible boolean NOT NULL
277 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
280 CREATE SEQUENCE public.changeset_comments_id_seq
289 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
292 ALTER SEQUENCE public.changeset_comments_id_seq OWNED BY public.changeset_comments.id;
296 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
299 CREATE TABLE public.changeset_tags (
300 changeset_id bigint NOT NULL,
301 k character varying DEFAULT ''::character varying NOT NULL,
302 v character varying DEFAULT ''::character varying NOT NULL
307 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
310 CREATE TABLE public.changesets (
312 user_id bigint NOT NULL,
313 created_at timestamp without time zone NOT NULL,
318 closed_at timestamp without time zone NOT NULL,
319 num_changes integer DEFAULT 0 NOT NULL
324 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
327 CREATE SEQUENCE public.changesets_id_seq
336 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
339 ALTER SEQUENCE public.changesets_id_seq OWNED BY public.changesets.id;
343 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
346 CREATE TABLE public.changesets_subscribers (
347 subscriber_id bigint NOT NULL,
348 changeset_id bigint NOT NULL
353 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
356 CREATE TABLE public.client_applications (
358 name character varying,
359 url character varying,
360 support_url character varying,
361 callback_url character varying,
362 key character varying(50),
363 secret character varying(50),
365 created_at timestamp without time zone,
366 updated_at timestamp without time zone,
367 allow_read_prefs boolean DEFAULT false NOT NULL,
368 allow_write_prefs boolean DEFAULT false NOT NULL,
369 allow_write_diary boolean DEFAULT false NOT NULL,
370 allow_write_api boolean DEFAULT false NOT NULL,
371 allow_read_gpx boolean DEFAULT false NOT NULL,
372 allow_write_gpx boolean DEFAULT false NOT NULL,
373 allow_write_notes boolean DEFAULT false NOT NULL
378 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
381 CREATE SEQUENCE public.client_applications_id_seq
390 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
393 ALTER SEQUENCE public.client_applications_id_seq OWNED BY public.client_applications.id;
397 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
400 CREATE TABLE public.current_node_tags (
401 node_id bigint NOT NULL,
402 k character varying DEFAULT ''::character varying NOT NULL,
403 v character varying DEFAULT ''::character varying NOT NULL
408 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
411 CREATE TABLE public.current_nodes (
413 latitude integer NOT NULL,
414 longitude integer NOT NULL,
415 changeset_id bigint NOT NULL,
416 visible boolean NOT NULL,
417 "timestamp" timestamp without time zone NOT NULL,
418 tile bigint NOT NULL,
419 version bigint NOT NULL
424 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
427 CREATE SEQUENCE public.current_nodes_id_seq
436 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
439 ALTER SEQUENCE public.current_nodes_id_seq OWNED BY public.current_nodes.id;
443 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
446 CREATE TABLE public.current_relation_members (
447 relation_id bigint NOT NULL,
448 member_type public.nwr_enum NOT NULL,
449 member_id bigint NOT NULL,
450 member_role character varying NOT NULL,
451 sequence_id integer DEFAULT 0 NOT NULL
456 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
459 CREATE TABLE public.current_relation_tags (
460 relation_id bigint NOT NULL,
461 k character varying DEFAULT ''::character varying NOT NULL,
462 v character varying DEFAULT ''::character varying NOT NULL
467 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
470 CREATE TABLE public.current_relations (
472 changeset_id bigint NOT NULL,
473 "timestamp" timestamp without time zone NOT NULL,
474 visible boolean NOT NULL,
475 version bigint NOT NULL
480 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
483 CREATE SEQUENCE public.current_relations_id_seq
492 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
495 ALTER SEQUENCE public.current_relations_id_seq OWNED BY public.current_relations.id;
499 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
502 CREATE TABLE public.current_way_nodes (
503 way_id bigint NOT NULL,
504 node_id bigint NOT NULL,
505 sequence_id bigint NOT NULL
510 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
513 CREATE TABLE public.current_way_tags (
514 way_id bigint NOT NULL,
515 k character varying DEFAULT ''::character varying NOT NULL,
516 v character varying DEFAULT ''::character varying NOT NULL
521 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
524 CREATE TABLE public.current_ways (
526 changeset_id bigint NOT NULL,
527 "timestamp" timestamp without time zone NOT NULL,
528 visible boolean NOT NULL,
529 version bigint NOT NULL
534 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
537 CREATE SEQUENCE public.current_ways_id_seq
546 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
549 ALTER SEQUENCE public.current_ways_id_seq OWNED BY public.current_ways.id;
553 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
556 CREATE TABLE public.delayed_jobs (
558 priority integer DEFAULT 0 NOT NULL,
559 attempts integer DEFAULT 0 NOT NULL,
560 handler text NOT NULL,
562 run_at timestamp without time zone,
563 locked_at timestamp without time zone,
564 failed_at timestamp without time zone,
565 locked_by character varying,
566 queue character varying,
567 created_at timestamp without time zone,
568 updated_at timestamp without time zone
573 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
576 CREATE SEQUENCE public.delayed_jobs_id_seq
585 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
588 ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id;
592 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
595 CREATE TABLE public.diary_comments (
597 diary_entry_id bigint NOT NULL,
598 user_id bigint NOT NULL,
600 created_at timestamp without time zone NOT NULL,
601 updated_at timestamp without time zone NOT NULL,
602 visible boolean DEFAULT true NOT NULL,
603 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
608 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
611 CREATE SEQUENCE public.diary_comments_id_seq
620 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
623 ALTER SEQUENCE public.diary_comments_id_seq OWNED BY public.diary_comments.id;
627 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
630 CREATE TABLE public.diary_entries (
632 user_id bigint NOT NULL,
633 title character varying NOT NULL,
635 created_at timestamp without time zone NOT NULL,
636 updated_at timestamp without time zone NOT NULL,
637 latitude double precision,
638 longitude double precision,
639 language_code character varying DEFAULT 'en'::character varying NOT NULL,
640 visible boolean DEFAULT true NOT NULL,
641 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
646 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
649 CREATE SEQUENCE public.diary_entries_id_seq
658 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
661 ALTER SEQUENCE public.diary_entries_id_seq OWNED BY public.diary_entries.id;
665 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
668 CREATE TABLE public.diary_entry_subscriptions (
669 user_id bigint NOT NULL,
670 diary_entry_id bigint NOT NULL
675 -- Name: friends; Type: TABLE; Schema: public; Owner: -
678 CREATE TABLE public.friends (
680 user_id bigint NOT NULL,
681 friend_user_id bigint NOT NULL
686 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
689 CREATE SEQUENCE public.friends_id_seq
698 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
701 ALTER SEQUENCE public.friends_id_seq OWNED BY public.friends.id;
705 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
708 CREATE TABLE public.gps_points (
709 altitude double precision,
710 trackid integer NOT NULL,
711 latitude integer NOT NULL,
712 longitude integer NOT NULL,
713 gpx_id bigint NOT NULL,
714 "timestamp" timestamp without time zone,
720 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
723 CREATE TABLE public.gpx_file_tags (
724 gpx_id bigint DEFAULT 0 NOT NULL,
725 tag character varying NOT NULL,
731 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
734 CREATE SEQUENCE public.gpx_file_tags_id_seq
743 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
746 ALTER SEQUENCE public.gpx_file_tags_id_seq OWNED BY public.gpx_file_tags.id;
750 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
753 CREATE TABLE public.gpx_files (
755 user_id bigint NOT NULL,
756 visible boolean DEFAULT true NOT NULL,
757 name character varying DEFAULT ''::character varying NOT NULL,
759 latitude double precision,
760 longitude double precision,
761 "timestamp" timestamp without time zone NOT NULL,
762 description character varying DEFAULT ''::character varying NOT NULL,
763 inserted boolean NOT NULL,
764 visibility public.gpx_visibility_enum DEFAULT 'public'::public.gpx_visibility_enum NOT NULL
769 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
772 CREATE SEQUENCE public.gpx_files_id_seq
781 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
784 ALTER SEQUENCE public.gpx_files_id_seq OWNED BY public.gpx_files.id;
788 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
791 CREATE TABLE public.issue_comments (
793 issue_id integer NOT NULL,
794 user_id integer NOT NULL,
796 created_at timestamp without time zone NOT NULL,
797 updated_at timestamp without time zone NOT NULL
802 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
805 CREATE SEQUENCE public.issue_comments_id_seq
814 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
817 ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id;
821 -- Name: issues; Type: TABLE; Schema: public; Owner: -
824 CREATE TABLE public.issues (
826 reportable_type character varying NOT NULL,
827 reportable_id integer NOT NULL,
828 reported_user_id integer,
829 status public.issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
830 assigned_role public.user_role_enum NOT NULL,
831 resolved_at timestamp without time zone,
834 reports_count integer DEFAULT 0,
835 created_at timestamp without time zone NOT NULL,
836 updated_at timestamp without time zone NOT NULL
841 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
844 CREATE SEQUENCE public.issues_id_seq
853 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
856 ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id;
860 -- Name: languages; Type: TABLE; Schema: public; Owner: -
863 CREATE TABLE public.languages (
864 code character varying NOT NULL,
865 english_name character varying NOT NULL,
866 native_name character varying
871 -- Name: messages; Type: TABLE; Schema: public; Owner: -
874 CREATE TABLE public.messages (
876 from_user_id bigint NOT NULL,
877 title character varying NOT NULL,
879 sent_on timestamp without time zone NOT NULL,
880 message_read boolean DEFAULT false NOT NULL,
881 to_user_id bigint NOT NULL,
882 to_user_visible boolean DEFAULT true NOT NULL,
883 from_user_visible boolean DEFAULT true NOT NULL,
884 body_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
889 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
892 CREATE SEQUENCE public.messages_id_seq
901 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
904 ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
908 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
911 CREATE TABLE public.node_tags (
912 node_id bigint NOT NULL,
913 version bigint NOT NULL,
914 k character varying DEFAULT ''::character varying NOT NULL,
915 v character varying DEFAULT ''::character varying NOT NULL
920 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
923 CREATE TABLE public.nodes (
924 node_id bigint NOT NULL,
925 latitude integer NOT NULL,
926 longitude integer NOT NULL,
927 changeset_id bigint NOT NULL,
928 visible boolean NOT NULL,
929 "timestamp" timestamp without time zone NOT NULL,
930 tile bigint NOT NULL,
931 version bigint NOT NULL,
937 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
940 CREATE TABLE public.note_comments (
942 note_id bigint NOT NULL,
943 visible boolean NOT NULL,
944 created_at timestamp without time zone NOT NULL,
948 event public.note_event_enum
953 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
956 CREATE SEQUENCE public.note_comments_id_seq
965 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
968 ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
972 -- Name: notes; Type: TABLE; Schema: public; Owner: -
975 CREATE TABLE public.notes (
977 latitude integer NOT NULL,
978 longitude integer NOT NULL,
979 tile bigint NOT NULL,
980 updated_at timestamp without time zone NOT NULL,
981 created_at timestamp without time zone NOT NULL,
982 status public.note_status_enum NOT NULL,
983 closed_at timestamp without time zone
988 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
991 CREATE SEQUENCE public.notes_id_seq
1000 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1003 ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
1007 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
1010 CREATE TABLE public.oauth_nonces (
1011 id integer NOT NULL,
1012 nonce character varying,
1013 "timestamp" integer,
1014 created_at timestamp without time zone,
1015 updated_at timestamp without time zone
1020 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1023 CREATE SEQUENCE public.oauth_nonces_id_seq
1032 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1035 ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id;
1039 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
1042 CREATE TABLE public.oauth_tokens (
1043 id integer NOT NULL,
1045 type character varying(20),
1046 client_application_id integer,
1047 token character varying(50),
1048 secret character varying(50),
1049 authorized_at timestamp without time zone,
1050 invalidated_at timestamp without time zone,
1051 created_at timestamp without time zone,
1052 updated_at timestamp without time zone,
1053 allow_read_prefs boolean DEFAULT false NOT NULL,
1054 allow_write_prefs boolean DEFAULT false NOT NULL,
1055 allow_write_diary boolean DEFAULT false NOT NULL,
1056 allow_write_api boolean DEFAULT false NOT NULL,
1057 allow_read_gpx boolean DEFAULT false NOT NULL,
1058 allow_write_gpx boolean DEFAULT false NOT NULL,
1059 callback_url character varying,
1060 verifier character varying(20),
1061 scope character varying,
1062 valid_to timestamp without time zone,
1063 allow_write_notes boolean DEFAULT false NOT NULL
1068 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1071 CREATE SEQUENCE public.oauth_tokens_id_seq
1080 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1083 ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
1087 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1090 CREATE TABLE public.redactions (
1091 id integer NOT NULL,
1092 title character varying,
1094 created_at timestamp without time zone,
1095 updated_at timestamp without time zone,
1096 user_id bigint NOT NULL,
1097 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1102 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1105 CREATE SEQUENCE public.redactions_id_seq
1114 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1117 ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
1121 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1124 CREATE TABLE public.relation_members (
1125 relation_id bigint DEFAULT 0 NOT NULL,
1126 member_type public.nwr_enum NOT NULL,
1127 member_id bigint NOT NULL,
1128 member_role character varying NOT NULL,
1129 version bigint DEFAULT 0 NOT NULL,
1130 sequence_id integer DEFAULT 0 NOT NULL
1135 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1138 CREATE TABLE public.relation_tags (
1139 relation_id bigint DEFAULT 0 NOT NULL,
1140 k character varying DEFAULT ''::character varying NOT NULL,
1141 v character varying DEFAULT ''::character varying NOT NULL,
1142 version bigint NOT NULL
1147 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1150 CREATE TABLE public.relations (
1151 relation_id bigint DEFAULT 0 NOT NULL,
1152 changeset_id bigint NOT NULL,
1153 "timestamp" timestamp without time zone NOT NULL,
1154 version bigint NOT NULL,
1155 visible boolean DEFAULT true NOT NULL,
1156 redaction_id integer
1161 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1164 CREATE TABLE public.reports (
1165 id integer NOT NULL,
1166 issue_id integer NOT NULL,
1167 user_id integer NOT NULL,
1168 details text NOT NULL,
1169 category character varying NOT NULL,
1170 created_at timestamp without time zone NOT NULL,
1171 updated_at timestamp without time zone NOT NULL
1176 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1179 CREATE SEQUENCE public.reports_id_seq
1188 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1191 ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
1195 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1198 CREATE TABLE public.schema_migrations (
1199 version character varying NOT NULL
1204 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1207 CREATE TABLE public.user_blocks (
1208 id integer NOT NULL,
1209 user_id bigint NOT NULL,
1210 creator_id bigint NOT NULL,
1211 reason text NOT NULL,
1212 ends_at timestamp without time zone NOT NULL,
1213 needs_view boolean DEFAULT false NOT NULL,
1215 created_at timestamp without time zone,
1216 updated_at timestamp without time zone,
1217 reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
1222 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1225 CREATE SEQUENCE public.user_blocks_id_seq
1234 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1237 ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
1241 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1244 CREATE TABLE public.user_preferences (
1245 user_id bigint NOT NULL,
1246 k character varying NOT NULL,
1247 v character varying NOT NULL
1252 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1255 CREATE TABLE public.user_roles (
1256 id integer NOT NULL,
1257 user_id bigint NOT NULL,
1258 created_at timestamp without time zone,
1259 updated_at timestamp without time zone,
1260 role public.user_role_enum NOT NULL,
1261 granter_id bigint NOT NULL
1266 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1269 CREATE SEQUENCE public.user_roles_id_seq
1278 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1281 ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
1285 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1288 CREATE TABLE public.user_tokens (
1290 user_id bigint NOT NULL,
1291 token character varying NOT NULL,
1292 expiry timestamp without time zone NOT NULL,
1298 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1301 CREATE SEQUENCE public.user_tokens_id_seq
1310 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1313 ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id;
1317 -- Name: users; Type: TABLE; Schema: public; Owner: -
1320 CREATE TABLE public.users (
1321 email character varying NOT NULL,
1323 pass_crypt character varying NOT NULL,
1324 creation_time timestamp without time zone NOT NULL,
1325 display_name character varying DEFAULT ''::character varying NOT NULL,
1326 data_public boolean DEFAULT false NOT NULL,
1327 description text DEFAULT ''::text NOT NULL,
1328 home_lat double precision,
1329 home_lon double precision,
1330 home_zoom smallint DEFAULT 3,
1331 nearby integer DEFAULT 50,
1332 pass_salt character varying,
1333 image_file_name text,
1334 email_valid boolean DEFAULT false NOT NULL,
1335 new_email character varying,
1336 creation_ip character varying,
1337 languages character varying,
1338 status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
1339 terms_agreed timestamp without time zone,
1340 consider_pd boolean DEFAULT false NOT NULL,
1341 auth_uid character varying,
1342 preferred_editor character varying,
1343 terms_seen boolean DEFAULT false NOT NULL,
1344 description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
1345 image_fingerprint character varying,
1346 changesets_count integer DEFAULT 0 NOT NULL,
1347 traces_count integer DEFAULT 0 NOT NULL,
1348 diary_entries_count integer DEFAULT 0 NOT NULL,
1349 image_use_gravatar boolean DEFAULT false NOT NULL,
1350 image_content_type character varying,
1351 auth_provider character varying,
1353 tou_agreed timestamp without time zone
1358 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1361 CREATE SEQUENCE public.users_id_seq
1370 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1373 ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
1377 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1380 CREATE TABLE public.way_nodes (
1381 way_id bigint NOT NULL,
1382 node_id bigint NOT NULL,
1383 version bigint NOT NULL,
1384 sequence_id bigint NOT NULL
1389 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1392 CREATE TABLE public.way_tags (
1393 way_id bigint DEFAULT 0 NOT NULL,
1394 k character varying NOT NULL,
1395 v character varying NOT NULL,
1396 version bigint NOT NULL
1401 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1404 CREATE TABLE public.ways (
1405 way_id bigint DEFAULT 0 NOT NULL,
1406 changeset_id bigint NOT NULL,
1407 "timestamp" timestamp without time zone NOT NULL,
1408 version bigint NOT NULL,
1409 visible boolean DEFAULT true NOT NULL,
1410 redaction_id integer
1415 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1418 ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
1422 -- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
1425 ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
1429 -- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
1432 ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
1436 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1439 ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
1443 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1446 ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
1450 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1453 ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
1457 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1460 ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
1464 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1467 ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
1471 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1474 ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
1478 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1481 ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
1485 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1488 ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
1492 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1495 ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
1499 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1502 ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
1506 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1509 ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
1513 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1516 ALTER TABLE ONLY public.gpx_files ALTER COLUMN id SET DEFAULT nextval('public.gpx_files_id_seq'::regclass);
1520 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1523 ALTER TABLE ONLY public.issue_comments ALTER COLUMN id SET DEFAULT nextval('public.issue_comments_id_seq'::regclass);
1527 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1530 ALTER TABLE ONLY public.issues ALTER COLUMN id SET DEFAULT nextval('public.issues_id_seq'::regclass);
1534 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1537 ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
1541 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1544 ALTER TABLE ONLY public.note_comments ALTER COLUMN id SET DEFAULT nextval('public.note_comments_id_seq'::regclass);
1548 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1551 ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass);
1555 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1558 ALTER TABLE ONLY public.oauth_nonces ALTER COLUMN id SET DEFAULT nextval('public.oauth_nonces_id_seq'::regclass);
1562 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1565 ALTER TABLE ONLY public.oauth_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_tokens_id_seq'::regclass);
1569 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1572 ALTER TABLE ONLY public.redactions ALTER COLUMN id SET DEFAULT nextval('public.redactions_id_seq'::regclass);
1576 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1579 ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
1583 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1586 ALTER TABLE ONLY public.user_blocks ALTER COLUMN id SET DEFAULT nextval('public.user_blocks_id_seq'::regclass);
1590 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1593 ALTER TABLE ONLY public.user_roles ALTER COLUMN id SET DEFAULT nextval('public.user_roles_id_seq'::regclass);
1597 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1600 ALTER TABLE ONLY public.user_tokens ALTER COLUMN id SET DEFAULT nextval('public.user_tokens_id_seq'::regclass);
1604 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1607 ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
1611 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1614 ALTER TABLE ONLY public.acls
1615 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1619 -- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1622 ALTER TABLE ONLY public.active_storage_attachments
1623 ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id);
1627 -- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1630 ALTER TABLE ONLY public.active_storage_blobs
1631 ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id);
1635 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1638 ALTER TABLE ONLY public.ar_internal_metadata
1639 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1643 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1646 ALTER TABLE ONLY public.changeset_comments
1647 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1651 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1654 ALTER TABLE ONLY public.changesets
1655 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1659 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1662 ALTER TABLE ONLY public.client_applications
1663 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1667 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1670 ALTER TABLE ONLY public.current_node_tags
1671 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1675 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1678 ALTER TABLE ONLY public.current_nodes
1679 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1683 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1686 ALTER TABLE ONLY public.current_relation_members
1687 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1691 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1694 ALTER TABLE ONLY public.current_relation_tags
1695 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1699 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1702 ALTER TABLE ONLY public.current_relations
1703 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1707 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1710 ALTER TABLE ONLY public.current_way_nodes
1711 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1715 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1718 ALTER TABLE ONLY public.current_way_tags
1719 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1723 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1726 ALTER TABLE ONLY public.current_ways
1727 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1731 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1734 ALTER TABLE ONLY public.delayed_jobs
1735 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1739 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1742 ALTER TABLE ONLY public.diary_comments
1743 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1747 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1750 ALTER TABLE ONLY public.diary_entries
1751 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1755 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1758 ALTER TABLE ONLY public.diary_entry_subscriptions
1759 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1763 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1766 ALTER TABLE ONLY public.friends
1767 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1771 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1774 ALTER TABLE ONLY public.gpx_file_tags
1775 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1779 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1782 ALTER TABLE ONLY public.gpx_files
1783 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1787 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1790 ALTER TABLE ONLY public.issue_comments
1791 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1795 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1798 ALTER TABLE ONLY public.issues
1799 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
1803 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1806 ALTER TABLE ONLY public.languages
1807 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1811 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1814 ALTER TABLE ONLY public.messages
1815 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1819 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1822 ALTER TABLE ONLY public.node_tags
1823 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1827 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1830 ALTER TABLE ONLY public.nodes
1831 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1835 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1838 ALTER TABLE ONLY public.note_comments
1839 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1843 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1846 ALTER TABLE ONLY public.notes
1847 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1851 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1854 ALTER TABLE ONLY public.oauth_nonces
1855 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1859 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1862 ALTER TABLE ONLY public.oauth_tokens
1863 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1867 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1870 ALTER TABLE ONLY public.redactions
1871 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1875 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1878 ALTER TABLE ONLY public.relation_members
1879 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1883 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1886 ALTER TABLE ONLY public.relation_tags
1887 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1891 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1894 ALTER TABLE ONLY public.relations
1895 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1899 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1902 ALTER TABLE ONLY public.reports
1903 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
1907 -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1910 ALTER TABLE ONLY public.schema_migrations
1911 ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
1915 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1918 ALTER TABLE ONLY public.user_blocks
1919 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1923 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1926 ALTER TABLE ONLY public.user_preferences
1927 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1931 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1934 ALTER TABLE ONLY public.user_roles
1935 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1939 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1942 ALTER TABLE ONLY public.user_tokens
1943 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
1947 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1950 ALTER TABLE ONLY public.users
1951 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
1955 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1958 ALTER TABLE ONLY public.way_nodes
1959 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
1963 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1966 ALTER TABLE ONLY public.way_tags
1967 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
1971 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1974 ALTER TABLE ONLY public.ways
1975 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
1979 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
1982 CREATE INDEX acls_k_idx ON public.acls USING btree (k);
1986 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
1989 CREATE INDEX changeset_tags_id_idx ON public.changeset_tags USING btree (changeset_id);
1993 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
1996 CREATE INDEX changesets_bbox_idx ON public.changesets USING gist (min_lat, max_lat, min_lon, max_lon);
2000 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
2003 CREATE INDEX changesets_closed_at_idx ON public.changesets USING btree (closed_at);
2007 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
2010 CREATE INDEX changesets_created_at_idx ON public.changesets USING btree (created_at);
2014 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
2017 CREATE INDEX changesets_user_id_created_at_idx ON public.changesets USING btree (user_id, created_at);
2021 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
2024 CREATE INDEX changesets_user_id_id_idx ON public.changesets USING btree (user_id, id);
2028 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2031 CREATE INDEX current_nodes_tile_idx ON public.current_nodes USING btree (tile);
2035 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2038 CREATE INDEX current_nodes_timestamp_idx ON public.current_nodes USING btree ("timestamp");
2042 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2045 CREATE INDEX current_relation_members_member_idx ON public.current_relation_members USING btree (member_type, member_id);
2049 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2052 CREATE INDEX current_relations_timestamp_idx ON public.current_relations USING btree ("timestamp");
2056 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2059 CREATE INDEX current_way_nodes_node_idx ON public.current_way_nodes USING btree (node_id);
2063 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2066 CREATE INDEX current_ways_timestamp_idx ON public.current_ways USING btree ("timestamp");
2070 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
2073 CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at);
2077 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2080 CREATE INDEX diary_comment_user_id_created_at_index ON public.diary_comments USING btree (user_id, created_at);
2084 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
2087 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON public.diary_comments USING btree (diary_entry_id, id);
2091 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2094 CREATE INDEX diary_entry_created_at_index ON public.diary_entries USING btree (created_at);
2098 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2101 CREATE INDEX diary_entry_language_code_created_at_index ON public.diary_entries USING btree (language_code, created_at);
2105 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2108 CREATE INDEX diary_entry_user_id_created_at_index ON public.diary_entries USING btree (user_id, created_at);
2112 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -
2115 CREATE INDEX friends_user_id_idx ON public.friends USING btree (user_id);
2119 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2122 CREATE INDEX gpx_file_tags_gpxid_idx ON public.gpx_file_tags USING btree (gpx_id);
2126 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2129 CREATE INDEX gpx_file_tags_tag_idx ON public.gpx_file_tags USING btree (tag);
2133 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2136 CREATE INDEX gpx_files_timestamp_idx ON public.gpx_files USING btree ("timestamp");
2140 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2143 CREATE INDEX gpx_files_user_id_idx ON public.gpx_files USING btree (user_id);
2147 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2150 CREATE INDEX gpx_files_visible_visibility_idx ON public.gpx_files USING btree (visible, visibility);
2154 -- Name: index_acls_on_address; Type: INDEX; Schema: public; Owner: -
2157 CREATE INDEX index_acls_on_address ON public.acls USING gist (address inet_ops);
2161 -- Name: index_acls_on_domain; Type: INDEX; Schema: public; Owner: -
2164 CREATE INDEX index_acls_on_domain ON public.acls USING btree (domain);
2168 -- Name: index_acls_on_mx; Type: INDEX; Schema: public; Owner: -
2171 CREATE INDEX index_acls_on_mx ON public.acls USING btree (mx);
2175 -- Name: index_active_storage_attachments_on_blob_id; Type: INDEX; Schema: public; Owner: -
2178 CREATE INDEX index_active_storage_attachments_on_blob_id ON public.active_storage_attachments USING btree (blob_id);
2182 -- Name: index_active_storage_attachments_uniqueness; Type: INDEX; Schema: public; Owner: -
2185 CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active_storage_attachments USING btree (record_type, record_id, name, blob_id);
2189 -- Name: index_active_storage_blobs_on_key; Type: INDEX; Schema: public; Owner: -
2192 CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key);
2196 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2199 CREATE INDEX index_changeset_comments_on_created_at ON public.changeset_comments USING btree (created_at);
2203 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2206 CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_subscribers USING btree (changeset_id);
2210 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2213 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
2217 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2220 CREATE UNIQUE INDEX index_client_applications_on_key ON public.client_applications USING btree (key);
2224 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2227 CREATE INDEX index_client_applications_on_user_id ON public.client_applications USING btree (user_id);
2231 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2234 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON public.diary_entry_subscriptions USING btree (diary_entry_id);
2238 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2241 CREATE INDEX index_issue_comments_on_issue_id ON public.issue_comments USING btree (issue_id);
2245 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2248 CREATE INDEX index_issue_comments_on_user_id ON public.issue_comments USING btree (user_id);
2252 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2255 CREATE INDEX index_issues_on_assigned_role ON public.issues USING btree (assigned_role);
2259 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2262 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON public.issues USING btree (reportable_type, reportable_id);
2266 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2269 CREATE INDEX index_issues_on_reported_user_id ON public.issues USING btree (reported_user_id);
2273 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2276 CREATE INDEX index_issues_on_status ON public.issues USING btree (status);
2280 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2283 CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by);
2287 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2290 CREATE INDEX index_note_comments_on_body ON public.note_comments USING gin (to_tsvector('english'::regconfig, body));
2294 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2297 CREATE INDEX index_note_comments_on_created_at ON public.note_comments USING btree (created_at);
2301 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2304 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON public.oauth_nonces USING btree (nonce, "timestamp");
2308 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2311 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON public.oauth_tokens USING btree (token);
2315 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2318 CREATE INDEX index_oauth_tokens_on_user_id ON public.oauth_tokens USING btree (user_id);
2322 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2325 CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
2329 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2332 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
2336 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2339 CREATE INDEX index_user_blocks_on_user_id ON public.user_blocks USING btree (user_id);
2343 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2346 CREATE INDEX messages_from_user_id_idx ON public.messages USING btree (from_user_id);
2350 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2353 CREATE INDEX messages_to_user_id_idx ON public.messages USING btree (to_user_id);
2357 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2360 CREATE INDEX nodes_changeset_id_idx ON public.nodes USING btree (changeset_id);
2364 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2367 CREATE INDEX nodes_tile_idx ON public.nodes USING btree (tile);
2371 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2374 CREATE INDEX nodes_timestamp_idx ON public.nodes USING btree ("timestamp");
2378 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2381 CREATE INDEX note_comments_note_id_idx ON public.note_comments USING btree (note_id);
2385 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2388 CREATE INDEX notes_created_at_idx ON public.notes USING btree (created_at);
2392 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2395 CREATE INDEX notes_tile_status_idx ON public.notes USING btree (tile, status);
2399 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2402 CREATE INDEX notes_updated_at_idx ON public.notes USING btree (updated_at);
2406 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2409 CREATE INDEX points_gpxid_idx ON public.gps_points USING btree (gpx_id);
2413 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2416 CREATE INDEX points_tile_idx ON public.gps_points USING btree (tile);
2420 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2423 CREATE INDEX relation_members_member_idx ON public.relation_members USING btree (member_type, member_id);
2427 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2430 CREATE INDEX relations_changeset_id_idx ON public.relations USING btree (changeset_id);
2434 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2437 CREATE INDEX relations_timestamp_idx ON public.relations USING btree ("timestamp");
2441 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2444 CREATE INDEX user_id_idx ON public.friends USING btree (friend_user_id);
2448 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2451 CREATE UNIQUE INDEX user_roles_id_role_unique ON public.user_roles USING btree (user_id, role);
2455 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2458 CREATE UNIQUE INDEX user_tokens_token_idx ON public.user_tokens USING btree (token);
2462 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2465 CREATE INDEX user_tokens_user_id_idx ON public.user_tokens USING btree (user_id);
2469 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2472 CREATE UNIQUE INDEX users_auth_idx ON public.users USING btree (auth_provider, auth_uid);
2476 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2479 CREATE UNIQUE INDEX users_display_name_idx ON public.users USING btree (display_name);
2483 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2486 CREATE INDEX users_display_name_lower_idx ON public.users USING btree (lower((display_name)::text));
2490 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2493 CREATE UNIQUE INDEX users_email_idx ON public.users USING btree (email);
2497 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2500 CREATE INDEX users_email_lower_idx ON public.users USING btree (lower((email)::text));
2504 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2507 CREATE INDEX users_home_idx ON public.users USING btree (home_tile);
2511 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2514 CREATE INDEX way_nodes_node_idx ON public.way_nodes USING btree (node_id);
2518 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2521 CREATE INDEX ways_changeset_id_idx ON public.ways USING btree (changeset_id);
2525 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2528 CREATE INDEX ways_timestamp_idx ON public.ways USING btree ("timestamp");
2532 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2535 ALTER TABLE ONLY public.changeset_comments
2536 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2540 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2543 ALTER TABLE ONLY public.changeset_comments
2544 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2548 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2551 ALTER TABLE ONLY public.changeset_tags
2552 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2556 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2559 ALTER TABLE ONLY public.changesets_subscribers
2560 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2564 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2567 ALTER TABLE ONLY public.changesets_subscribers
2568 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES public.users(id);
2572 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2575 ALTER TABLE ONLY public.changesets
2576 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2580 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2583 ALTER TABLE ONLY public.client_applications
2584 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2588 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2591 ALTER TABLE ONLY public.current_node_tags
2592 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2596 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2599 ALTER TABLE ONLY public.current_nodes
2600 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2604 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2607 ALTER TABLE ONLY public.current_relation_members
2608 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2612 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2615 ALTER TABLE ONLY public.current_relation_tags
2616 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES public.current_relations(id);
2620 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2623 ALTER TABLE ONLY public.current_relations
2624 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2628 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2631 ALTER TABLE ONLY public.current_way_nodes
2632 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2636 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2639 ALTER TABLE ONLY public.current_way_nodes
2640 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES public.current_nodes(id);
2644 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2647 ALTER TABLE ONLY public.current_way_tags
2648 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES public.current_ways(id);
2652 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2655 ALTER TABLE ONLY public.current_ways
2656 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2660 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2663 ALTER TABLE ONLY public.diary_comments
2664 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2668 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2671 ALTER TABLE ONLY public.diary_comments
2672 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2676 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2679 ALTER TABLE ONLY public.diary_entries
2680 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES public.languages(code);
2684 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2687 ALTER TABLE ONLY public.diary_entries
2688 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2692 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2695 ALTER TABLE ONLY public.diary_entry_subscriptions
2696 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES public.diary_entries(id);
2700 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2703 ALTER TABLE ONLY public.diary_entry_subscriptions
2704 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2708 -- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: public; Owner: -
2711 ALTER TABLE ONLY public.active_storage_attachments
2712 ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES public.active_storage_blobs(id);
2716 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2719 ALTER TABLE ONLY public.friends
2720 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES public.users(id);
2724 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2727 ALTER TABLE ONLY public.friends
2728 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2732 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2735 ALTER TABLE ONLY public.gps_points
2736 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2740 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2743 ALTER TABLE ONLY public.gpx_file_tags
2744 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES public.gpx_files(id);
2748 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2751 ALTER TABLE ONLY public.gpx_files
2752 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2756 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2759 ALTER TABLE ONLY public.issue_comments
2760 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2764 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2767 ALTER TABLE ONLY public.issue_comments
2768 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2772 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2775 ALTER TABLE ONLY public.issues
2776 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES public.users(id);
2780 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2783 ALTER TABLE ONLY public.issues
2784 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES public.users(id);
2788 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2791 ALTER TABLE ONLY public.issues
2792 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.users(id);
2796 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2799 ALTER TABLE ONLY public.messages
2800 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES public.users(id);
2804 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2807 ALTER TABLE ONLY public.messages
2808 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES public.users(id);
2812 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2815 ALTER TABLE ONLY public.node_tags
2816 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES public.nodes(node_id, version);
2820 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2823 ALTER TABLE ONLY public.nodes
2824 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2828 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2831 ALTER TABLE ONLY public.nodes
2832 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2836 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2839 ALTER TABLE ONLY public.note_comments
2840 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES public.users(id);
2844 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2847 ALTER TABLE ONLY public.note_comments
2848 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES public.notes(id);
2852 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2855 ALTER TABLE ONLY public.oauth_tokens
2856 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES public.client_applications(id);
2860 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2863 ALTER TABLE ONLY public.oauth_tokens
2864 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2868 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2871 ALTER TABLE ONLY public.redactions
2872 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2876 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2879 ALTER TABLE ONLY public.relation_members
2880 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2884 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2887 ALTER TABLE ONLY public.relation_tags
2888 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES public.relations(relation_id, version);
2892 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2895 ALTER TABLE ONLY public.relations
2896 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
2900 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2903 ALTER TABLE ONLY public.relations
2904 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
2908 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2911 ALTER TABLE ONLY public.reports
2912 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issues(id);
2916 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2919 ALTER TABLE ONLY public.reports
2920 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2924 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2927 ALTER TABLE ONLY public.user_blocks
2928 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
2932 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2935 ALTER TABLE ONLY public.user_blocks
2936 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES public.users(id);
2940 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2943 ALTER TABLE ONLY public.user_blocks
2944 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2948 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2951 ALTER TABLE ONLY public.user_preferences
2952 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2956 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2959 ALTER TABLE ONLY public.user_roles
2960 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES public.users(id);
2964 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2967 ALTER TABLE ONLY public.user_roles
2968 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2972 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2975 ALTER TABLE ONLY public.user_tokens
2976 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
2980 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2983 ALTER TABLE ONLY public.way_nodes
2984 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
2988 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2991 ALTER TABLE ONLY public.way_tags
2992 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES public.ways(way_id, version);
2996 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2999 ALTER TABLE ONLY public.ways
3000 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES public.changesets(id);
3004 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3007 ALTER TABLE ONLY public.ways
3008 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES public.redactions(id);
3012 -- PostgreSQL database dump complete
3015 SET search_path TO "$user", public;
3017 INSERT INTO "schema_migrations" (version) VALUES