2 -- PostgreSQL database dump
5 SET statement_timeout = 0;
6 SET client_encoding = 'UTF8';
7 SET standard_conforming_strings = on;
8 SET check_function_bodies = false;
9 SET client_min_messages = warning;
12 -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
15 CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
19 -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
22 COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
26 -- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: -
29 CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public;
33 -- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: -
36 COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST';
39 SET search_path = public, pg_catalog;
42 -- Name: format_enum; Type: TYPE; Schema: public; Owner: -
45 CREATE TYPE format_enum AS ENUM (
53 -- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: -
56 CREATE TYPE gpx_visibility_enum AS ENUM (
65 -- Name: nwr_enum; Type: TYPE; Schema: public; Owner: -
68 CREATE TYPE nwr_enum AS ENUM (
76 -- Name: user_role_enum; Type: TYPE; Schema: public; Owner: -
79 CREATE TYPE user_role_enum AS ENUM (
86 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
89 CREATE TYPE user_status_enum AS ENUM (
99 -- Name: maptile_for_point(bigint, bigint, integer); Type: FUNCTION; Schema: public; Owner: -
102 CREATE FUNCTION maptile_for_point(bigint, bigint, integer) RETURNS integer
104 AS '/srv/www/master.osm.compton.nu/db/functions/libpgosm.so', 'maptile_for_point';
108 -- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
111 CREATE FUNCTION tile_for_point(integer, integer) RETURNS bigint
113 AS '/srv/www/master.osm.compton.nu/db/functions/libpgosm.so', 'tile_for_point';
117 -- Name: xid_to_int4(xid); Type: FUNCTION; Schema: public; Owner: -
120 CREATE FUNCTION xid_to_int4(xid) RETURNS integer
121 LANGUAGE c IMMUTABLE STRICT
122 AS '/srv/www/master.osm.compton.nu/db/functions/libpgosm.so', 'xid_to_int4';
125 SET default_tablespace = '';
127 SET default_with_oids = false;
130 -- Name: acls; Type: TABLE; Schema: public; Owner: -; Tablespace:
136 k character varying(255) NOT NULL,
137 v character varying(255),
138 domain character varying(255)
143 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
146 CREATE SEQUENCE acls_id_seq
155 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
158 ALTER SEQUENCE acls_id_seq OWNED BY acls.id;
162 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
165 CREATE TABLE changeset_tags (
166 changeset_id bigint NOT NULL,
167 k character varying(255) DEFAULT ''::character varying NOT NULL,
168 v character varying(255) DEFAULT ''::character varying NOT NULL
173 -- Name: changesets; Type: TABLE; Schema: public; Owner: -; Tablespace:
176 CREATE TABLE changesets (
178 user_id bigint NOT NULL,
179 created_at timestamp without time zone NOT NULL,
184 closed_at timestamp without time zone NOT NULL,
185 num_changes integer DEFAULT 0 NOT NULL
190 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
193 CREATE SEQUENCE changesets_id_seq
202 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
205 ALTER SEQUENCE changesets_id_seq OWNED BY changesets.id;
209 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -; Tablespace:
212 CREATE TABLE client_applications (
214 name character varying(255),
215 url character varying(255),
216 support_url character varying(255),
217 callback_url character varying(255),
218 key character varying(50),
219 secret character varying(50),
221 created_at timestamp without time zone,
222 updated_at timestamp without time zone,
223 allow_read_prefs boolean DEFAULT false NOT NULL,
224 allow_write_prefs boolean DEFAULT false NOT NULL,
225 allow_write_diary boolean DEFAULT false NOT NULL,
226 allow_write_api boolean DEFAULT false NOT NULL,
227 allow_read_gpx boolean DEFAULT false NOT NULL,
228 allow_write_gpx boolean DEFAULT false NOT NULL
233 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
236 CREATE SEQUENCE client_applications_id_seq
245 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
248 ALTER SEQUENCE client_applications_id_seq OWNED BY client_applications.id;
252 -- Name: countries; Type: TABLE; Schema: public; Owner: -; Tablespace:
255 CREATE TABLE countries (
257 code character varying(2) NOT NULL,
258 min_lat double precision NOT NULL,
259 max_lat double precision NOT NULL,
260 min_lon double precision NOT NULL,
261 max_lon double precision NOT NULL
266 -- Name: countries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
269 CREATE SEQUENCE countries_id_seq
278 -- Name: countries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
281 ALTER SEQUENCE countries_id_seq OWNED BY countries.id;
285 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
288 CREATE TABLE current_node_tags (
289 node_id bigint NOT NULL,
290 k character varying(255) DEFAULT ''::character varying NOT NULL,
291 v character varying(255) DEFAULT ''::character varying NOT NULL
296 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
299 CREATE TABLE current_nodes (
301 latitude integer NOT NULL,
302 longitude integer NOT NULL,
303 changeset_id bigint NOT NULL,
304 visible boolean NOT NULL,
305 "timestamp" timestamp without time zone NOT NULL,
306 tile bigint NOT NULL,
307 version bigint NOT NULL
312 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
315 CREATE SEQUENCE current_nodes_id_seq
324 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
327 ALTER SEQUENCE current_nodes_id_seq OWNED BY current_nodes.id;
331 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -; Tablespace:
334 CREATE TABLE current_relation_members (
335 relation_id bigint NOT NULL,
336 member_type nwr_enum NOT NULL,
337 member_id bigint NOT NULL,
338 member_role character varying(255) NOT NULL,
339 sequence_id integer DEFAULT 0 NOT NULL
344 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
347 CREATE TABLE current_relation_tags (
348 relation_id bigint NOT NULL,
349 k character varying(255) DEFAULT ''::character varying NOT NULL,
350 v character varying(255) DEFAULT ''::character varying NOT NULL
355 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -; Tablespace:
358 CREATE TABLE current_relations (
360 changeset_id bigint NOT NULL,
361 "timestamp" timestamp without time zone NOT NULL,
362 visible boolean NOT NULL,
363 version bigint NOT NULL
368 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
371 CREATE SEQUENCE current_relations_id_seq
380 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
383 ALTER SEQUENCE current_relations_id_seq OWNED BY current_relations.id;
387 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
390 CREATE TABLE current_way_nodes (
391 way_id bigint NOT NULL,
392 node_id bigint NOT NULL,
393 sequence_id bigint NOT NULL
398 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
401 CREATE TABLE current_way_tags (
402 way_id bigint NOT NULL,
403 k character varying(255) DEFAULT ''::character varying NOT NULL,
404 v character varying(255) DEFAULT ''::character varying NOT NULL
409 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -; Tablespace:
412 CREATE TABLE current_ways (
414 changeset_id bigint NOT NULL,
415 "timestamp" timestamp without time zone NOT NULL,
416 visible boolean NOT NULL,
417 version bigint NOT NULL
422 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
425 CREATE SEQUENCE current_ways_id_seq
434 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
437 ALTER SEQUENCE current_ways_id_seq OWNED BY current_ways.id;
441 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -; Tablespace:
444 CREATE TABLE diary_comments (
446 diary_entry_id bigint NOT NULL,
447 user_id bigint NOT NULL,
449 created_at timestamp without time zone NOT NULL,
450 updated_at timestamp without time zone NOT NULL,
451 visible boolean DEFAULT true NOT NULL,
452 body_format format_enum DEFAULT 'html'::format_enum NOT NULL
457 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
460 CREATE SEQUENCE diary_comments_id_seq
469 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
472 ALTER SEQUENCE diary_comments_id_seq OWNED BY diary_comments.id;
476 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -; Tablespace:
479 CREATE TABLE diary_entries (
481 user_id bigint NOT NULL,
482 title character varying(255) NOT NULL,
484 created_at timestamp without time zone NOT NULL,
485 updated_at timestamp without time zone NOT NULL,
486 latitude double precision,
487 longitude double precision,
488 language_code character varying(255) DEFAULT 'en'::character varying NOT NULL,
489 visible boolean DEFAULT true NOT NULL,
490 body_format format_enum DEFAULT 'html'::format_enum NOT NULL
495 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
498 CREATE SEQUENCE diary_entries_id_seq
507 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
510 ALTER SEQUENCE diary_entries_id_seq OWNED BY diary_entries.id;
514 -- Name: friends; Type: TABLE; Schema: public; Owner: -; Tablespace:
517 CREATE TABLE friends (
519 user_id bigint NOT NULL,
520 friend_user_id bigint NOT NULL
525 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
528 CREATE SEQUENCE friends_id_seq
537 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
540 ALTER SEQUENCE friends_id_seq OWNED BY friends.id;
544 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -; Tablespace:
547 CREATE TABLE gps_points (
548 altitude double precision,
549 trackid integer NOT NULL,
550 latitude integer NOT NULL,
551 longitude integer NOT NULL,
552 gpx_id bigint NOT NULL,
553 "timestamp" timestamp without time zone,
559 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
562 CREATE TABLE gpx_file_tags (
563 gpx_id bigint DEFAULT 0 NOT NULL,
564 tag character varying(255) NOT NULL,
570 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
573 CREATE SEQUENCE gpx_file_tags_id_seq
582 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
585 ALTER SEQUENCE gpx_file_tags_id_seq OWNED BY gpx_file_tags.id;
589 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -; Tablespace:
592 CREATE TABLE gpx_files (
594 user_id bigint NOT NULL,
595 visible boolean DEFAULT true NOT NULL,
596 name character varying(255) DEFAULT ''::character varying NOT NULL,
598 latitude double precision,
599 longitude double precision,
600 "timestamp" timestamp without time zone NOT NULL,
601 description character varying(255) DEFAULT ''::character varying NOT NULL,
602 inserted boolean NOT NULL,
603 visibility gpx_visibility_enum DEFAULT 'public'::gpx_visibility_enum NOT NULL
608 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
611 CREATE SEQUENCE gpx_files_id_seq
620 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
623 ALTER SEQUENCE gpx_files_id_seq OWNED BY gpx_files.id;
627 -- Name: languages; Type: TABLE; Schema: public; Owner: -; Tablespace:
630 CREATE TABLE languages (
631 code character varying(255) NOT NULL,
632 english_name character varying(255) NOT NULL,
633 native_name character varying(255)
638 -- Name: messages; Type: TABLE; Schema: public; Owner: -; Tablespace:
641 CREATE TABLE messages (
643 from_user_id bigint NOT NULL,
644 title character varying(255) NOT NULL,
646 sent_on timestamp without time zone NOT NULL,
647 message_read boolean DEFAULT false NOT NULL,
648 to_user_id bigint NOT NULL,
649 to_user_visible boolean DEFAULT true NOT NULL,
650 from_user_visible boolean DEFAULT true NOT NULL,
651 body_format format_enum DEFAULT 'html'::format_enum NOT NULL
656 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
659 CREATE SEQUENCE messages_id_seq
668 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
671 ALTER SEQUENCE messages_id_seq OWNED BY messages.id;
675 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
678 CREATE TABLE node_tags (
679 node_id bigint NOT NULL,
680 version bigint NOT NULL,
681 k character varying(255) DEFAULT ''::character varying NOT NULL,
682 v character varying(255) DEFAULT ''::character varying NOT NULL
687 -- Name: nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
691 node_id bigint NOT NULL,
692 latitude integer NOT NULL,
693 longitude integer NOT NULL,
694 changeset_id bigint NOT NULL,
695 visible boolean NOT NULL,
696 "timestamp" timestamp without time zone NOT NULL,
697 tile bigint NOT NULL,
698 version bigint NOT NULL,
704 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -; Tablespace:
707 CREATE TABLE oauth_nonces (
709 nonce character varying(255),
711 created_at timestamp without time zone,
712 updated_at timestamp without time zone
717 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
720 CREATE SEQUENCE oauth_nonces_id_seq
729 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
732 ALTER SEQUENCE oauth_nonces_id_seq OWNED BY oauth_nonces.id;
736 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -; Tablespace:
739 CREATE TABLE oauth_tokens (
742 type character varying(20),
743 client_application_id integer,
744 token character varying(50),
745 secret character varying(50),
746 authorized_at timestamp without time zone,
747 invalidated_at timestamp without time zone,
748 created_at timestamp without time zone,
749 updated_at timestamp without time zone,
750 allow_read_prefs boolean DEFAULT false NOT NULL,
751 allow_write_prefs boolean DEFAULT false NOT NULL,
752 allow_write_diary boolean DEFAULT false NOT NULL,
753 allow_write_api boolean DEFAULT false NOT NULL,
754 allow_read_gpx boolean DEFAULT false NOT NULL,
755 allow_write_gpx boolean DEFAULT false NOT NULL,
756 callback_url character varying(255),
757 verifier character varying(20),
758 scope character varying(255),
759 valid_to timestamp without time zone
764 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
767 CREATE SEQUENCE oauth_tokens_id_seq
776 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
779 ALTER SEQUENCE oauth_tokens_id_seq OWNED BY oauth_tokens.id;
783 -- Name: redactions; Type: TABLE; Schema: public; Owner: -; Tablespace:
786 CREATE TABLE redactions (
788 title character varying(255),
790 created_at timestamp without time zone NOT NULL,
791 updated_at timestamp without time zone NOT NULL
796 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
799 CREATE SEQUENCE redactions_id_seq
808 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
811 ALTER SEQUENCE redactions_id_seq OWNED BY redactions.id;
815 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -; Tablespace:
818 CREATE TABLE relation_members (
819 relation_id bigint DEFAULT 0 NOT NULL,
820 member_type nwr_enum NOT NULL,
821 member_id bigint NOT NULL,
822 member_role character varying(255) NOT NULL,
823 version bigint DEFAULT 0 NOT NULL,
824 sequence_id integer DEFAULT 0 NOT NULL
829 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
832 CREATE TABLE relation_tags (
833 relation_id bigint DEFAULT 0 NOT NULL,
834 k character varying(255) DEFAULT ''::character varying NOT NULL,
835 v character varying(255) DEFAULT ''::character varying NOT NULL,
836 version bigint NOT NULL
841 -- Name: relations; Type: TABLE; Schema: public; Owner: -; Tablespace:
844 CREATE TABLE relations (
845 relation_id bigint DEFAULT 0 NOT NULL,
846 changeset_id bigint NOT NULL,
847 "timestamp" timestamp without time zone NOT NULL,
848 version bigint NOT NULL,
849 visible boolean DEFAULT true NOT NULL,
855 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace:
858 CREATE TABLE schema_migrations (
859 version character varying(255) NOT NULL
864 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -; Tablespace:
867 CREATE TABLE user_blocks (
869 user_id bigint NOT NULL,
870 creator_id bigint NOT NULL,
871 reason text NOT NULL,
872 ends_at timestamp without time zone NOT NULL,
873 needs_view boolean DEFAULT false NOT NULL,
875 created_at timestamp without time zone,
876 updated_at timestamp without time zone,
877 reason_format format_enum DEFAULT 'html'::format_enum NOT NULL
882 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
885 CREATE SEQUENCE user_blocks_id_seq
894 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
897 ALTER SEQUENCE user_blocks_id_seq OWNED BY user_blocks.id;
901 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -; Tablespace:
904 CREATE TABLE user_preferences (
905 user_id bigint NOT NULL,
906 k character varying(255) NOT NULL,
907 v character varying(255) NOT NULL
912 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -; Tablespace:
915 CREATE TABLE user_roles (
917 user_id bigint NOT NULL,
918 created_at timestamp without time zone,
919 updated_at timestamp without time zone,
920 role user_role_enum NOT NULL,
921 granter_id bigint NOT NULL
926 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
929 CREATE SEQUENCE user_roles_id_seq
938 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
941 ALTER SEQUENCE user_roles_id_seq OWNED BY user_roles.id;
945 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -; Tablespace:
948 CREATE TABLE user_tokens (
950 user_id bigint NOT NULL,
951 token character varying(255) NOT NULL,
952 expiry timestamp without time zone NOT NULL,
958 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
961 CREATE SEQUENCE user_tokens_id_seq
970 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
973 ALTER SEQUENCE user_tokens_id_seq OWNED BY user_tokens.id;
977 -- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace:
981 email character varying(255) NOT NULL,
983 pass_crypt character varying(255) NOT NULL,
984 creation_time timestamp without time zone NOT NULL,
985 display_name character varying(255) DEFAULT ''::character varying NOT NULL,
986 data_public boolean DEFAULT false NOT NULL,
987 description text DEFAULT ''::text NOT NULL,
988 home_lat double precision,
989 home_lon double precision,
990 home_zoom smallint DEFAULT 3,
991 nearby integer DEFAULT 50,
992 pass_salt character varying(255),
993 image_file_name text,
994 email_valid boolean DEFAULT false NOT NULL,
995 new_email character varying(255),
996 creation_ip character varying(255),
997 languages character varying(255),
998 status user_status_enum DEFAULT 'pending'::user_status_enum NOT NULL,
999 terms_agreed timestamp without time zone,
1000 consider_pd boolean DEFAULT false NOT NULL,
1001 preferred_editor character varying(255),
1002 terms_seen boolean DEFAULT false NOT NULL,
1003 openid_url character varying(255),
1004 description_format format_enum DEFAULT 'html'::format_enum NOT NULL,
1005 image_fingerprint character varying(255)
1010 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1013 CREATE SEQUENCE users_id_seq
1022 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1025 ALTER SEQUENCE users_id_seq OWNED BY users.id;
1029 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
1032 CREATE TABLE way_nodes (
1033 way_id bigint NOT NULL,
1034 node_id bigint NOT NULL,
1035 version bigint NOT NULL,
1036 sequence_id bigint NOT NULL
1041 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
1044 CREATE TABLE way_tags (
1045 way_id bigint DEFAULT 0 NOT NULL,
1046 k character varying(255) NOT NULL,
1047 v character varying(255) NOT NULL,
1048 version bigint NOT NULL
1053 -- Name: ways; Type: TABLE; Schema: public; Owner: -; Tablespace:
1057 way_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: id; Type: DEFAULT; Schema: public; Owner: -
1070 ALTER TABLE ONLY acls ALTER COLUMN id SET DEFAULT nextval('acls_id_seq'::regclass);
1074 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1077 ALTER TABLE ONLY changesets ALTER COLUMN id SET DEFAULT nextval('changesets_id_seq'::regclass);
1081 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1084 ALTER TABLE ONLY client_applications ALTER COLUMN id SET DEFAULT nextval('client_applications_id_seq'::regclass);
1088 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1091 ALTER TABLE ONLY countries ALTER COLUMN id SET DEFAULT nextval('countries_id_seq'::regclass);
1095 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1098 ALTER TABLE ONLY current_nodes ALTER COLUMN id SET DEFAULT nextval('current_nodes_id_seq'::regclass);
1102 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1105 ALTER TABLE ONLY current_relations ALTER COLUMN id SET DEFAULT nextval('current_relations_id_seq'::regclass);
1109 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1112 ALTER TABLE ONLY current_ways ALTER COLUMN id SET DEFAULT nextval('current_ways_id_seq'::regclass);
1116 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1119 ALTER TABLE ONLY diary_comments ALTER COLUMN id SET DEFAULT nextval('diary_comments_id_seq'::regclass);
1123 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1126 ALTER TABLE ONLY diary_entries ALTER COLUMN id SET DEFAULT nextval('diary_entries_id_seq'::regclass);
1130 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1133 ALTER TABLE ONLY friends ALTER COLUMN id SET DEFAULT nextval('friends_id_seq'::regclass);
1137 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1140 ALTER TABLE ONLY gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('gpx_file_tags_id_seq'::regclass);
1144 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1147 ALTER TABLE ONLY gpx_files ALTER COLUMN id SET DEFAULT nextval('gpx_files_id_seq'::regclass);
1151 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1154 ALTER TABLE ONLY messages ALTER COLUMN id SET DEFAULT nextval('messages_id_seq'::regclass);
1158 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1161 ALTER TABLE ONLY oauth_nonces ALTER COLUMN id SET DEFAULT nextval('oauth_nonces_id_seq'::regclass);
1165 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1168 ALTER TABLE ONLY oauth_tokens ALTER COLUMN id SET DEFAULT nextval('oauth_tokens_id_seq'::regclass);
1172 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1175 ALTER TABLE ONLY redactions ALTER COLUMN id SET DEFAULT nextval('redactions_id_seq'::regclass);
1179 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1182 ALTER TABLE ONLY user_blocks ALTER COLUMN id SET DEFAULT nextval('user_blocks_id_seq'::regclass);
1186 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1189 ALTER TABLE ONLY user_roles ALTER COLUMN id SET DEFAULT nextval('user_roles_id_seq'::regclass);
1193 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1196 ALTER TABLE ONLY user_tokens ALTER COLUMN id SET DEFAULT nextval('user_tokens_id_seq'::regclass);
1200 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1203 ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
1207 -- Name: acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1210 ALTER TABLE ONLY acls
1211 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1215 -- Name: changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1218 ALTER TABLE ONLY changesets
1219 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1223 -- Name: client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1226 ALTER TABLE ONLY client_applications
1227 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1231 -- Name: countries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1234 ALTER TABLE ONLY countries
1235 ADD CONSTRAINT countries_pkey PRIMARY KEY (id);
1239 -- Name: current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1242 ALTER TABLE ONLY current_node_tags
1243 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1247 -- Name: current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1250 ALTER TABLE ONLY current_nodes
1251 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1255 -- Name: current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1258 ALTER TABLE ONLY current_relation_members
1259 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1263 -- Name: current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1266 ALTER TABLE ONLY current_relation_tags
1267 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1271 -- Name: current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1274 ALTER TABLE ONLY current_relations
1275 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1279 -- Name: current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1282 ALTER TABLE ONLY current_way_nodes
1283 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1287 -- Name: current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1290 ALTER TABLE ONLY current_way_tags
1291 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1295 -- Name: current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1298 ALTER TABLE ONLY current_ways
1299 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1303 -- Name: diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1306 ALTER TABLE ONLY diary_comments
1307 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1311 -- Name: diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1314 ALTER TABLE ONLY diary_entries
1315 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1319 -- Name: friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1322 ALTER TABLE ONLY friends
1323 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1327 -- Name: gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1330 ALTER TABLE ONLY gpx_file_tags
1331 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1335 -- Name: gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1338 ALTER TABLE ONLY gpx_files
1339 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1343 -- Name: languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1346 ALTER TABLE ONLY languages
1347 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1351 -- Name: messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1354 ALTER TABLE ONLY messages
1355 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1359 -- Name: node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1362 ALTER TABLE ONLY node_tags
1363 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1367 -- Name: nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1370 ALTER TABLE ONLY nodes
1371 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1375 -- Name: oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1378 ALTER TABLE ONLY oauth_nonces
1379 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1383 -- Name: oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1386 ALTER TABLE ONLY oauth_tokens
1387 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1391 -- Name: redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1394 ALTER TABLE ONLY redactions
1395 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1399 -- Name: relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1402 ALTER TABLE ONLY relation_members
1403 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1407 -- Name: relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1410 ALTER TABLE ONLY relation_tags
1411 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1415 -- Name: relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1418 ALTER TABLE ONLY relations
1419 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1423 -- Name: user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1426 ALTER TABLE ONLY user_blocks
1427 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1431 -- Name: user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1434 ALTER TABLE ONLY user_preferences
1435 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1439 -- Name: user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1442 ALTER TABLE ONLY user_roles
1443 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1447 -- Name: user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1450 ALTER TABLE ONLY user_tokens
1451 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
1455 -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1458 ALTER TABLE ONLY users
1459 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
1463 -- Name: way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1466 ALTER TABLE ONLY way_nodes
1467 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
1471 -- Name: way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1474 ALTER TABLE ONLY way_tags
1475 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
1479 -- Name: ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1482 ALTER TABLE ONLY ways
1483 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
1487 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1490 CREATE INDEX acls_k_idx ON acls USING btree (k);
1494 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1497 CREATE INDEX changeset_tags_id_idx ON changeset_tags USING btree (changeset_id);
1501 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1504 CREATE INDEX changesets_bbox_idx ON changesets USING gist (min_lat, max_lat, min_lon, max_lon);
1508 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1511 CREATE INDEX changesets_closed_at_idx ON changesets USING btree (closed_at);
1515 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1518 CREATE INDEX changesets_created_at_idx ON changesets USING btree (created_at);
1522 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1525 CREATE INDEX changesets_user_id_created_at_idx ON changesets USING btree (user_id, created_at);
1529 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1532 CREATE INDEX changesets_user_id_id_idx ON changesets USING btree (user_id, id);
1536 -- Name: countries_code_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1539 CREATE UNIQUE INDEX countries_code_idx ON countries USING btree (code);
1543 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1546 CREATE INDEX current_nodes_tile_idx ON current_nodes USING btree (tile);
1550 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1553 CREATE INDEX current_nodes_timestamp_idx ON current_nodes USING btree ("timestamp");
1557 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1560 CREATE INDEX current_relation_members_member_idx ON current_relation_members USING btree (member_type, member_id);
1564 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1567 CREATE INDEX current_relations_timestamp_idx ON current_relations USING btree ("timestamp");
1571 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1574 CREATE INDEX current_way_nodes_node_idx ON current_way_nodes USING btree (node_id);
1578 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1581 CREATE INDEX current_ways_timestamp_idx ON current_ways USING btree ("timestamp");
1585 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1588 CREATE INDEX diary_comment_user_id_created_at_index ON diary_comments USING btree (user_id, created_at);
1592 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1595 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON diary_comments USING btree (diary_entry_id, id);
1599 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1602 CREATE INDEX diary_entry_created_at_index ON diary_entries USING btree (created_at);
1606 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1609 CREATE INDEX diary_entry_language_code_created_at_index ON diary_entries USING btree (language_code, created_at);
1613 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1616 CREATE INDEX diary_entry_user_id_created_at_index ON diary_entries USING btree (user_id, created_at);
1620 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1623 CREATE INDEX friends_user_id_idx ON friends USING btree (user_id);
1627 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1630 CREATE INDEX gpx_file_tags_gpxid_idx ON gpx_file_tags USING btree (gpx_id);
1634 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1637 CREATE INDEX gpx_file_tags_tag_idx ON gpx_file_tags USING btree (tag);
1641 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1644 CREATE INDEX gpx_files_timestamp_idx ON gpx_files USING btree ("timestamp");
1648 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1651 CREATE INDEX gpx_files_user_id_idx ON gpx_files USING btree (user_id);
1655 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1658 CREATE INDEX gpx_files_visible_visibility_idx ON gpx_files USING btree (visible, visibility);
1662 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -; Tablespace:
1665 CREATE UNIQUE INDEX index_client_applications_on_key ON client_applications USING btree (key);
1669 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -; Tablespace:
1672 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON oauth_nonces USING btree (nonce, "timestamp");
1676 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -; Tablespace:
1679 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON oauth_tokens USING btree (token);
1683 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1686 CREATE INDEX index_user_blocks_on_user_id ON user_blocks USING btree (user_id);
1690 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1693 CREATE INDEX messages_from_user_id_idx ON messages USING btree (from_user_id);
1697 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1700 CREATE INDEX messages_to_user_id_idx ON messages USING btree (to_user_id);
1704 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1707 CREATE INDEX nodes_changeset_id_idx ON nodes USING btree (changeset_id);
1711 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1714 CREATE INDEX nodes_tile_idx ON nodes USING btree (tile);
1718 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1721 CREATE INDEX nodes_timestamp_idx ON nodes USING btree ("timestamp");
1725 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1728 CREATE INDEX points_gpxid_idx ON gps_points USING btree (gpx_id);
1732 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1735 CREATE INDEX points_tile_idx ON gps_points USING btree (tile);
1739 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1742 CREATE INDEX relation_members_member_idx ON relation_members USING btree (member_type, member_id);
1746 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1749 CREATE INDEX relations_changeset_id_idx ON relations USING btree (changeset_id);
1753 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1756 CREATE INDEX relations_timestamp_idx ON relations USING btree ("timestamp");
1760 -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
1763 CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
1767 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1770 CREATE INDEX user_id_idx ON friends USING btree (friend_user_id);
1774 -- Name: user_openid_url_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1777 CREATE UNIQUE INDEX user_openid_url_idx ON users USING btree (openid_url);
1781 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -; Tablespace:
1784 CREATE UNIQUE INDEX user_roles_id_role_unique ON user_roles USING btree (user_id, role);
1788 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1791 CREATE UNIQUE INDEX user_tokens_token_idx ON user_tokens USING btree (token);
1795 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1798 CREATE INDEX user_tokens_user_id_idx ON user_tokens USING btree (user_id);
1802 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1805 CREATE UNIQUE INDEX users_display_name_idx ON users USING btree (display_name);
1809 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1812 CREATE INDEX users_display_name_lower_idx ON users USING btree (lower((display_name)::text));
1816 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1819 CREATE UNIQUE INDEX users_email_idx ON users USING btree (email);
1823 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1826 CREATE INDEX users_email_lower_idx ON users USING btree (lower((email)::text));
1830 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1833 CREATE INDEX way_nodes_node_idx ON way_nodes USING btree (node_id);
1837 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1840 CREATE INDEX ways_changeset_id_idx ON ways USING btree (changeset_id);
1844 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1847 CREATE INDEX ways_timestamp_idx ON ways USING btree ("timestamp");
1851 -- Name: changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1854 ALTER TABLE ONLY changeset_tags
1855 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
1859 -- Name: changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1862 ALTER TABLE ONLY changesets
1863 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1867 -- Name: client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1870 ALTER TABLE ONLY client_applications
1871 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1875 -- Name: current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1878 ALTER TABLE ONLY current_node_tags
1879 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
1883 -- Name: current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1886 ALTER TABLE ONLY current_nodes
1887 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
1891 -- Name: current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1894 ALTER TABLE ONLY current_relation_members
1895 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
1899 -- Name: current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1902 ALTER TABLE ONLY current_relation_tags
1903 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
1907 -- Name: current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1910 ALTER TABLE ONLY current_relations
1911 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
1915 -- Name: current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1918 ALTER TABLE ONLY current_way_nodes
1919 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
1923 -- Name: current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1926 ALTER TABLE ONLY current_way_nodes
1927 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
1931 -- Name: current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1934 ALTER TABLE ONLY current_way_tags
1935 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
1939 -- Name: current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1942 ALTER TABLE ONLY current_ways
1943 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
1947 -- Name: diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1950 ALTER TABLE ONLY diary_comments
1951 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES diary_entries(id);
1955 -- Name: diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1958 ALTER TABLE ONLY diary_comments
1959 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1963 -- Name: diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1966 ALTER TABLE ONLY diary_entries
1967 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES languages(code);
1971 -- Name: diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1974 ALTER TABLE ONLY diary_entries
1975 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1979 -- Name: friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1982 ALTER TABLE ONLY friends
1983 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES users(id);
1987 -- Name: friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1990 ALTER TABLE ONLY friends
1991 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1995 -- Name: gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1998 ALTER TABLE ONLY gps_points
1999 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
2003 -- Name: gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2006 ALTER TABLE ONLY gpx_file_tags
2007 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
2011 -- Name: gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2014 ALTER TABLE ONLY gpx_files
2015 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2019 -- Name: messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2022 ALTER TABLE ONLY messages
2023 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES users(id);
2027 -- Name: messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2030 ALTER TABLE ONLY messages
2031 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES users(id);
2035 -- Name: node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2038 ALTER TABLE ONLY node_tags
2039 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES nodes(node_id, version);
2043 -- Name: nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2046 ALTER TABLE ONLY nodes
2047 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2051 -- Name: nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2054 ALTER TABLE ONLY nodes
2055 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2059 -- Name: oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2062 ALTER TABLE ONLY oauth_tokens
2063 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES client_applications(id);
2067 -- Name: oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2070 ALTER TABLE ONLY oauth_tokens
2071 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2075 -- Name: relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2078 ALTER TABLE ONLY relation_members
2079 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2083 -- Name: relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2086 ALTER TABLE ONLY relation_tags
2087 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2091 -- Name: relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2094 ALTER TABLE ONLY relations
2095 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2099 -- Name: relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2102 ALTER TABLE ONLY relations
2103 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2107 -- Name: user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2110 ALTER TABLE ONLY user_blocks
2111 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES users(id);
2115 -- Name: user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2118 ALTER TABLE ONLY user_blocks
2119 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES users(id);
2123 -- Name: user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2126 ALTER TABLE ONLY user_blocks
2127 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2131 -- Name: user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2134 ALTER TABLE ONLY user_preferences
2135 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2139 -- Name: user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2142 ALTER TABLE ONLY user_roles
2143 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES users(id);
2147 -- Name: user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2150 ALTER TABLE ONLY user_roles
2151 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2155 -- Name: user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2158 ALTER TABLE ONLY user_tokens
2159 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2163 -- Name: way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2166 ALTER TABLE ONLY way_nodes
2167 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2171 -- Name: way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2174 ALTER TABLE ONLY way_tags
2175 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2179 -- Name: ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2182 ALTER TABLE ONLY ways
2183 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2187 -- Name: ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2190 ALTER TABLE ONLY ways
2191 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2195 -- PostgreSQL database dump complete
2198 INSERT INTO schema_migrations (version) VALUES ('1');
2200 INSERT INTO schema_migrations (version) VALUES ('10');
2202 INSERT INTO schema_migrations (version) VALUES ('11');
2204 INSERT INTO schema_migrations (version) VALUES ('12');
2206 INSERT INTO schema_migrations (version) VALUES ('13');
2208 INSERT INTO schema_migrations (version) VALUES ('14');
2210 INSERT INTO schema_migrations (version) VALUES ('15');
2212 INSERT INTO schema_migrations (version) VALUES ('16');
2214 INSERT INTO schema_migrations (version) VALUES ('17');
2216 INSERT INTO schema_migrations (version) VALUES ('18');
2218 INSERT INTO schema_migrations (version) VALUES ('19');
2220 INSERT INTO schema_migrations (version) VALUES ('2');
2222 INSERT INTO schema_migrations (version) VALUES ('20');
2224 INSERT INTO schema_migrations (version) VALUES ('20100513171259');
2226 INSERT INTO schema_migrations (version) VALUES ('20100516124737');
2228 INSERT INTO schema_migrations (version) VALUES ('20100910084426');
2230 INSERT INTO schema_migrations (version) VALUES ('20101114011429');
2232 INSERT INTO schema_migrations (version) VALUES ('20110322001319');
2234 INSERT INTO schema_migrations (version) VALUES ('20110925112722');
2236 INSERT INTO schema_migrations (version) VALUES ('20111116184519');
2238 INSERT INTO schema_migrations (version) VALUES ('20111212183945');
2240 INSERT INTO schema_migrations (version) VALUES ('20120123184321');
2242 INSERT INTO schema_migrations (version) VALUES ('20120208122334');
2244 INSERT INTO schema_migrations (version) VALUES ('20120208194454');
2246 INSERT INTO schema_migrations (version) VALUES ('20120214210114');
2248 INSERT INTO schema_migrations (version) VALUES ('20120219161649');
2250 INSERT INTO schema_migrations (version) VALUES ('20120318201948');
2252 INSERT INTO schema_migrations (version) VALUES ('20120328090602');
2254 INSERT INTO schema_migrations (version) VALUES ('21');
2256 INSERT INTO schema_migrations (version) VALUES ('22');
2258 INSERT INTO schema_migrations (version) VALUES ('23');
2260 INSERT INTO schema_migrations (version) VALUES ('24');
2262 INSERT INTO schema_migrations (version) VALUES ('25');
2264 INSERT INTO schema_migrations (version) VALUES ('26');
2266 INSERT INTO schema_migrations (version) VALUES ('27');
2268 INSERT INTO schema_migrations (version) VALUES ('28');
2270 INSERT INTO schema_migrations (version) VALUES ('29');
2272 INSERT INTO schema_migrations (version) VALUES ('3');
2274 INSERT INTO schema_migrations (version) VALUES ('30');
2276 INSERT INTO schema_migrations (version) VALUES ('31');
2278 INSERT INTO schema_migrations (version) VALUES ('32');
2280 INSERT INTO schema_migrations (version) VALUES ('33');
2282 INSERT INTO schema_migrations (version) VALUES ('34');
2284 INSERT INTO schema_migrations (version) VALUES ('35');
2286 INSERT INTO schema_migrations (version) VALUES ('36');
2288 INSERT INTO schema_migrations (version) VALUES ('37');
2290 INSERT INTO schema_migrations (version) VALUES ('38');
2292 INSERT INTO schema_migrations (version) VALUES ('39');
2294 INSERT INTO schema_migrations (version) VALUES ('4');
2296 INSERT INTO schema_migrations (version) VALUES ('40');
2298 INSERT INTO schema_migrations (version) VALUES ('41');
2300 INSERT INTO schema_migrations (version) VALUES ('42');
2302 INSERT INTO schema_migrations (version) VALUES ('43');
2304 INSERT INTO schema_migrations (version) VALUES ('44');
2306 INSERT INTO schema_migrations (version) VALUES ('45');
2308 INSERT INTO schema_migrations (version) VALUES ('46');
2310 INSERT INTO schema_migrations (version) VALUES ('47');
2312 INSERT INTO schema_migrations (version) VALUES ('48');
2314 INSERT INTO schema_migrations (version) VALUES ('49');
2316 INSERT INTO schema_migrations (version) VALUES ('5');
2318 INSERT INTO schema_migrations (version) VALUES ('50');
2320 INSERT INTO schema_migrations (version) VALUES ('51');
2322 INSERT INTO schema_migrations (version) VALUES ('52');
2324 INSERT INTO schema_migrations (version) VALUES ('6');
2326 INSERT INTO schema_migrations (version) VALUES ('7');
2328 INSERT INTO schema_migrations (version) VALUES ('8');
2330 INSERT INTO schema_migrations (version) VALUES ('9');