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 SET check_function_bodies = false;
7 SET client_min_messages = warning;
8 SET row_security = off;
11 -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
14 CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
18 -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
21 COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
25 -- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: -
28 CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public;
32 -- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: -
35 COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST';
38 SET search_path = public, pg_catalog;
41 -- Name: format_enum; Type: TYPE; Schema: public; Owner: -
44 CREATE TYPE format_enum AS ENUM (
52 -- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: -
55 CREATE TYPE gpx_visibility_enum AS ENUM (
64 -- Name: issue_status_enum; Type: TYPE; Schema: public; Owner: -
67 CREATE TYPE issue_status_enum AS ENUM (
75 -- Name: note_event_enum; Type: TYPE; Schema: public; Owner: -
78 CREATE TYPE note_event_enum AS ENUM (
88 -- Name: note_status_enum; Type: TYPE; Schema: public; Owner: -
91 CREATE TYPE note_status_enum AS ENUM (
99 -- Name: nwr_enum; Type: TYPE; Schema: public; Owner: -
102 CREATE TYPE nwr_enum AS ENUM (
110 -- Name: user_role_enum; Type: TYPE; Schema: public; Owner: -
113 CREATE TYPE user_role_enum AS ENUM (
120 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
123 CREATE TYPE user_status_enum AS ENUM (
133 -- Name: maptile_for_point(bigint, bigint, integer); Type: FUNCTION; Schema: public; Owner: -
136 CREATE FUNCTION maptile_for_point(bigint, bigint, integer) RETURNS integer
138 AS '$libdir/libpgosm', 'maptile_for_point';
142 -- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
145 CREATE FUNCTION tile_for_point(integer, integer) RETURNS bigint
147 AS '$libdir/libpgosm', 'tile_for_point';
151 -- Name: xid_to_int4(xid); Type: FUNCTION; Schema: public; Owner: -
154 CREATE FUNCTION xid_to_int4(xid) RETURNS integer
155 LANGUAGE c IMMUTABLE STRICT
156 AS '$libdir/libpgosm', 'xid_to_int4';
159 SET default_tablespace = '';
161 SET default_with_oids = false;
164 -- Name: acls; Type: TABLE; Schema: public; Owner: -
170 k character varying(255) NOT NULL,
171 v character varying(255),
172 domain character varying(255)
177 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
180 CREATE SEQUENCE acls_id_seq
189 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
192 ALTER SEQUENCE acls_id_seq OWNED BY acls.id;
196 -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
199 CREATE TABLE ar_internal_metadata (
200 key character varying NOT NULL,
201 value character varying,
202 created_at timestamp without time zone NOT NULL,
203 updated_at timestamp without time zone NOT NULL
208 -- Name: changeset_comments; Type: TABLE; Schema: public; Owner: -
211 CREATE TABLE changeset_comments (
213 changeset_id bigint NOT NULL,
214 author_id bigint NOT NULL,
216 created_at timestamp without time zone NOT NULL,
217 visible boolean NOT NULL
222 -- Name: changeset_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
225 CREATE SEQUENCE changeset_comments_id_seq
234 -- Name: changeset_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
237 ALTER SEQUENCE changeset_comments_id_seq OWNED BY changeset_comments.id;
241 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -
244 CREATE TABLE changeset_tags (
245 changeset_id bigint NOT NULL,
246 k character varying(255) DEFAULT ''::character varying NOT NULL,
247 v character varying(255) DEFAULT ''::character varying NOT NULL
252 -- Name: changesets; Type: TABLE; Schema: public; Owner: -
255 CREATE TABLE changesets (
257 user_id bigint NOT NULL,
258 created_at timestamp without time zone NOT NULL,
263 closed_at timestamp without time zone NOT NULL,
264 num_changes integer DEFAULT 0 NOT NULL
269 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
272 CREATE SEQUENCE changesets_id_seq
281 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
284 ALTER SEQUENCE changesets_id_seq OWNED BY changesets.id;
288 -- Name: changesets_subscribers; Type: TABLE; Schema: public; Owner: -
291 CREATE TABLE changesets_subscribers (
292 subscriber_id bigint NOT NULL,
293 changeset_id bigint NOT NULL
298 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -
301 CREATE TABLE client_applications (
303 name character varying(255),
304 url character varying(255),
305 support_url character varying(255),
306 callback_url character varying(255),
307 key character varying(50),
308 secret character varying(50),
310 created_at timestamp without time zone,
311 updated_at timestamp without time zone,
312 allow_read_prefs boolean DEFAULT false NOT NULL,
313 allow_write_prefs boolean DEFAULT false NOT NULL,
314 allow_write_diary boolean DEFAULT false NOT NULL,
315 allow_write_api boolean DEFAULT false NOT NULL,
316 allow_read_gpx boolean DEFAULT false NOT NULL,
317 allow_write_gpx boolean DEFAULT false NOT NULL,
318 allow_write_notes boolean DEFAULT false NOT NULL
323 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
326 CREATE SEQUENCE client_applications_id_seq
335 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
338 ALTER SEQUENCE client_applications_id_seq OWNED BY client_applications.id;
342 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -
345 CREATE TABLE current_node_tags (
346 node_id bigint NOT NULL,
347 k character varying(255) DEFAULT ''::character varying NOT NULL,
348 v character varying(255) DEFAULT ''::character varying NOT NULL
353 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -
356 CREATE TABLE current_nodes (
358 latitude integer NOT NULL,
359 longitude integer NOT NULL,
360 changeset_id bigint NOT NULL,
361 visible boolean NOT NULL,
362 "timestamp" timestamp without time zone NOT NULL,
363 tile bigint NOT NULL,
364 version bigint NOT NULL
369 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
372 CREATE SEQUENCE current_nodes_id_seq
381 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
384 ALTER SEQUENCE current_nodes_id_seq OWNED BY current_nodes.id;
388 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -
391 CREATE TABLE current_relation_members (
392 relation_id bigint NOT NULL,
393 member_type nwr_enum NOT NULL,
394 member_id bigint NOT NULL,
395 member_role character varying(255) NOT NULL,
396 sequence_id integer DEFAULT 0 NOT NULL
401 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -
404 CREATE TABLE current_relation_tags (
405 relation_id bigint NOT NULL,
406 k character varying(255) DEFAULT ''::character varying NOT NULL,
407 v character varying(255) DEFAULT ''::character varying NOT NULL
412 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -
415 CREATE TABLE current_relations (
417 changeset_id bigint NOT NULL,
418 "timestamp" timestamp without time zone NOT NULL,
419 visible boolean NOT NULL,
420 version bigint NOT NULL
425 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
428 CREATE SEQUENCE current_relations_id_seq
437 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
440 ALTER SEQUENCE current_relations_id_seq OWNED BY current_relations.id;
444 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -
447 CREATE TABLE current_way_nodes (
448 way_id bigint NOT NULL,
449 node_id bigint NOT NULL,
450 sequence_id bigint NOT NULL
455 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -
458 CREATE TABLE current_way_tags (
459 way_id bigint NOT NULL,
460 k character varying(255) DEFAULT ''::character varying NOT NULL,
461 v character varying(255) DEFAULT ''::character varying NOT NULL
466 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -
469 CREATE TABLE current_ways (
471 changeset_id bigint NOT NULL,
472 "timestamp" timestamp without time zone NOT NULL,
473 visible boolean NOT NULL,
474 version bigint NOT NULL
479 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
482 CREATE SEQUENCE current_ways_id_seq
491 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
494 ALTER SEQUENCE current_ways_id_seq OWNED BY current_ways.id;
498 -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: -
501 CREATE TABLE delayed_jobs (
503 priority integer DEFAULT 0 NOT NULL,
504 attempts integer DEFAULT 0 NOT NULL,
505 handler text NOT NULL,
507 run_at timestamp without time zone,
508 locked_at timestamp without time zone,
509 failed_at timestamp without time zone,
510 locked_by character varying,
511 queue character varying,
512 created_at timestamp without time zone,
513 updated_at timestamp without time zone
518 -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
521 CREATE SEQUENCE delayed_jobs_id_seq
530 -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
533 ALTER SEQUENCE delayed_jobs_id_seq OWNED BY delayed_jobs.id;
537 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -
540 CREATE TABLE diary_comments (
542 diary_entry_id bigint NOT NULL,
543 user_id bigint NOT NULL,
545 created_at timestamp without time zone NOT NULL,
546 updated_at timestamp without time zone NOT NULL,
547 visible boolean DEFAULT true NOT NULL,
548 body_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
553 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
556 CREATE SEQUENCE diary_comments_id_seq
565 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
568 ALTER SEQUENCE diary_comments_id_seq OWNED BY diary_comments.id;
572 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
575 CREATE TABLE diary_entries (
577 user_id bigint NOT NULL,
578 title character varying(255) NOT NULL,
580 created_at timestamp without time zone NOT NULL,
581 updated_at timestamp without time zone NOT NULL,
582 latitude double precision,
583 longitude double precision,
584 language_code character varying(255) DEFAULT 'en'::character varying NOT NULL,
585 visible boolean DEFAULT true NOT NULL,
586 body_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
591 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
594 CREATE SEQUENCE diary_entries_id_seq
603 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
606 ALTER SEQUENCE diary_entries_id_seq OWNED BY diary_entries.id;
610 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
613 CREATE TABLE diary_entry_subscriptions (
614 user_id bigint NOT NULL,
615 diary_entry_id bigint NOT NULL
620 -- Name: friends; Type: TABLE; Schema: public; Owner: -
623 CREATE TABLE friends (
625 user_id bigint NOT NULL,
626 friend_user_id bigint NOT NULL
631 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
634 CREATE SEQUENCE friends_id_seq
643 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
646 ALTER SEQUENCE friends_id_seq OWNED BY friends.id;
650 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
653 CREATE TABLE gps_points (
654 altitude double precision,
655 trackid integer NOT NULL,
656 latitude integer NOT NULL,
657 longitude integer NOT NULL,
658 gpx_id bigint NOT NULL,
659 "timestamp" timestamp without time zone,
665 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
668 CREATE TABLE gpx_file_tags (
669 gpx_id bigint DEFAULT 0 NOT NULL,
670 tag character varying(255) NOT NULL,
676 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
679 CREATE SEQUENCE gpx_file_tags_id_seq
688 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
691 ALTER SEQUENCE gpx_file_tags_id_seq OWNED BY gpx_file_tags.id;
695 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
698 CREATE TABLE gpx_files (
700 user_id bigint NOT NULL,
701 visible boolean DEFAULT true NOT NULL,
702 name character varying(255) DEFAULT ''::character varying NOT NULL,
704 latitude double precision,
705 longitude double precision,
706 "timestamp" timestamp without time zone NOT NULL,
707 description character varying(255) DEFAULT ''::character varying NOT NULL,
708 inserted boolean NOT NULL,
709 visibility gpx_visibility_enum DEFAULT 'public'::gpx_visibility_enum NOT NULL
714 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
717 CREATE SEQUENCE gpx_files_id_seq
726 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
729 ALTER SEQUENCE gpx_files_id_seq OWNED BY gpx_files.id;
733 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
736 CREATE TABLE issue_comments (
738 issue_id integer NOT NULL,
739 user_id integer NOT NULL,
741 created_at timestamp without time zone NOT NULL,
742 updated_at timestamp without time zone NOT NULL
747 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
750 CREATE SEQUENCE issue_comments_id_seq
759 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
762 ALTER SEQUENCE issue_comments_id_seq OWNED BY issue_comments.id;
766 -- Name: issues; Type: TABLE; Schema: public; Owner: -
769 CREATE TABLE issues (
771 reportable_type character varying NOT NULL,
772 reportable_id integer NOT NULL,
773 reported_user_id integer,
774 status issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
775 assigned_role user_role_enum NOT NULL,
776 resolved_at timestamp without time zone,
779 reports_count integer DEFAULT 0,
780 created_at timestamp without time zone NOT NULL,
781 updated_at timestamp without time zone NOT NULL
786 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
789 CREATE SEQUENCE issues_id_seq
798 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
801 ALTER SEQUENCE issues_id_seq OWNED BY issues.id;
805 -- Name: languages; Type: TABLE; Schema: public; Owner: -
808 CREATE TABLE languages (
809 code character varying(255) NOT NULL,
810 english_name character varying(255) NOT NULL,
811 native_name character varying(255)
816 -- Name: messages; Type: TABLE; Schema: public; Owner: -
819 CREATE TABLE messages (
821 from_user_id bigint NOT NULL,
822 title character varying(255) NOT NULL,
824 sent_on timestamp without time zone NOT NULL,
825 message_read boolean DEFAULT false NOT NULL,
826 to_user_id bigint NOT NULL,
827 to_user_visible boolean DEFAULT true NOT NULL,
828 from_user_visible boolean DEFAULT true NOT NULL,
829 body_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
834 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
837 CREATE SEQUENCE messages_id_seq
846 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
849 ALTER SEQUENCE messages_id_seq OWNED BY messages.id;
853 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
856 CREATE TABLE node_tags (
857 node_id bigint NOT NULL,
858 version bigint NOT NULL,
859 k character varying(255) DEFAULT ''::character varying NOT NULL,
860 v character varying(255) DEFAULT ''::character varying NOT NULL
865 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
869 node_id bigint NOT NULL,
870 latitude integer NOT NULL,
871 longitude integer NOT NULL,
872 changeset_id bigint NOT NULL,
873 visible boolean NOT NULL,
874 "timestamp" timestamp without time zone NOT NULL,
875 tile bigint NOT NULL,
876 version bigint NOT NULL,
882 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
885 CREATE TABLE note_comments (
887 note_id bigint NOT NULL,
888 visible boolean NOT NULL,
889 created_at timestamp without time zone NOT NULL,
893 event note_event_enum
898 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
901 CREATE SEQUENCE note_comments_id_seq
910 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
913 ALTER SEQUENCE note_comments_id_seq OWNED BY note_comments.id;
917 -- Name: notes; Type: TABLE; Schema: public; Owner: -
922 latitude integer NOT NULL,
923 longitude integer NOT NULL,
924 tile bigint NOT NULL,
925 updated_at timestamp without time zone NOT NULL,
926 created_at timestamp without time zone NOT NULL,
927 status note_status_enum NOT NULL,
928 closed_at timestamp without time zone
933 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
936 CREATE SEQUENCE notes_id_seq
945 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
948 ALTER SEQUENCE notes_id_seq OWNED BY notes.id;
952 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
955 CREATE TABLE oauth_nonces (
957 nonce character varying(255),
959 created_at timestamp without time zone,
960 updated_at timestamp without time zone
965 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
968 CREATE SEQUENCE oauth_nonces_id_seq
977 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
980 ALTER SEQUENCE oauth_nonces_id_seq OWNED BY oauth_nonces.id;
984 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
987 CREATE TABLE oauth_tokens (
990 type character varying(20),
991 client_application_id integer,
992 token character varying(50),
993 secret character varying(50),
994 authorized_at timestamp without time zone,
995 invalidated_at timestamp without time zone,
996 created_at timestamp without time zone,
997 updated_at timestamp without time zone,
998 allow_read_prefs boolean DEFAULT false NOT NULL,
999 allow_write_prefs boolean DEFAULT false NOT NULL,
1000 allow_write_diary boolean DEFAULT false NOT NULL,
1001 allow_write_api boolean DEFAULT false NOT NULL,
1002 allow_read_gpx boolean DEFAULT false NOT NULL,
1003 allow_write_gpx boolean DEFAULT false NOT NULL,
1004 callback_url character varying(255),
1005 verifier character varying(20),
1006 scope character varying(255),
1007 valid_to timestamp without time zone,
1008 allow_write_notes boolean DEFAULT false NOT NULL
1013 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1016 CREATE SEQUENCE oauth_tokens_id_seq
1025 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1028 ALTER SEQUENCE oauth_tokens_id_seq OWNED BY oauth_tokens.id;
1032 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
1035 CREATE TABLE redactions (
1036 id integer NOT NULL,
1037 title character varying(255),
1039 created_at timestamp without time zone NOT NULL,
1040 updated_at timestamp without time zone NOT NULL,
1041 user_id bigint NOT NULL,
1042 description_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
1047 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1050 CREATE SEQUENCE redactions_id_seq
1059 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1062 ALTER SEQUENCE redactions_id_seq OWNED BY redactions.id;
1066 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1069 CREATE TABLE relation_members (
1070 relation_id bigint DEFAULT 0 NOT NULL,
1071 member_type nwr_enum NOT NULL,
1072 member_id bigint NOT NULL,
1073 member_role character varying(255) NOT NULL,
1074 version bigint DEFAULT 0 NOT NULL,
1075 sequence_id integer DEFAULT 0 NOT NULL
1080 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1083 CREATE TABLE relation_tags (
1084 relation_id bigint DEFAULT 0 NOT NULL,
1085 k character varying(255) DEFAULT ''::character varying NOT NULL,
1086 v character varying(255) DEFAULT ''::character varying NOT NULL,
1087 version bigint NOT NULL
1092 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1095 CREATE TABLE relations (
1096 relation_id bigint DEFAULT 0 NOT NULL,
1097 changeset_id bigint NOT NULL,
1098 "timestamp" timestamp without time zone NOT NULL,
1099 version bigint NOT NULL,
1100 visible boolean DEFAULT true NOT NULL,
1101 redaction_id integer
1106 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1109 CREATE TABLE reports (
1110 id integer NOT NULL,
1111 issue_id integer NOT NULL,
1112 user_id integer NOT NULL,
1113 details text NOT NULL,
1114 category character varying NOT NULL,
1115 created_at timestamp without time zone NOT NULL,
1116 updated_at timestamp without time zone NOT NULL
1121 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1124 CREATE SEQUENCE reports_id_seq
1133 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1136 ALTER SEQUENCE reports_id_seq OWNED BY reports.id;
1140 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1143 CREATE TABLE schema_migrations (
1144 version character varying(255) NOT NULL
1149 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1152 CREATE TABLE user_blocks (
1153 id integer NOT NULL,
1154 user_id bigint NOT NULL,
1155 creator_id bigint NOT NULL,
1156 reason text NOT NULL,
1157 ends_at timestamp without time zone NOT NULL,
1158 needs_view boolean DEFAULT false NOT NULL,
1160 created_at timestamp without time zone,
1161 updated_at timestamp without time zone,
1162 reason_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
1167 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1170 CREATE SEQUENCE user_blocks_id_seq
1179 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1182 ALTER SEQUENCE user_blocks_id_seq OWNED BY user_blocks.id;
1186 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1189 CREATE TABLE user_preferences (
1190 user_id bigint NOT NULL,
1191 k character varying(255) NOT NULL,
1192 v character varying(255) NOT NULL
1197 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1200 CREATE TABLE user_roles (
1201 id integer NOT NULL,
1202 user_id bigint NOT NULL,
1203 created_at timestamp without time zone,
1204 updated_at timestamp without time zone,
1205 role user_role_enum NOT NULL,
1206 granter_id bigint NOT NULL
1211 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1214 CREATE SEQUENCE user_roles_id_seq
1223 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1226 ALTER SEQUENCE user_roles_id_seq OWNED BY user_roles.id;
1230 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1233 CREATE TABLE user_tokens (
1235 user_id bigint NOT NULL,
1236 token character varying(255) NOT NULL,
1237 expiry timestamp without time zone NOT NULL,
1243 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1246 CREATE SEQUENCE user_tokens_id_seq
1255 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1258 ALTER SEQUENCE user_tokens_id_seq OWNED BY user_tokens.id;
1262 -- Name: users; Type: TABLE; Schema: public; Owner: -
1265 CREATE TABLE users (
1266 email character varying(255) NOT NULL,
1268 pass_crypt character varying(255) NOT NULL,
1269 creation_time timestamp without time zone NOT NULL,
1270 display_name character varying(255) DEFAULT ''::character varying NOT NULL,
1271 data_public boolean DEFAULT false NOT NULL,
1272 description text DEFAULT ''::text NOT NULL,
1273 home_lat double precision,
1274 home_lon double precision,
1275 home_zoom smallint DEFAULT 3,
1276 nearby integer DEFAULT 50,
1277 pass_salt character varying(255),
1278 image_file_name text,
1279 email_valid boolean DEFAULT false NOT NULL,
1280 new_email character varying(255),
1281 creation_ip character varying(255),
1282 languages character varying(255),
1283 status user_status_enum DEFAULT 'pending'::user_status_enum NOT NULL,
1284 terms_agreed timestamp without time zone,
1285 consider_pd boolean DEFAULT false NOT NULL,
1286 preferred_editor character varying(255),
1287 terms_seen boolean DEFAULT false NOT NULL,
1288 auth_uid character varying(255),
1289 description_format format_enum DEFAULT 'markdown'::format_enum NOT NULL,
1290 image_fingerprint character varying(255),
1291 changesets_count integer DEFAULT 0 NOT NULL,
1292 traces_count integer DEFAULT 0 NOT NULL,
1293 diary_entries_count integer DEFAULT 0 NOT NULL,
1294 image_use_gravatar boolean DEFAULT false NOT NULL,
1295 image_content_type character varying(255),
1296 auth_provider character varying(255),
1302 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1305 CREATE SEQUENCE users_id_seq
1314 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1317 ALTER SEQUENCE users_id_seq OWNED BY users.id;
1321 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1324 CREATE TABLE way_nodes (
1325 way_id bigint NOT NULL,
1326 node_id bigint NOT NULL,
1327 version bigint NOT NULL,
1328 sequence_id bigint NOT NULL
1333 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1336 CREATE TABLE way_tags (
1337 way_id bigint DEFAULT 0 NOT NULL,
1338 k character varying(255) NOT NULL,
1339 v character varying(255) NOT NULL,
1340 version bigint NOT NULL
1345 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1349 way_id bigint DEFAULT 0 NOT NULL,
1350 changeset_id bigint NOT NULL,
1351 "timestamp" timestamp without time zone NOT NULL,
1352 version bigint NOT NULL,
1353 visible boolean DEFAULT true NOT NULL,
1354 redaction_id integer
1359 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1362 ALTER TABLE ONLY acls ALTER COLUMN id SET DEFAULT nextval('acls_id_seq'::regclass);
1366 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1369 ALTER TABLE ONLY changeset_comments ALTER COLUMN id SET DEFAULT nextval('changeset_comments_id_seq'::regclass);
1373 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1376 ALTER TABLE ONLY changesets ALTER COLUMN id SET DEFAULT nextval('changesets_id_seq'::regclass);
1380 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1383 ALTER TABLE ONLY client_applications ALTER COLUMN id SET DEFAULT nextval('client_applications_id_seq'::regclass);
1387 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1390 ALTER TABLE ONLY current_nodes ALTER COLUMN id SET DEFAULT nextval('current_nodes_id_seq'::regclass);
1394 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1397 ALTER TABLE ONLY current_relations ALTER COLUMN id SET DEFAULT nextval('current_relations_id_seq'::regclass);
1401 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1404 ALTER TABLE ONLY current_ways ALTER COLUMN id SET DEFAULT nextval('current_ways_id_seq'::regclass);
1408 -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
1411 ALTER TABLE ONLY delayed_jobs ALTER COLUMN id SET DEFAULT nextval('delayed_jobs_id_seq'::regclass);
1415 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1418 ALTER TABLE ONLY diary_comments ALTER COLUMN id SET DEFAULT nextval('diary_comments_id_seq'::regclass);
1422 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1425 ALTER TABLE ONLY diary_entries ALTER COLUMN id SET DEFAULT nextval('diary_entries_id_seq'::regclass);
1429 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1432 ALTER TABLE ONLY friends ALTER COLUMN id SET DEFAULT nextval('friends_id_seq'::regclass);
1436 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1439 ALTER TABLE ONLY gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('gpx_file_tags_id_seq'::regclass);
1443 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1446 ALTER TABLE ONLY gpx_files ALTER COLUMN id SET DEFAULT nextval('gpx_files_id_seq'::regclass);
1450 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1453 ALTER TABLE ONLY issue_comments ALTER COLUMN id SET DEFAULT nextval('issue_comments_id_seq'::regclass);
1457 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1460 ALTER TABLE ONLY issues ALTER COLUMN id SET DEFAULT nextval('issues_id_seq'::regclass);
1464 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1467 ALTER TABLE ONLY messages ALTER COLUMN id SET DEFAULT nextval('messages_id_seq'::regclass);
1471 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1474 ALTER TABLE ONLY note_comments ALTER COLUMN id SET DEFAULT nextval('note_comments_id_seq'::regclass);
1478 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1481 ALTER TABLE ONLY notes ALTER COLUMN id SET DEFAULT nextval('notes_id_seq'::regclass);
1485 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1488 ALTER TABLE ONLY oauth_nonces ALTER COLUMN id SET DEFAULT nextval('oauth_nonces_id_seq'::regclass);
1492 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1495 ALTER TABLE ONLY oauth_tokens ALTER COLUMN id SET DEFAULT nextval('oauth_tokens_id_seq'::regclass);
1499 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1502 ALTER TABLE ONLY redactions ALTER COLUMN id SET DEFAULT nextval('redactions_id_seq'::regclass);
1506 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1509 ALTER TABLE ONLY reports ALTER COLUMN id SET DEFAULT nextval('reports_id_seq'::regclass);
1513 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1516 ALTER TABLE ONLY user_blocks ALTER COLUMN id SET DEFAULT nextval('user_blocks_id_seq'::regclass);
1520 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1523 ALTER TABLE ONLY user_roles ALTER COLUMN id SET DEFAULT nextval('user_roles_id_seq'::regclass);
1527 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1530 ALTER TABLE ONLY user_tokens ALTER COLUMN id SET DEFAULT nextval('user_tokens_id_seq'::regclass);
1534 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1537 ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
1541 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1544 ALTER TABLE ONLY acls
1545 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1549 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1552 ALTER TABLE ONLY ar_internal_metadata
1553 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1557 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1560 ALTER TABLE ONLY changeset_comments
1561 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1565 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1568 ALTER TABLE ONLY changesets
1569 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1573 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1576 ALTER TABLE ONLY client_applications
1577 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1581 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1584 ALTER TABLE ONLY current_node_tags
1585 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1589 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1592 ALTER TABLE ONLY current_nodes
1593 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1597 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1600 ALTER TABLE ONLY current_relation_members
1601 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1605 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1608 ALTER TABLE ONLY current_relation_tags
1609 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1613 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1616 ALTER TABLE ONLY current_relations
1617 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1621 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1624 ALTER TABLE ONLY current_way_nodes
1625 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1629 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1632 ALTER TABLE ONLY current_way_tags
1633 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1637 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1640 ALTER TABLE ONLY current_ways
1641 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1645 -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1648 ALTER TABLE ONLY delayed_jobs
1649 ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id);
1653 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1656 ALTER TABLE ONLY diary_comments
1657 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1661 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1664 ALTER TABLE ONLY diary_entries
1665 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1669 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1672 ALTER TABLE ONLY diary_entry_subscriptions
1673 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1677 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1680 ALTER TABLE ONLY friends
1681 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1685 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1688 ALTER TABLE ONLY gpx_file_tags
1689 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1693 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1696 ALTER TABLE ONLY gpx_files
1697 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1701 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1704 ALTER TABLE ONLY issue_comments
1705 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1709 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1712 ALTER TABLE ONLY issues
1713 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
1717 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1720 ALTER TABLE ONLY languages
1721 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1725 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1728 ALTER TABLE ONLY messages
1729 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1733 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1736 ALTER TABLE ONLY node_tags
1737 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1741 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1744 ALTER TABLE ONLY nodes
1745 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1749 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1752 ALTER TABLE ONLY note_comments
1753 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1757 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1760 ALTER TABLE ONLY notes
1761 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1765 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1768 ALTER TABLE ONLY oauth_nonces
1769 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1773 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1776 ALTER TABLE ONLY oauth_tokens
1777 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1781 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1784 ALTER TABLE ONLY redactions
1785 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1789 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1792 ALTER TABLE ONLY relation_members
1793 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1797 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1800 ALTER TABLE ONLY relation_tags
1801 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1805 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1808 ALTER TABLE ONLY relations
1809 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1813 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1816 ALTER TABLE ONLY reports
1817 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
1821 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1824 ALTER TABLE ONLY user_blocks
1825 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1829 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1832 ALTER TABLE ONLY user_preferences
1833 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1837 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1840 ALTER TABLE ONLY user_roles
1841 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1845 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1848 ALTER TABLE ONLY user_tokens
1849 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
1853 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1856 ALTER TABLE ONLY users
1857 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
1861 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1864 ALTER TABLE ONLY way_nodes
1865 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
1869 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1872 ALTER TABLE ONLY way_tags
1873 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
1877 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1880 ALTER TABLE ONLY ways
1881 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
1885 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
1888 CREATE INDEX acls_k_idx ON acls USING btree (k);
1892 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
1895 CREATE INDEX changeset_tags_id_idx ON changeset_tags USING btree (changeset_id);
1899 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
1902 CREATE INDEX changesets_bbox_idx ON changesets USING gist (min_lat, max_lat, min_lon, max_lon);
1906 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
1909 CREATE INDEX changesets_closed_at_idx ON changesets USING btree (closed_at);
1913 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
1916 CREATE INDEX changesets_created_at_idx ON changesets USING btree (created_at);
1920 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
1923 CREATE INDEX changesets_user_id_created_at_idx ON changesets USING btree (user_id, created_at);
1927 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
1930 CREATE INDEX changesets_user_id_id_idx ON changesets USING btree (user_id, id);
1934 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
1937 CREATE INDEX current_nodes_tile_idx ON current_nodes USING btree (tile);
1941 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1944 CREATE INDEX current_nodes_timestamp_idx ON current_nodes USING btree ("timestamp");
1948 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
1951 CREATE INDEX current_relation_members_member_idx ON current_relation_members USING btree (member_type, member_id);
1955 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1958 CREATE INDEX current_relations_timestamp_idx ON current_relations USING btree ("timestamp");
1962 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
1965 CREATE INDEX current_way_nodes_node_idx ON current_way_nodes USING btree (node_id);
1969 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1972 CREATE INDEX current_ways_timestamp_idx ON current_ways USING btree ("timestamp");
1976 -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: -
1979 CREATE INDEX delayed_jobs_priority ON delayed_jobs USING btree (priority, run_at);
1983 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
1986 CREATE INDEX diary_comment_user_id_created_at_index ON diary_comments USING btree (user_id, created_at);
1990 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
1993 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON diary_comments USING btree (diary_entry_id, id);
1997 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
2000 CREATE INDEX diary_entry_created_at_index ON diary_entries USING btree (created_at);
2004 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
2007 CREATE INDEX diary_entry_language_code_created_at_index ON diary_entries USING btree (language_code, created_at);
2011 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
2014 CREATE INDEX diary_entry_user_id_created_at_index ON diary_entries USING btree (user_id, created_at);
2018 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -
2021 CREATE INDEX friends_user_id_idx ON friends USING btree (user_id);
2025 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2028 CREATE INDEX gpx_file_tags_gpxid_idx ON gpx_file_tags USING btree (gpx_id);
2032 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
2035 CREATE INDEX gpx_file_tags_tag_idx ON gpx_file_tags USING btree (tag);
2039 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2042 CREATE INDEX gpx_files_timestamp_idx ON gpx_files USING btree ("timestamp");
2046 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
2049 CREATE INDEX gpx_files_user_id_idx ON gpx_files USING btree (user_id);
2053 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
2056 CREATE INDEX gpx_files_visible_visibility_idx ON gpx_files USING btree (visible, visibility);
2060 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2063 CREATE INDEX index_changeset_comments_on_created_at ON changeset_comments USING btree (created_at);
2067 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2070 CREATE INDEX index_changesets_subscribers_on_changeset_id ON changesets_subscribers USING btree (changeset_id);
2074 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2077 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON changesets_subscribers USING btree (subscriber_id, changeset_id);
2081 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2084 CREATE UNIQUE INDEX index_client_applications_on_key ON client_applications USING btree (key);
2088 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2091 CREATE INDEX index_client_applications_on_user_id ON client_applications USING btree (user_id);
2095 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2098 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON diary_entry_subscriptions USING btree (diary_entry_id);
2102 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2105 CREATE INDEX index_issue_comments_on_issue_id ON issue_comments USING btree (issue_id);
2109 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2112 CREATE INDEX index_issue_comments_on_user_id ON issue_comments USING btree (user_id);
2116 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2119 CREATE INDEX index_issues_on_assigned_role ON issues USING btree (assigned_role);
2123 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2126 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON issues USING btree (reportable_type, reportable_id);
2130 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2133 CREATE INDEX index_issues_on_reported_user_id ON issues USING btree (reported_user_id);
2137 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2140 CREATE INDEX index_issues_on_status ON issues USING btree (status);
2144 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2147 CREATE INDEX index_issues_on_updated_by ON issues USING btree (updated_by);
2151 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2154 CREATE INDEX index_note_comments_on_body ON note_comments USING gin (to_tsvector('english'::regconfig, body));
2158 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2161 CREATE INDEX index_note_comments_on_created_at ON note_comments USING btree (created_at);
2165 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2168 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON oauth_nonces USING btree (nonce, "timestamp");
2172 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2175 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON oauth_tokens USING btree (token);
2179 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2182 CREATE INDEX index_oauth_tokens_on_user_id ON oauth_tokens USING btree (user_id);
2186 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2189 CREATE INDEX index_reports_on_issue_id ON reports USING btree (issue_id);
2193 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2196 CREATE INDEX index_reports_on_user_id ON reports USING btree (user_id);
2200 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2203 CREATE INDEX index_user_blocks_on_user_id ON user_blocks USING btree (user_id);
2207 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2210 CREATE INDEX messages_from_user_id_idx ON messages USING btree (from_user_id);
2214 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2217 CREATE INDEX messages_to_user_id_idx ON messages USING btree (to_user_id);
2221 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2224 CREATE INDEX nodes_changeset_id_idx ON nodes USING btree (changeset_id);
2228 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2231 CREATE INDEX nodes_tile_idx ON nodes USING btree (tile);
2235 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2238 CREATE INDEX nodes_timestamp_idx ON nodes USING btree ("timestamp");
2242 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2245 CREATE INDEX note_comments_note_id_idx ON note_comments USING btree (note_id);
2249 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2252 CREATE INDEX notes_created_at_idx ON notes USING btree (created_at);
2256 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2259 CREATE INDEX notes_tile_status_idx ON notes USING btree (tile, status);
2263 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2266 CREATE INDEX notes_updated_at_idx ON notes USING btree (updated_at);
2270 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2273 CREATE INDEX points_gpxid_idx ON gps_points USING btree (gpx_id);
2277 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2280 CREATE INDEX points_tile_idx ON gps_points USING btree (tile);
2284 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2287 CREATE INDEX relation_members_member_idx ON relation_members USING btree (member_type, member_id);
2291 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2294 CREATE INDEX relations_changeset_id_idx ON relations USING btree (changeset_id);
2298 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2301 CREATE INDEX relations_timestamp_idx ON relations USING btree ("timestamp");
2305 -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -
2308 CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
2312 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2315 CREATE INDEX user_id_idx ON friends USING btree (friend_user_id);
2319 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2322 CREATE UNIQUE INDEX user_roles_id_role_unique ON user_roles USING btree (user_id, role);
2326 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2329 CREATE UNIQUE INDEX user_tokens_token_idx ON user_tokens USING btree (token);
2333 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2336 CREATE INDEX user_tokens_user_id_idx ON user_tokens USING btree (user_id);
2340 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2343 CREATE UNIQUE INDEX users_auth_idx ON users USING btree (auth_provider, auth_uid);
2347 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2350 CREATE UNIQUE INDEX users_display_name_idx ON users USING btree (display_name);
2354 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2357 CREATE INDEX users_display_name_lower_idx ON users USING btree (lower((display_name)::text));
2361 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2364 CREATE UNIQUE INDEX users_email_idx ON users USING btree (email);
2368 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2371 CREATE INDEX users_email_lower_idx ON users USING btree (lower((email)::text));
2375 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2378 CREATE INDEX users_home_idx ON users USING btree (home_tile);
2382 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2385 CREATE INDEX way_nodes_node_idx ON way_nodes USING btree (node_id);
2389 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2392 CREATE INDEX ways_changeset_id_idx ON ways USING btree (changeset_id);
2396 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2399 CREATE INDEX ways_timestamp_idx ON ways USING btree ("timestamp");
2403 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2406 ALTER TABLE ONLY changeset_comments
2407 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES users(id);
2411 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2414 ALTER TABLE ONLY changeset_comments
2415 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2419 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2422 ALTER TABLE ONLY changeset_tags
2423 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2427 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2430 ALTER TABLE ONLY changesets_subscribers
2431 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2435 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2438 ALTER TABLE ONLY changesets_subscribers
2439 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES users(id);
2443 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2446 ALTER TABLE ONLY changesets
2447 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2451 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2454 ALTER TABLE ONLY client_applications
2455 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2459 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2462 ALTER TABLE ONLY current_node_tags
2463 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
2467 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2470 ALTER TABLE ONLY current_nodes
2471 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2475 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2478 ALTER TABLE ONLY current_relation_members
2479 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
2483 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2486 ALTER TABLE ONLY current_relation_tags
2487 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
2491 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2494 ALTER TABLE ONLY current_relations
2495 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2499 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2502 ALTER TABLE ONLY current_way_nodes
2503 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
2507 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2510 ALTER TABLE ONLY current_way_nodes
2511 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
2515 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2518 ALTER TABLE ONLY current_way_tags
2519 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
2523 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2526 ALTER TABLE ONLY current_ways
2527 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2531 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2534 ALTER TABLE ONLY diary_comments
2535 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES diary_entries(id);
2539 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2542 ALTER TABLE ONLY diary_comments
2543 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2547 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2550 ALTER TABLE ONLY diary_entries
2551 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES languages(code);
2555 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2558 ALTER TABLE ONLY diary_entries
2559 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2563 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2566 ALTER TABLE ONLY diary_entry_subscriptions
2567 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES diary_entries(id);
2571 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2574 ALTER TABLE ONLY diary_entry_subscriptions
2575 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2579 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2582 ALTER TABLE ONLY friends
2583 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES users(id);
2587 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2590 ALTER TABLE ONLY friends
2591 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2595 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2598 ALTER TABLE ONLY gps_points
2599 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
2603 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2606 ALTER TABLE ONLY gpx_file_tags
2607 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
2611 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2614 ALTER TABLE ONLY gpx_files
2615 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2619 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2622 ALTER TABLE ONLY issue_comments
2623 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES issues(id);
2627 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2630 ALTER TABLE ONLY issue_comments
2631 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2635 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2638 ALTER TABLE ONLY issues
2639 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES users(id);
2643 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2646 ALTER TABLE ONLY issues
2647 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES users(id);
2651 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2654 ALTER TABLE ONLY issues
2655 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES users(id);
2659 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2662 ALTER TABLE ONLY messages
2663 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES users(id);
2667 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2670 ALTER TABLE ONLY messages
2671 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES users(id);
2675 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2678 ALTER TABLE ONLY node_tags
2679 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES nodes(node_id, version);
2683 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2686 ALTER TABLE ONLY nodes
2687 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2691 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2694 ALTER TABLE ONLY nodes
2695 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2699 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2702 ALTER TABLE ONLY note_comments
2703 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES users(id);
2707 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2710 ALTER TABLE ONLY note_comments
2711 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES notes(id);
2715 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2718 ALTER TABLE ONLY oauth_tokens
2719 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES client_applications(id);
2723 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2726 ALTER TABLE ONLY oauth_tokens
2727 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2731 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2734 ALTER TABLE ONLY redactions
2735 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2739 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2742 ALTER TABLE ONLY relation_members
2743 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2747 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2750 ALTER TABLE ONLY relation_tags
2751 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2755 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2758 ALTER TABLE ONLY relations
2759 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2763 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2766 ALTER TABLE ONLY relations
2767 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2771 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2774 ALTER TABLE ONLY reports
2775 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES issues(id);
2779 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2782 ALTER TABLE ONLY reports
2783 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2787 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2790 ALTER TABLE ONLY user_blocks
2791 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES users(id);
2795 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2798 ALTER TABLE ONLY user_blocks
2799 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES users(id);
2803 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2806 ALTER TABLE ONLY user_blocks
2807 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2811 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2814 ALTER TABLE ONLY user_preferences
2815 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2819 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2822 ALTER TABLE ONLY user_roles
2823 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES users(id);
2827 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2830 ALTER TABLE ONLY user_roles
2831 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2835 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2838 ALTER TABLE ONLY user_tokens
2839 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2843 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2846 ALTER TABLE ONLY way_nodes
2847 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2851 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2854 ALTER TABLE ONLY way_tags
2855 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2859 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2862 ALTER TABLE ONLY ways
2863 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2867 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2870 ALTER TABLE ONLY ways
2871 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2875 -- PostgreSQL database dump complete
2878 SET search_path TO "$user", public;
2880 INSERT INTO "schema_migrations" (version) VALUES