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: diary_comments; Type: TABLE; Schema: public; Owner: -
501 CREATE TABLE diary_comments (
503 diary_entry_id bigint NOT NULL,
504 user_id bigint NOT NULL,
506 created_at timestamp without time zone NOT NULL,
507 updated_at timestamp without time zone NOT NULL,
508 visible boolean DEFAULT true NOT NULL,
509 body_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
514 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
517 CREATE SEQUENCE diary_comments_id_seq
526 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
529 ALTER SEQUENCE diary_comments_id_seq OWNED BY diary_comments.id;
533 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -
536 CREATE TABLE diary_entries (
538 user_id bigint NOT NULL,
539 title character varying(255) NOT NULL,
541 created_at timestamp without time zone NOT NULL,
542 updated_at timestamp without time zone NOT NULL,
543 latitude double precision,
544 longitude double precision,
545 language_code character varying(255) DEFAULT 'en'::character varying NOT NULL,
546 visible boolean DEFAULT true NOT NULL,
547 body_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
552 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
555 CREATE SEQUENCE diary_entries_id_seq
564 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
567 ALTER SEQUENCE diary_entries_id_seq OWNED BY diary_entries.id;
571 -- Name: diary_entry_subscriptions; Type: TABLE; Schema: public; Owner: -
574 CREATE TABLE diary_entry_subscriptions (
575 user_id bigint NOT NULL,
576 diary_entry_id bigint NOT NULL
581 -- Name: friends; Type: TABLE; Schema: public; Owner: -
584 CREATE TABLE friends (
586 user_id bigint NOT NULL,
587 friend_user_id bigint NOT NULL
592 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
595 CREATE SEQUENCE friends_id_seq
604 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
607 ALTER SEQUENCE friends_id_seq OWNED BY friends.id;
611 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -
614 CREATE TABLE gps_points (
615 altitude double precision,
616 trackid integer NOT NULL,
617 latitude integer NOT NULL,
618 longitude integer NOT NULL,
619 gpx_id bigint NOT NULL,
620 "timestamp" timestamp without time zone,
626 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -
629 CREATE TABLE gpx_file_tags (
630 gpx_id bigint DEFAULT 0 NOT NULL,
631 tag character varying(255) NOT NULL,
637 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
640 CREATE SEQUENCE gpx_file_tags_id_seq
649 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
652 ALTER SEQUENCE gpx_file_tags_id_seq OWNED BY gpx_file_tags.id;
656 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -
659 CREATE TABLE gpx_files (
661 user_id bigint NOT NULL,
662 visible boolean DEFAULT true NOT NULL,
663 name character varying(255) DEFAULT ''::character varying NOT NULL,
665 latitude double precision,
666 longitude double precision,
667 "timestamp" timestamp without time zone NOT NULL,
668 description character varying(255) DEFAULT ''::character varying NOT NULL,
669 inserted boolean NOT NULL,
670 visibility gpx_visibility_enum DEFAULT 'public'::gpx_visibility_enum NOT NULL
675 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
678 CREATE SEQUENCE gpx_files_id_seq
687 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
690 ALTER SEQUENCE gpx_files_id_seq OWNED BY gpx_files.id;
694 -- Name: issue_comments; Type: TABLE; Schema: public; Owner: -
697 CREATE TABLE issue_comments (
699 issue_id integer NOT NULL,
700 user_id integer NOT NULL,
702 created_at timestamp without time zone NOT NULL,
703 updated_at timestamp without time zone NOT NULL
708 -- Name: issue_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
711 CREATE SEQUENCE issue_comments_id_seq
720 -- Name: issue_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
723 ALTER SEQUENCE issue_comments_id_seq OWNED BY issue_comments.id;
727 -- Name: issues; Type: TABLE; Schema: public; Owner: -
730 CREATE TABLE issues (
732 reportable_type character varying NOT NULL,
733 reportable_id integer NOT NULL,
734 reported_user_id integer,
735 status issue_status_enum DEFAULT 'open'::public.issue_status_enum NOT NULL,
736 assigned_role user_role_enum NOT NULL,
737 resolved_at timestamp without time zone,
740 reports_count integer DEFAULT 0,
741 created_at timestamp without time zone NOT NULL,
742 updated_at timestamp without time zone NOT NULL
747 -- Name: issues_id_seq; Type: SEQUENCE; Schema: public; Owner: -
750 CREATE SEQUENCE issues_id_seq
759 -- Name: issues_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
762 ALTER SEQUENCE issues_id_seq OWNED BY issues.id;
766 -- Name: languages; Type: TABLE; Schema: public; Owner: -
769 CREATE TABLE languages (
770 code character varying(255) NOT NULL,
771 english_name character varying(255) NOT NULL,
772 native_name character varying(255)
777 -- Name: messages; Type: TABLE; Schema: public; Owner: -
780 CREATE TABLE messages (
782 from_user_id bigint NOT NULL,
783 title character varying(255) NOT NULL,
785 sent_on timestamp without time zone NOT NULL,
786 message_read boolean DEFAULT false NOT NULL,
787 to_user_id bigint NOT NULL,
788 to_user_visible boolean DEFAULT true NOT NULL,
789 from_user_visible boolean DEFAULT true NOT NULL,
790 body_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
795 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
798 CREATE SEQUENCE messages_id_seq
807 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
810 ALTER SEQUENCE messages_id_seq OWNED BY messages.id;
814 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -
817 CREATE TABLE node_tags (
818 node_id bigint NOT NULL,
819 version bigint NOT NULL,
820 k character varying(255) DEFAULT ''::character varying NOT NULL,
821 v character varying(255) DEFAULT ''::character varying NOT NULL
826 -- Name: nodes; Type: TABLE; Schema: public; Owner: -
830 node_id bigint NOT NULL,
831 latitude integer NOT NULL,
832 longitude integer NOT NULL,
833 changeset_id bigint NOT NULL,
834 visible boolean NOT NULL,
835 "timestamp" timestamp without time zone NOT NULL,
836 tile bigint NOT NULL,
837 version bigint NOT NULL,
843 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -
846 CREATE TABLE note_comments (
848 note_id bigint NOT NULL,
849 visible boolean NOT NULL,
850 created_at timestamp without time zone NOT NULL,
854 event note_event_enum
859 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
862 CREATE SEQUENCE note_comments_id_seq
871 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
874 ALTER SEQUENCE note_comments_id_seq OWNED BY note_comments.id;
878 -- Name: notes; Type: TABLE; Schema: public; Owner: -
883 latitude integer NOT NULL,
884 longitude integer NOT NULL,
885 tile bigint NOT NULL,
886 updated_at timestamp without time zone NOT NULL,
887 created_at timestamp without time zone NOT NULL,
888 status note_status_enum NOT NULL,
889 closed_at timestamp without time zone
894 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
897 CREATE SEQUENCE notes_id_seq
906 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
909 ALTER SEQUENCE notes_id_seq OWNED BY notes.id;
913 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
916 CREATE TABLE oauth_nonces (
918 nonce character varying(255),
920 created_at timestamp without time zone,
921 updated_at timestamp without time zone
926 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
929 CREATE SEQUENCE oauth_nonces_id_seq
938 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
941 ALTER SEQUENCE oauth_nonces_id_seq OWNED BY oauth_nonces.id;
945 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
948 CREATE TABLE oauth_tokens (
951 type character varying(20),
952 client_application_id integer,
953 token character varying(50),
954 secret character varying(50),
955 authorized_at timestamp without time zone,
956 invalidated_at timestamp without time zone,
957 created_at timestamp without time zone,
958 updated_at timestamp without time zone,
959 allow_read_prefs boolean DEFAULT false NOT NULL,
960 allow_write_prefs boolean DEFAULT false NOT NULL,
961 allow_write_diary boolean DEFAULT false NOT NULL,
962 allow_write_api boolean DEFAULT false NOT NULL,
963 allow_read_gpx boolean DEFAULT false NOT NULL,
964 allow_write_gpx boolean DEFAULT false NOT NULL,
965 callback_url character varying(255),
966 verifier character varying(20),
967 scope character varying(255),
968 valid_to timestamp without time zone,
969 allow_write_notes boolean DEFAULT false NOT NULL
974 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
977 CREATE SEQUENCE oauth_tokens_id_seq
986 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
989 ALTER SEQUENCE oauth_tokens_id_seq OWNED BY oauth_tokens.id;
993 -- Name: redactions; Type: TABLE; Schema: public; Owner: -
996 CREATE TABLE redactions (
998 title character varying(255),
1000 created_at timestamp without time zone NOT NULL,
1001 updated_at timestamp without time zone NOT NULL,
1002 user_id bigint NOT NULL,
1003 description_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
1008 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1011 CREATE SEQUENCE redactions_id_seq
1020 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1023 ALTER SEQUENCE redactions_id_seq OWNED BY redactions.id;
1027 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -
1030 CREATE TABLE relation_members (
1031 relation_id bigint DEFAULT 0 NOT NULL,
1032 member_type nwr_enum NOT NULL,
1033 member_id bigint NOT NULL,
1034 member_role character varying(255) NOT NULL,
1035 version bigint DEFAULT 0 NOT NULL,
1036 sequence_id integer DEFAULT 0 NOT NULL
1041 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
1044 CREATE TABLE relation_tags (
1045 relation_id bigint DEFAULT 0 NOT NULL,
1046 k character varying(255) DEFAULT ''::character varying NOT NULL,
1047 v character varying(255) DEFAULT ''::character varying NOT NULL,
1048 version bigint NOT NULL
1053 -- Name: relations; Type: TABLE; Schema: public; Owner: -
1056 CREATE TABLE relations (
1057 relation_id bigint DEFAULT 0 NOT NULL,
1058 changeset_id bigint NOT NULL,
1059 "timestamp" timestamp without time zone NOT NULL,
1060 version bigint NOT NULL,
1061 visible boolean DEFAULT true NOT NULL,
1062 redaction_id integer
1067 -- Name: reports; Type: TABLE; Schema: public; Owner: -
1070 CREATE TABLE reports (
1071 id integer NOT NULL,
1072 issue_id integer NOT NULL,
1073 user_id integer NOT NULL,
1074 details text NOT NULL,
1075 category character varying NOT NULL,
1076 created_at timestamp without time zone NOT NULL,
1077 updated_at timestamp without time zone NOT NULL
1082 -- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1085 CREATE SEQUENCE reports_id_seq
1094 -- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1097 ALTER SEQUENCE reports_id_seq OWNED BY reports.id;
1101 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
1104 CREATE TABLE schema_migrations (
1105 version character varying(255) NOT NULL
1110 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
1113 CREATE TABLE user_blocks (
1114 id integer NOT NULL,
1115 user_id bigint NOT NULL,
1116 creator_id bigint NOT NULL,
1117 reason text NOT NULL,
1118 ends_at timestamp without time zone NOT NULL,
1119 needs_view boolean DEFAULT false NOT NULL,
1121 created_at timestamp without time zone,
1122 updated_at timestamp without time zone,
1123 reason_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
1128 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1131 CREATE SEQUENCE user_blocks_id_seq
1140 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1143 ALTER SEQUENCE user_blocks_id_seq OWNED BY user_blocks.id;
1147 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
1150 CREATE TABLE user_preferences (
1151 user_id bigint NOT NULL,
1152 k character varying(255) NOT NULL,
1153 v character varying(255) NOT NULL
1158 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -
1161 CREATE TABLE user_roles (
1162 id integer NOT NULL,
1163 user_id bigint NOT NULL,
1164 created_at timestamp without time zone,
1165 updated_at timestamp without time zone,
1166 role user_role_enum NOT NULL,
1167 granter_id bigint NOT NULL
1172 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1175 CREATE SEQUENCE user_roles_id_seq
1184 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1187 ALTER SEQUENCE user_roles_id_seq OWNED BY user_roles.id;
1191 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
1194 CREATE TABLE user_tokens (
1196 user_id bigint NOT NULL,
1197 token character varying(255) NOT NULL,
1198 expiry timestamp without time zone NOT NULL,
1204 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1207 CREATE SEQUENCE user_tokens_id_seq
1216 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1219 ALTER SEQUENCE user_tokens_id_seq OWNED BY user_tokens.id;
1223 -- Name: users; Type: TABLE; Schema: public; Owner: -
1226 CREATE TABLE users (
1227 email character varying(255) NOT NULL,
1229 pass_crypt character varying(255) NOT NULL,
1230 creation_time timestamp without time zone NOT NULL,
1231 display_name character varying(255) DEFAULT ''::character varying NOT NULL,
1232 data_public boolean DEFAULT false NOT NULL,
1233 description text DEFAULT ''::text NOT NULL,
1234 home_lat double precision,
1235 home_lon double precision,
1236 home_zoom smallint DEFAULT 3,
1237 nearby integer DEFAULT 50,
1238 pass_salt character varying(255),
1239 image_file_name text,
1240 email_valid boolean DEFAULT false NOT NULL,
1241 new_email character varying(255),
1242 creation_ip character varying(255),
1243 languages character varying(255),
1244 status user_status_enum DEFAULT 'pending'::user_status_enum NOT NULL,
1245 terms_agreed timestamp without time zone,
1246 consider_pd boolean DEFAULT false NOT NULL,
1247 preferred_editor character varying(255),
1248 terms_seen boolean DEFAULT false NOT NULL,
1249 auth_uid character varying(255),
1250 description_format format_enum DEFAULT 'markdown'::format_enum NOT NULL,
1251 image_fingerprint character varying(255),
1252 changesets_count integer DEFAULT 0 NOT NULL,
1253 traces_count integer DEFAULT 0 NOT NULL,
1254 diary_entries_count integer DEFAULT 0 NOT NULL,
1255 image_use_gravatar boolean DEFAULT false NOT NULL,
1256 image_content_type character varying(255),
1257 auth_provider character varying(255),
1263 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1266 CREATE SEQUENCE users_id_seq
1275 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1278 ALTER SEQUENCE users_id_seq OWNED BY users.id;
1282 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
1285 CREATE TABLE way_nodes (
1286 way_id bigint NOT NULL,
1287 node_id bigint NOT NULL,
1288 version bigint NOT NULL,
1289 sequence_id bigint NOT NULL
1294 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -
1297 CREATE TABLE way_tags (
1298 way_id bigint DEFAULT 0 NOT NULL,
1299 k character varying(255) NOT NULL,
1300 v character varying(255) NOT NULL,
1301 version bigint NOT NULL
1306 -- Name: ways; Type: TABLE; Schema: public; Owner: -
1310 way_id bigint DEFAULT 0 NOT NULL,
1311 changeset_id bigint NOT NULL,
1312 "timestamp" timestamp without time zone NOT NULL,
1313 version bigint NOT NULL,
1314 visible boolean DEFAULT true NOT NULL,
1315 redaction_id integer
1320 -- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
1323 ALTER TABLE ONLY acls ALTER COLUMN id SET DEFAULT nextval('acls_id_seq'::regclass);
1327 -- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
1330 ALTER TABLE ONLY changeset_comments ALTER COLUMN id SET DEFAULT nextval('changeset_comments_id_seq'::regclass);
1334 -- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
1337 ALTER TABLE ONLY changesets ALTER COLUMN id SET DEFAULT nextval('changesets_id_seq'::regclass);
1341 -- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
1344 ALTER TABLE ONLY client_applications ALTER COLUMN id SET DEFAULT nextval('client_applications_id_seq'::regclass);
1348 -- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
1351 ALTER TABLE ONLY current_nodes ALTER COLUMN id SET DEFAULT nextval('current_nodes_id_seq'::regclass);
1355 -- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
1358 ALTER TABLE ONLY current_relations ALTER COLUMN id SET DEFAULT nextval('current_relations_id_seq'::regclass);
1362 -- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
1365 ALTER TABLE ONLY current_ways ALTER COLUMN id SET DEFAULT nextval('current_ways_id_seq'::regclass);
1369 -- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
1372 ALTER TABLE ONLY diary_comments ALTER COLUMN id SET DEFAULT nextval('diary_comments_id_seq'::regclass);
1376 -- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
1379 ALTER TABLE ONLY diary_entries ALTER COLUMN id SET DEFAULT nextval('diary_entries_id_seq'::regclass);
1383 -- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
1386 ALTER TABLE ONLY friends ALTER COLUMN id SET DEFAULT nextval('friends_id_seq'::regclass);
1390 -- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
1393 ALTER TABLE ONLY gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('gpx_file_tags_id_seq'::regclass);
1397 -- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -
1400 ALTER TABLE ONLY gpx_files ALTER COLUMN id SET DEFAULT nextval('gpx_files_id_seq'::regclass);
1404 -- Name: issue_comments id; Type: DEFAULT; Schema: public; Owner: -
1407 ALTER TABLE ONLY issue_comments ALTER COLUMN id SET DEFAULT nextval('issue_comments_id_seq'::regclass);
1411 -- Name: issues id; Type: DEFAULT; Schema: public; Owner: -
1414 ALTER TABLE ONLY issues ALTER COLUMN id SET DEFAULT nextval('issues_id_seq'::regclass);
1418 -- Name: messages id; Type: DEFAULT; Schema: public; Owner: -
1421 ALTER TABLE ONLY messages ALTER COLUMN id SET DEFAULT nextval('messages_id_seq'::regclass);
1425 -- Name: note_comments id; Type: DEFAULT; Schema: public; Owner: -
1428 ALTER TABLE ONLY note_comments ALTER COLUMN id SET DEFAULT nextval('note_comments_id_seq'::regclass);
1432 -- Name: notes id; Type: DEFAULT; Schema: public; Owner: -
1435 ALTER TABLE ONLY notes ALTER COLUMN id SET DEFAULT nextval('notes_id_seq'::regclass);
1439 -- Name: oauth_nonces id; Type: DEFAULT; Schema: public; Owner: -
1442 ALTER TABLE ONLY oauth_nonces ALTER COLUMN id SET DEFAULT nextval('oauth_nonces_id_seq'::regclass);
1446 -- Name: oauth_tokens id; Type: DEFAULT; Schema: public; Owner: -
1449 ALTER TABLE ONLY oauth_tokens ALTER COLUMN id SET DEFAULT nextval('oauth_tokens_id_seq'::regclass);
1453 -- Name: redactions id; Type: DEFAULT; Schema: public; Owner: -
1456 ALTER TABLE ONLY redactions ALTER COLUMN id SET DEFAULT nextval('redactions_id_seq'::regclass);
1460 -- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
1463 ALTER TABLE ONLY reports ALTER COLUMN id SET DEFAULT nextval('reports_id_seq'::regclass);
1467 -- Name: user_blocks id; Type: DEFAULT; Schema: public; Owner: -
1470 ALTER TABLE ONLY user_blocks ALTER COLUMN id SET DEFAULT nextval('user_blocks_id_seq'::regclass);
1474 -- Name: user_roles id; Type: DEFAULT; Schema: public; Owner: -
1477 ALTER TABLE ONLY user_roles ALTER COLUMN id SET DEFAULT nextval('user_roles_id_seq'::regclass);
1481 -- Name: user_tokens id; Type: DEFAULT; Schema: public; Owner: -
1484 ALTER TABLE ONLY user_tokens ALTER COLUMN id SET DEFAULT nextval('user_tokens_id_seq'::regclass);
1488 -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
1491 ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
1495 -- Name: acls acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1498 ALTER TABLE ONLY acls
1499 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1503 -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1506 ALTER TABLE ONLY ar_internal_metadata
1507 ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
1511 -- Name: changeset_comments changeset_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1514 ALTER TABLE ONLY changeset_comments
1515 ADD CONSTRAINT changeset_comments_pkey PRIMARY KEY (id);
1519 -- Name: changesets changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1522 ALTER TABLE ONLY changesets
1523 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1527 -- Name: client_applications client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1530 ALTER TABLE ONLY client_applications
1531 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1535 -- Name: current_node_tags current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1538 ALTER TABLE ONLY current_node_tags
1539 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1543 -- Name: current_nodes current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -
1546 ALTER TABLE ONLY current_nodes
1547 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1551 -- Name: current_relation_members current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1554 ALTER TABLE ONLY current_relation_members
1555 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1559 -- Name: current_relation_tags current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1562 ALTER TABLE ONLY current_relation_tags
1563 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1567 -- Name: current_relations current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1570 ALTER TABLE ONLY current_relations
1571 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1575 -- Name: current_way_nodes current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1578 ALTER TABLE ONLY current_way_nodes
1579 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1583 -- Name: current_way_tags current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1586 ALTER TABLE ONLY current_way_tags
1587 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1591 -- Name: current_ways current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1594 ALTER TABLE ONLY current_ways
1595 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1599 -- Name: diary_comments diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1602 ALTER TABLE ONLY diary_comments
1603 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1607 -- Name: diary_entries diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1610 ALTER TABLE ONLY diary_entries
1611 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1615 -- Name: diary_entry_subscriptions diary_entry_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1618 ALTER TABLE ONLY diary_entry_subscriptions
1619 ADD CONSTRAINT diary_entry_subscriptions_pkey PRIMARY KEY (user_id, diary_entry_id);
1623 -- Name: friends friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1626 ALTER TABLE ONLY friends
1627 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1631 -- Name: gpx_file_tags gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1634 ALTER TABLE ONLY gpx_file_tags
1635 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1639 -- Name: gpx_files gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1642 ALTER TABLE ONLY gpx_files
1643 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1647 -- Name: issue_comments issue_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1650 ALTER TABLE ONLY issue_comments
1651 ADD CONSTRAINT issue_comments_pkey PRIMARY KEY (id);
1655 -- Name: issues issues_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1658 ALTER TABLE ONLY issues
1659 ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
1663 -- Name: languages languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1666 ALTER TABLE ONLY languages
1667 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1671 -- Name: messages messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1674 ALTER TABLE ONLY messages
1675 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1679 -- Name: node_tags node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1682 ALTER TABLE ONLY node_tags
1683 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1687 -- Name: nodes nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1690 ALTER TABLE ONLY nodes
1691 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1695 -- Name: note_comments note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1698 ALTER TABLE ONLY note_comments
1699 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1703 -- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1706 ALTER TABLE ONLY notes
1707 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1711 -- Name: oauth_nonces oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1714 ALTER TABLE ONLY oauth_nonces
1715 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1719 -- Name: oauth_tokens oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1722 ALTER TABLE ONLY oauth_tokens
1723 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1727 -- Name: redactions redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1730 ALTER TABLE ONLY redactions
1731 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1735 -- Name: relation_members relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1738 ALTER TABLE ONLY relation_members
1739 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1743 -- Name: relation_tags relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1746 ALTER TABLE ONLY relation_tags
1747 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1751 -- Name: relations relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1754 ALTER TABLE ONLY relations
1755 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1759 -- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1762 ALTER TABLE ONLY reports
1763 ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
1767 -- Name: user_blocks user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1770 ALTER TABLE ONLY user_blocks
1771 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1775 -- Name: user_preferences user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1778 ALTER TABLE ONLY user_preferences
1779 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1783 -- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1786 ALTER TABLE ONLY user_roles
1787 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1791 -- Name: user_tokens user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1794 ALTER TABLE ONLY user_tokens
1795 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
1799 -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1802 ALTER TABLE ONLY users
1803 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
1807 -- Name: way_nodes way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1810 ALTER TABLE ONLY way_nodes
1811 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
1815 -- Name: way_tags way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1818 ALTER TABLE ONLY way_tags
1819 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
1823 -- Name: ways ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1826 ALTER TABLE ONLY ways
1827 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
1831 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -
1834 CREATE INDEX acls_k_idx ON acls USING btree (k);
1838 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -
1841 CREATE INDEX changeset_tags_id_idx ON changeset_tags USING btree (changeset_id);
1845 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -
1848 CREATE INDEX changesets_bbox_idx ON changesets USING gist (min_lat, max_lat, min_lon, max_lon);
1852 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -
1855 CREATE INDEX changesets_closed_at_idx ON changesets USING btree (closed_at);
1859 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -
1862 CREATE INDEX changesets_created_at_idx ON changesets USING btree (created_at);
1866 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -
1869 CREATE INDEX changesets_user_id_created_at_idx ON changesets USING btree (user_id, created_at);
1873 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -
1876 CREATE INDEX changesets_user_id_id_idx ON changesets USING btree (user_id, id);
1880 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
1883 CREATE INDEX current_nodes_tile_idx ON current_nodes USING btree (tile);
1887 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1890 CREATE INDEX current_nodes_timestamp_idx ON current_nodes USING btree ("timestamp");
1894 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
1897 CREATE INDEX current_relation_members_member_idx ON current_relation_members USING btree (member_type, member_id);
1901 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1904 CREATE INDEX current_relations_timestamp_idx ON current_relations USING btree ("timestamp");
1908 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
1911 CREATE INDEX current_way_nodes_node_idx ON current_way_nodes USING btree (node_id);
1915 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1918 CREATE INDEX current_ways_timestamp_idx ON current_ways USING btree ("timestamp");
1922 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
1925 CREATE INDEX diary_comment_user_id_created_at_index ON diary_comments USING btree (user_id, created_at);
1929 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -
1932 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON diary_comments USING btree (diary_entry_id, id);
1936 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -
1939 CREATE INDEX diary_entry_created_at_index ON diary_entries USING btree (created_at);
1943 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -
1946 CREATE INDEX diary_entry_language_code_created_at_index ON diary_entries USING btree (language_code, created_at);
1950 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -
1953 CREATE INDEX diary_entry_user_id_created_at_index ON diary_entries USING btree (user_id, created_at);
1957 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -
1960 CREATE INDEX friends_user_id_idx ON friends USING btree (user_id);
1964 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -
1967 CREATE INDEX gpx_file_tags_gpxid_idx ON gpx_file_tags USING btree (gpx_id);
1971 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -
1974 CREATE INDEX gpx_file_tags_tag_idx ON gpx_file_tags USING btree (tag);
1978 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -
1981 CREATE INDEX gpx_files_timestamp_idx ON gpx_files USING btree ("timestamp");
1985 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -
1988 CREATE INDEX gpx_files_user_id_idx ON gpx_files USING btree (user_id);
1992 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -
1995 CREATE INDEX gpx_files_visible_visibility_idx ON gpx_files USING btree (visible, visibility);
1999 -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2002 CREATE INDEX index_changeset_comments_on_created_at ON changeset_comments USING btree (created_at);
2006 -- Name: index_changesets_subscribers_on_changeset_id; Type: INDEX; Schema: public; Owner: -
2009 CREATE INDEX index_changesets_subscribers_on_changeset_id ON changesets_subscribers USING btree (changeset_id);
2013 -- Name: index_changesets_subscribers_on_subscriber_id_and_changeset_id; Type: INDEX; Schema: public; Owner: -
2016 CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON changesets_subscribers USING btree (subscriber_id, changeset_id);
2020 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -
2023 CREATE UNIQUE INDEX index_client_applications_on_key ON client_applications USING btree (key);
2027 -- Name: index_client_applications_on_user_id; Type: INDEX; Schema: public; Owner: -
2030 CREATE INDEX index_client_applications_on_user_id ON client_applications USING btree (user_id);
2034 -- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
2037 CREATE INDEX index_diary_entry_subscriptions_on_diary_entry_id ON diary_entry_subscriptions USING btree (diary_entry_id);
2041 -- Name: index_issue_comments_on_issue_id; Type: INDEX; Schema: public; Owner: -
2044 CREATE INDEX index_issue_comments_on_issue_id ON issue_comments USING btree (issue_id);
2048 -- Name: index_issue_comments_on_user_id; Type: INDEX; Schema: public; Owner: -
2051 CREATE INDEX index_issue_comments_on_user_id ON issue_comments USING btree (user_id);
2055 -- Name: index_issues_on_assigned_role; Type: INDEX; Schema: public; Owner: -
2058 CREATE INDEX index_issues_on_assigned_role ON issues USING btree (assigned_role);
2062 -- Name: index_issues_on_reportable_type_and_reportable_id; Type: INDEX; Schema: public; Owner: -
2065 CREATE INDEX index_issues_on_reportable_type_and_reportable_id ON issues USING btree (reportable_type, reportable_id);
2069 -- Name: index_issues_on_reported_user_id; Type: INDEX; Schema: public; Owner: -
2072 CREATE INDEX index_issues_on_reported_user_id ON issues USING btree (reported_user_id);
2076 -- Name: index_issues_on_status; Type: INDEX; Schema: public; Owner: -
2079 CREATE INDEX index_issues_on_status ON issues USING btree (status);
2083 -- Name: index_issues_on_updated_by; Type: INDEX; Schema: public; Owner: -
2086 CREATE INDEX index_issues_on_updated_by ON issues USING btree (updated_by);
2090 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -
2093 CREATE INDEX index_note_comments_on_body ON note_comments USING gin (to_tsvector('english'::regconfig, body));
2097 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -
2100 CREATE INDEX index_note_comments_on_created_at ON note_comments USING btree (created_at);
2104 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -
2107 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON oauth_nonces USING btree (nonce, "timestamp");
2111 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -
2114 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON oauth_tokens USING btree (token);
2118 -- Name: index_oauth_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
2121 CREATE INDEX index_oauth_tokens_on_user_id ON oauth_tokens USING btree (user_id);
2125 -- Name: index_reports_on_issue_id; Type: INDEX; Schema: public; Owner: -
2128 CREATE INDEX index_reports_on_issue_id ON reports USING btree (issue_id);
2132 -- Name: index_reports_on_user_id; Type: INDEX; Schema: public; Owner: -
2135 CREATE INDEX index_reports_on_user_id ON reports USING btree (user_id);
2139 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
2142 CREATE INDEX index_user_blocks_on_user_id ON user_blocks USING btree (user_id);
2146 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -
2149 CREATE INDEX messages_from_user_id_idx ON messages USING btree (from_user_id);
2153 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -
2156 CREATE INDEX messages_to_user_id_idx ON messages USING btree (to_user_id);
2160 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2163 CREATE INDEX nodes_changeset_id_idx ON nodes USING btree (changeset_id);
2167 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -
2170 CREATE INDEX nodes_tile_idx ON nodes USING btree (tile);
2174 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2177 CREATE INDEX nodes_timestamp_idx ON nodes USING btree ("timestamp");
2181 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -
2184 CREATE INDEX note_comments_note_id_idx ON note_comments USING btree (note_id);
2188 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -
2191 CREATE INDEX notes_created_at_idx ON notes USING btree (created_at);
2195 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -
2198 CREATE INDEX notes_tile_status_idx ON notes USING btree (tile, status);
2202 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -
2205 CREATE INDEX notes_updated_at_idx ON notes USING btree (updated_at);
2209 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -
2212 CREATE INDEX points_gpxid_idx ON gps_points USING btree (gpx_id);
2216 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -
2219 CREATE INDEX points_tile_idx ON gps_points USING btree (tile);
2223 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -
2226 CREATE INDEX relation_members_member_idx ON relation_members USING btree (member_type, member_id);
2230 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2233 CREATE INDEX relations_changeset_id_idx ON relations USING btree (changeset_id);
2237 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2240 CREATE INDEX relations_timestamp_idx ON relations USING btree ("timestamp");
2244 -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -
2247 CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
2251 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -
2254 CREATE INDEX user_id_idx ON friends USING btree (friend_user_id);
2258 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -
2261 CREATE UNIQUE INDEX user_roles_id_role_unique ON user_roles USING btree (user_id, role);
2265 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -
2268 CREATE UNIQUE INDEX user_tokens_token_idx ON user_tokens USING btree (token);
2272 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -
2275 CREATE INDEX user_tokens_user_id_idx ON user_tokens USING btree (user_id);
2279 -- Name: users_auth_idx; Type: INDEX; Schema: public; Owner: -
2282 CREATE UNIQUE INDEX users_auth_idx ON users USING btree (auth_provider, auth_uid);
2286 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -
2289 CREATE UNIQUE INDEX users_display_name_idx ON users USING btree (display_name);
2293 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -
2296 CREATE INDEX users_display_name_lower_idx ON users USING btree (lower((display_name)::text));
2300 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -
2303 CREATE UNIQUE INDEX users_email_idx ON users USING btree (email);
2307 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -
2310 CREATE INDEX users_email_lower_idx ON users USING btree (lower((email)::text));
2314 -- Name: users_home_idx; Type: INDEX; Schema: public; Owner: -
2317 CREATE INDEX users_home_idx ON users USING btree (home_tile);
2321 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -
2324 CREATE INDEX way_nodes_node_idx ON way_nodes USING btree (node_id);
2328 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -
2331 CREATE INDEX ways_changeset_id_idx ON ways USING btree (changeset_id);
2335 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -
2338 CREATE INDEX ways_timestamp_idx ON ways USING btree ("timestamp");
2342 -- Name: changeset_comments changeset_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2345 ALTER TABLE ONLY changeset_comments
2346 ADD CONSTRAINT changeset_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES users(id);
2350 -- Name: changeset_comments changeset_comments_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2353 ALTER TABLE ONLY changeset_comments
2354 ADD CONSTRAINT changeset_comments_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2358 -- Name: changeset_tags changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2361 ALTER TABLE ONLY changeset_tags
2362 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2366 -- Name: changesets_subscribers changesets_subscribers_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2369 ALTER TABLE ONLY changesets_subscribers
2370 ADD CONSTRAINT changesets_subscribers_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2374 -- Name: changesets_subscribers changesets_subscribers_subscriber_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2377 ALTER TABLE ONLY changesets_subscribers
2378 ADD CONSTRAINT changesets_subscribers_subscriber_id_fkey FOREIGN KEY (subscriber_id) REFERENCES users(id);
2382 -- Name: changesets changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2385 ALTER TABLE ONLY changesets
2386 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2390 -- Name: client_applications client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2393 ALTER TABLE ONLY client_applications
2394 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2398 -- Name: current_node_tags current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2401 ALTER TABLE ONLY current_node_tags
2402 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
2406 -- Name: current_nodes current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2409 ALTER TABLE ONLY current_nodes
2410 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2414 -- Name: current_relation_members current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2417 ALTER TABLE ONLY current_relation_members
2418 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
2422 -- Name: current_relation_tags current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2425 ALTER TABLE ONLY current_relation_tags
2426 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
2430 -- Name: current_relations current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2433 ALTER TABLE ONLY current_relations
2434 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2438 -- Name: current_way_nodes current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2441 ALTER TABLE ONLY current_way_nodes
2442 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
2446 -- Name: current_way_nodes current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2449 ALTER TABLE ONLY current_way_nodes
2450 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
2454 -- Name: current_way_tags current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2457 ALTER TABLE ONLY current_way_tags
2458 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
2462 -- Name: current_ways current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2465 ALTER TABLE ONLY current_ways
2466 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2470 -- Name: diary_comments diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2473 ALTER TABLE ONLY diary_comments
2474 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES diary_entries(id);
2478 -- Name: diary_comments diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2481 ALTER TABLE ONLY diary_comments
2482 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2486 -- Name: diary_entries diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2489 ALTER TABLE ONLY diary_entries
2490 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES languages(code);
2494 -- Name: diary_entries diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2497 ALTER TABLE ONLY diary_entries
2498 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2502 -- Name: diary_entry_subscriptions diary_entry_subscriptions_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2505 ALTER TABLE ONLY diary_entry_subscriptions
2506 ADD CONSTRAINT diary_entry_subscriptions_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES diary_entries(id);
2510 -- Name: diary_entry_subscriptions diary_entry_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2513 ALTER TABLE ONLY diary_entry_subscriptions
2514 ADD CONSTRAINT diary_entry_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2518 -- Name: friends friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2521 ALTER TABLE ONLY friends
2522 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES users(id);
2526 -- Name: friends friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2529 ALTER TABLE ONLY friends
2530 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2534 -- Name: gps_points gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2537 ALTER TABLE ONLY gps_points
2538 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
2542 -- Name: gpx_file_tags gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2545 ALTER TABLE ONLY gpx_file_tags
2546 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
2550 -- Name: gpx_files gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2553 ALTER TABLE ONLY gpx_files
2554 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2558 -- Name: issue_comments issue_comments_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2561 ALTER TABLE ONLY issue_comments
2562 ADD CONSTRAINT issue_comments_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES issues(id);
2566 -- Name: issue_comments issue_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2569 ALTER TABLE ONLY issue_comments
2570 ADD CONSTRAINT issue_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2574 -- Name: issues issues_reported_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2577 ALTER TABLE ONLY issues
2578 ADD CONSTRAINT issues_reported_user_id_fkey FOREIGN KEY (reported_user_id) REFERENCES users(id);
2582 -- Name: issues issues_resolved_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2585 ALTER TABLE ONLY issues
2586 ADD CONSTRAINT issues_resolved_by_fkey FOREIGN KEY (resolved_by) REFERENCES users(id);
2590 -- Name: issues issues_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2593 ALTER TABLE ONLY issues
2594 ADD CONSTRAINT issues_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES users(id);
2598 -- Name: messages messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2601 ALTER TABLE ONLY messages
2602 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES users(id);
2606 -- Name: messages messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2609 ALTER TABLE ONLY messages
2610 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES users(id);
2614 -- Name: node_tags node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2617 ALTER TABLE ONLY node_tags
2618 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES nodes(node_id, version);
2622 -- Name: nodes nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2625 ALTER TABLE ONLY nodes
2626 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2630 -- Name: nodes nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2633 ALTER TABLE ONLY nodes
2634 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2638 -- Name: note_comments note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2641 ALTER TABLE ONLY note_comments
2642 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES users(id);
2646 -- Name: note_comments note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2649 ALTER TABLE ONLY note_comments
2650 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES notes(id);
2654 -- Name: oauth_tokens oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2657 ALTER TABLE ONLY oauth_tokens
2658 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES client_applications(id);
2662 -- Name: oauth_tokens oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2665 ALTER TABLE ONLY oauth_tokens
2666 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2670 -- Name: redactions redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2673 ALTER TABLE ONLY redactions
2674 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2678 -- Name: relation_members relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2681 ALTER TABLE ONLY relation_members
2682 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2686 -- Name: relation_tags relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2689 ALTER TABLE ONLY relation_tags
2690 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2694 -- Name: relations relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2697 ALTER TABLE ONLY relations
2698 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2702 -- Name: relations relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2705 ALTER TABLE ONLY relations
2706 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2710 -- Name: reports reports_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2713 ALTER TABLE ONLY reports
2714 ADD CONSTRAINT reports_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES issues(id);
2718 -- Name: reports reports_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2721 ALTER TABLE ONLY reports
2722 ADD CONSTRAINT reports_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2726 -- Name: user_blocks user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2729 ALTER TABLE ONLY user_blocks
2730 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES users(id);
2734 -- Name: user_blocks user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2737 ALTER TABLE ONLY user_blocks
2738 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES users(id);
2742 -- Name: user_blocks user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2745 ALTER TABLE ONLY user_blocks
2746 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2750 -- Name: user_preferences user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2753 ALTER TABLE ONLY user_preferences
2754 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2758 -- Name: user_roles user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2761 ALTER TABLE ONLY user_roles
2762 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES users(id);
2766 -- Name: user_roles user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2769 ALTER TABLE ONLY user_roles
2770 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2774 -- Name: user_tokens user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2777 ALTER TABLE ONLY user_tokens
2778 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2782 -- Name: way_nodes way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2785 ALTER TABLE ONLY way_nodes
2786 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2790 -- Name: way_tags way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2793 ALTER TABLE ONLY way_tags
2794 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2798 -- Name: ways ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2801 ALTER TABLE ONLY ways
2802 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2806 -- Name: ways ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2809 ALTER TABLE ONLY ways
2810 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2814 -- PostgreSQL database dump complete
2817 SET search_path TO "$user", public;
2819 INSERT INTO "schema_migrations" (version) VALUES