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
703 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -; Tablespace:
706 CREATE TABLE oauth_nonces (
708 nonce character varying(255),
710 created_at timestamp without time zone,
711 updated_at timestamp without time zone
716 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
719 CREATE SEQUENCE oauth_nonces_id_seq
728 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
731 ALTER SEQUENCE oauth_nonces_id_seq OWNED BY oauth_nonces.id;
735 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -; Tablespace:
738 CREATE TABLE oauth_tokens (
741 type character varying(20),
742 client_application_id integer,
743 token character varying(50),
744 secret character varying(50),
745 authorized_at timestamp without time zone,
746 invalidated_at timestamp without time zone,
747 created_at timestamp without time zone,
748 updated_at timestamp without time zone,
749 allow_read_prefs boolean DEFAULT false NOT NULL,
750 allow_write_prefs boolean DEFAULT false NOT NULL,
751 allow_write_diary boolean DEFAULT false NOT NULL,
752 allow_write_api boolean DEFAULT false NOT NULL,
753 allow_read_gpx boolean DEFAULT false NOT NULL,
754 allow_write_gpx boolean DEFAULT false NOT NULL,
755 callback_url character varying(255),
756 verifier character varying(20),
757 scope character varying(255),
758 valid_to timestamp without time zone
763 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
766 CREATE SEQUENCE oauth_tokens_id_seq
775 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
778 ALTER SEQUENCE oauth_tokens_id_seq OWNED BY oauth_tokens.id;
782 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -; Tablespace:
785 CREATE TABLE relation_members (
786 relation_id bigint DEFAULT 0 NOT NULL,
787 member_type nwr_enum NOT NULL,
788 member_id bigint NOT NULL,
789 member_role character varying(255) NOT NULL,
790 version bigint DEFAULT 0 NOT NULL,
791 sequence_id integer DEFAULT 0 NOT NULL
796 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
799 CREATE TABLE relation_tags (
800 relation_id bigint DEFAULT 0 NOT NULL,
801 k character varying(255) DEFAULT ''::character varying NOT NULL,
802 v character varying(255) DEFAULT ''::character varying NOT NULL,
803 version bigint NOT NULL
808 -- Name: relations; Type: TABLE; Schema: public; Owner: -; Tablespace:
811 CREATE TABLE relations (
812 relation_id bigint DEFAULT 0 NOT NULL,
813 changeset_id bigint NOT NULL,
814 "timestamp" timestamp without time zone NOT NULL,
815 version bigint NOT NULL,
816 visible boolean DEFAULT true NOT NULL
821 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace:
824 CREATE TABLE schema_migrations (
825 version character varying(255) NOT NULL
830 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -; Tablespace:
833 CREATE TABLE user_blocks (
835 user_id bigint NOT NULL,
836 creator_id bigint NOT NULL,
837 reason text NOT NULL,
838 ends_at timestamp without time zone NOT NULL,
839 needs_view boolean DEFAULT false NOT NULL,
841 created_at timestamp without time zone,
842 updated_at timestamp without time zone,
843 reason_format format_enum DEFAULT 'html'::format_enum NOT NULL
848 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
851 CREATE SEQUENCE user_blocks_id_seq
860 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
863 ALTER SEQUENCE user_blocks_id_seq OWNED BY user_blocks.id;
867 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -; Tablespace:
870 CREATE TABLE user_preferences (
871 user_id bigint NOT NULL,
872 k character varying(255) NOT NULL,
873 v character varying(255) NOT NULL
878 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -; Tablespace:
881 CREATE TABLE user_roles (
883 user_id bigint NOT NULL,
884 created_at timestamp without time zone,
885 updated_at timestamp without time zone,
886 role user_role_enum NOT NULL,
887 granter_id bigint NOT NULL
892 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
895 CREATE SEQUENCE user_roles_id_seq
904 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
907 ALTER SEQUENCE user_roles_id_seq OWNED BY user_roles.id;
911 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -; Tablespace:
914 CREATE TABLE user_tokens (
916 user_id bigint NOT NULL,
917 token character varying(255) NOT NULL,
918 expiry timestamp without time zone NOT NULL,
924 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
927 CREATE SEQUENCE user_tokens_id_seq
936 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
939 ALTER SEQUENCE user_tokens_id_seq OWNED BY user_tokens.id;
943 -- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace:
947 email character varying(255) NOT NULL,
949 pass_crypt character varying(255) NOT NULL,
950 creation_time timestamp without time zone NOT NULL,
951 display_name character varying(255) DEFAULT ''::character varying NOT NULL,
952 data_public boolean DEFAULT false NOT NULL,
953 description text DEFAULT ''::text NOT NULL,
954 home_lat double precision,
955 home_lon double precision,
956 home_zoom smallint DEFAULT 3,
957 nearby integer DEFAULT 50,
958 pass_salt character varying(255),
959 image_file_name text,
960 email_valid boolean DEFAULT false NOT NULL,
961 new_email character varying(255),
962 creation_ip character varying(255),
963 languages character varying(255),
964 status user_status_enum DEFAULT 'pending'::user_status_enum NOT NULL,
965 terms_agreed timestamp without time zone,
966 consider_pd boolean DEFAULT false NOT NULL,
967 preferred_editor character varying(255),
968 terms_seen boolean DEFAULT false NOT NULL,
969 openid_url character varying(255),
970 image_fingerprint character varying(255),
971 description_format format_enum DEFAULT 'html'::format_enum NOT NULL
976 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
979 CREATE SEQUENCE users_id_seq
988 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
991 ALTER SEQUENCE users_id_seq OWNED BY users.id;
995 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
998 CREATE TABLE way_nodes (
999 way_id bigint NOT NULL,
1000 node_id bigint NOT NULL,
1001 version bigint NOT NULL,
1002 sequence_id bigint NOT NULL
1007 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
1010 CREATE TABLE way_tags (
1011 way_id bigint DEFAULT 0 NOT NULL,
1012 k character varying(255) NOT NULL,
1013 v character varying(255) NOT NULL,
1014 version bigint NOT NULL
1019 -- Name: ways; Type: TABLE; Schema: public; Owner: -; Tablespace:
1023 way_id bigint DEFAULT 0 NOT NULL,
1024 changeset_id bigint NOT NULL,
1025 "timestamp" timestamp without time zone NOT NULL,
1026 version bigint NOT NULL,
1027 visible boolean DEFAULT true NOT NULL
1032 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1035 ALTER TABLE ONLY acls ALTER COLUMN id SET DEFAULT nextval('acls_id_seq'::regclass);
1039 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1042 ALTER TABLE ONLY changesets ALTER COLUMN id SET DEFAULT nextval('changesets_id_seq'::regclass);
1046 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1049 ALTER TABLE ONLY client_applications ALTER COLUMN id SET DEFAULT nextval('client_applications_id_seq'::regclass);
1053 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1056 ALTER TABLE ONLY countries ALTER COLUMN id SET DEFAULT nextval('countries_id_seq'::regclass);
1060 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1063 ALTER TABLE ONLY current_nodes ALTER COLUMN id SET DEFAULT nextval('current_nodes_id_seq'::regclass);
1067 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1070 ALTER TABLE ONLY current_relations ALTER COLUMN id SET DEFAULT nextval('current_relations_id_seq'::regclass);
1074 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1077 ALTER TABLE ONLY current_ways ALTER COLUMN id SET DEFAULT nextval('current_ways_id_seq'::regclass);
1081 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1084 ALTER TABLE ONLY diary_comments ALTER COLUMN id SET DEFAULT nextval('diary_comments_id_seq'::regclass);
1088 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1091 ALTER TABLE ONLY diary_entries ALTER COLUMN id SET DEFAULT nextval('diary_entries_id_seq'::regclass);
1095 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1098 ALTER TABLE ONLY friends ALTER COLUMN id SET DEFAULT nextval('friends_id_seq'::regclass);
1102 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1105 ALTER TABLE ONLY gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('gpx_file_tags_id_seq'::regclass);
1109 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1112 ALTER TABLE ONLY gpx_files ALTER COLUMN id SET DEFAULT nextval('gpx_files_id_seq'::regclass);
1116 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1119 ALTER TABLE ONLY messages ALTER COLUMN id SET DEFAULT nextval('messages_id_seq'::regclass);
1123 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1126 ALTER TABLE ONLY oauth_nonces ALTER COLUMN id SET DEFAULT nextval('oauth_nonces_id_seq'::regclass);
1130 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1133 ALTER TABLE ONLY oauth_tokens ALTER COLUMN id SET DEFAULT nextval('oauth_tokens_id_seq'::regclass);
1137 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1140 ALTER TABLE ONLY user_blocks ALTER COLUMN id SET DEFAULT nextval('user_blocks_id_seq'::regclass);
1144 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1147 ALTER TABLE ONLY user_roles ALTER COLUMN id SET DEFAULT nextval('user_roles_id_seq'::regclass);
1151 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1154 ALTER TABLE ONLY user_tokens ALTER COLUMN id SET DEFAULT nextval('user_tokens_id_seq'::regclass);
1158 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1161 ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
1165 -- Name: acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1168 ALTER TABLE ONLY acls
1169 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1173 -- Name: changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1176 ALTER TABLE ONLY changesets
1177 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1181 -- Name: client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1184 ALTER TABLE ONLY client_applications
1185 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1189 -- Name: countries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1192 ALTER TABLE ONLY countries
1193 ADD CONSTRAINT countries_pkey PRIMARY KEY (id);
1197 -- Name: current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1200 ALTER TABLE ONLY current_node_tags
1201 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1205 -- Name: current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1208 ALTER TABLE ONLY current_nodes
1209 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1213 -- Name: current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1216 ALTER TABLE ONLY current_relation_members
1217 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1221 -- Name: current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1224 ALTER TABLE ONLY current_relation_tags
1225 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1229 -- Name: current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1232 ALTER TABLE ONLY current_relations
1233 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1237 -- Name: current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1240 ALTER TABLE ONLY current_way_nodes
1241 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1245 -- Name: current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1248 ALTER TABLE ONLY current_way_tags
1249 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1253 -- Name: current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1256 ALTER TABLE ONLY current_ways
1257 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1261 -- Name: diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1264 ALTER TABLE ONLY diary_comments
1265 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1269 -- Name: diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1272 ALTER TABLE ONLY diary_entries
1273 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1277 -- Name: friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1280 ALTER TABLE ONLY friends
1281 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1285 -- Name: gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1288 ALTER TABLE ONLY gpx_file_tags
1289 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1293 -- Name: gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1296 ALTER TABLE ONLY gpx_files
1297 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1301 -- Name: languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1304 ALTER TABLE ONLY languages
1305 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1309 -- Name: messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1312 ALTER TABLE ONLY messages
1313 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1317 -- Name: node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1320 ALTER TABLE ONLY node_tags
1321 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1325 -- Name: nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1328 ALTER TABLE ONLY nodes
1329 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1333 -- Name: oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1336 ALTER TABLE ONLY oauth_nonces
1337 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1341 -- Name: oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1344 ALTER TABLE ONLY oauth_tokens
1345 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1349 -- Name: relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1352 ALTER TABLE ONLY relation_members
1353 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1357 -- Name: relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1360 ALTER TABLE ONLY relation_tags
1361 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1365 -- Name: relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1368 ALTER TABLE ONLY relations
1369 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1373 -- Name: user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1376 ALTER TABLE ONLY user_blocks
1377 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1381 -- Name: user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1384 ALTER TABLE ONLY user_preferences
1385 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1389 -- Name: user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1392 ALTER TABLE ONLY user_roles
1393 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1397 -- Name: user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1400 ALTER TABLE ONLY user_tokens
1401 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
1405 -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1408 ALTER TABLE ONLY users
1409 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
1413 -- Name: way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1416 ALTER TABLE ONLY way_nodes
1417 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
1421 -- Name: way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1424 ALTER TABLE ONLY way_tags
1425 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
1429 -- Name: ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1432 ALTER TABLE ONLY ways
1433 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
1437 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1440 CREATE INDEX acls_k_idx ON acls USING btree (k);
1444 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1447 CREATE INDEX changeset_tags_id_idx ON changeset_tags USING btree (changeset_id);
1451 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1454 CREATE INDEX changesets_bbox_idx ON changesets USING gist (min_lat, max_lat, min_lon, max_lon);
1458 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1461 CREATE INDEX changesets_closed_at_idx ON changesets USING btree (closed_at);
1465 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1468 CREATE INDEX changesets_created_at_idx ON changesets USING btree (created_at);
1472 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1475 CREATE INDEX changesets_user_id_created_at_idx ON changesets USING btree (user_id, created_at);
1479 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1482 CREATE INDEX changesets_user_id_id_idx ON changesets USING btree (user_id, id);
1486 -- Name: countries_code_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1489 CREATE UNIQUE INDEX countries_code_idx ON countries USING btree (code);
1493 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1496 CREATE INDEX current_nodes_tile_idx ON current_nodes USING btree (tile);
1500 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1503 CREATE INDEX current_nodes_timestamp_idx ON current_nodes USING btree ("timestamp");
1507 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1510 CREATE INDEX current_relation_members_member_idx ON current_relation_members USING btree (member_type, member_id);
1514 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1517 CREATE INDEX current_relations_timestamp_idx ON current_relations USING btree ("timestamp");
1521 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1524 CREATE INDEX current_way_nodes_node_idx ON current_way_nodes USING btree (node_id);
1528 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1531 CREATE INDEX current_ways_timestamp_idx ON current_ways USING btree ("timestamp");
1535 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1538 CREATE INDEX diary_comment_user_id_created_at_index ON diary_comments USING btree (user_id, created_at);
1542 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1545 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON diary_comments USING btree (diary_entry_id, id);
1549 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1552 CREATE INDEX diary_entry_created_at_index ON diary_entries USING btree (created_at);
1556 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1559 CREATE INDEX diary_entry_language_code_created_at_index ON diary_entries USING btree (language_code, created_at);
1563 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1566 CREATE INDEX diary_entry_user_id_created_at_index ON diary_entries USING btree (user_id, created_at);
1570 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1573 CREATE INDEX friends_user_id_idx ON friends USING btree (user_id);
1577 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1580 CREATE INDEX gpx_file_tags_gpxid_idx ON gpx_file_tags USING btree (gpx_id);
1584 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1587 CREATE INDEX gpx_file_tags_tag_idx ON gpx_file_tags USING btree (tag);
1591 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1594 CREATE INDEX gpx_files_timestamp_idx ON gpx_files USING btree ("timestamp");
1598 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1601 CREATE INDEX gpx_files_user_id_idx ON gpx_files USING btree (user_id);
1605 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1608 CREATE INDEX gpx_files_visible_visibility_idx ON gpx_files USING btree (visible, visibility);
1612 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -; Tablespace:
1615 CREATE UNIQUE INDEX index_client_applications_on_key ON client_applications USING btree (key);
1619 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -; Tablespace:
1622 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON oauth_nonces USING btree (nonce, "timestamp");
1626 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -; Tablespace:
1629 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON oauth_tokens USING btree (token);
1633 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1636 CREATE INDEX index_user_blocks_on_user_id ON user_blocks USING btree (user_id);
1640 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1643 CREATE INDEX messages_from_user_id_idx ON messages USING btree (from_user_id);
1647 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1650 CREATE INDEX messages_to_user_id_idx ON messages USING btree (to_user_id);
1654 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1657 CREATE INDEX nodes_changeset_id_idx ON nodes USING btree (changeset_id);
1661 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1664 CREATE INDEX nodes_tile_idx ON nodes USING btree (tile);
1668 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1671 CREATE INDEX nodes_timestamp_idx ON nodes USING btree ("timestamp");
1675 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1678 CREATE INDEX points_gpxid_idx ON gps_points USING btree (gpx_id);
1682 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1685 CREATE INDEX points_tile_idx ON gps_points USING btree (tile);
1689 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1692 CREATE INDEX relation_members_member_idx ON relation_members USING btree (member_type, member_id);
1696 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1699 CREATE INDEX relations_changeset_id_idx ON relations USING btree (changeset_id);
1703 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1706 CREATE INDEX relations_timestamp_idx ON relations USING btree ("timestamp");
1710 -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
1713 CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
1717 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1720 CREATE INDEX user_id_idx ON friends USING btree (friend_user_id);
1724 -- Name: user_openid_url_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1727 CREATE UNIQUE INDEX user_openid_url_idx ON users USING btree (openid_url);
1731 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -; Tablespace:
1734 CREATE UNIQUE INDEX user_roles_id_role_unique ON user_roles USING btree (user_id, role);
1738 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1741 CREATE UNIQUE INDEX user_tokens_token_idx ON user_tokens USING btree (token);
1745 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1748 CREATE INDEX user_tokens_user_id_idx ON user_tokens USING btree (user_id);
1752 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1755 CREATE UNIQUE INDEX users_display_name_idx ON users USING btree (display_name);
1759 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1762 CREATE INDEX users_display_name_lower_idx ON users USING btree (lower((display_name)::text));
1766 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1769 CREATE UNIQUE INDEX users_email_idx ON users USING btree (email);
1773 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1776 CREATE INDEX users_email_lower_idx ON users USING btree (lower((email)::text));
1780 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1783 CREATE INDEX way_nodes_node_idx ON way_nodes USING btree (node_id);
1787 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1790 CREATE INDEX ways_changeset_id_idx ON ways USING btree (changeset_id);
1794 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1797 CREATE INDEX ways_timestamp_idx ON ways USING btree ("timestamp");
1801 -- Name: changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1804 ALTER TABLE ONLY changeset_tags
1805 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
1809 -- Name: changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1812 ALTER TABLE ONLY changesets
1813 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1817 -- Name: client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1820 ALTER TABLE ONLY client_applications
1821 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1825 -- Name: current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1828 ALTER TABLE ONLY current_node_tags
1829 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
1833 -- Name: current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1836 ALTER TABLE ONLY current_nodes
1837 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
1841 -- Name: current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1844 ALTER TABLE ONLY current_relation_members
1845 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
1849 -- Name: current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1852 ALTER TABLE ONLY current_relation_tags
1853 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
1857 -- Name: current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1860 ALTER TABLE ONLY current_relations
1861 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
1865 -- Name: current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1868 ALTER TABLE ONLY current_way_nodes
1869 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
1873 -- Name: current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1876 ALTER TABLE ONLY current_way_nodes
1877 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
1881 -- Name: current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1884 ALTER TABLE ONLY current_way_tags
1885 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
1889 -- Name: current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1892 ALTER TABLE ONLY current_ways
1893 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
1897 -- Name: diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1900 ALTER TABLE ONLY diary_comments
1901 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES diary_entries(id);
1905 -- Name: diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1908 ALTER TABLE ONLY diary_comments
1909 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1913 -- Name: diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1916 ALTER TABLE ONLY diary_entries
1917 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES languages(code);
1921 -- Name: diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1924 ALTER TABLE ONLY diary_entries
1925 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1929 -- Name: friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1932 ALTER TABLE ONLY friends
1933 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES users(id);
1937 -- Name: friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1940 ALTER TABLE ONLY friends
1941 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1945 -- Name: gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1948 ALTER TABLE ONLY gps_points
1949 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
1953 -- Name: gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1956 ALTER TABLE ONLY gpx_file_tags
1957 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
1961 -- Name: gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1964 ALTER TABLE ONLY gpx_files
1965 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1969 -- Name: messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1972 ALTER TABLE ONLY messages
1973 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES users(id);
1977 -- Name: messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1980 ALTER TABLE ONLY messages
1981 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES users(id);
1985 -- Name: node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1988 ALTER TABLE ONLY node_tags
1989 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES nodes(node_id, version);
1993 -- Name: nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1996 ALTER TABLE ONLY nodes
1997 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2001 -- Name: oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2004 ALTER TABLE ONLY oauth_tokens
2005 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES client_applications(id);
2009 -- Name: oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2012 ALTER TABLE ONLY oauth_tokens
2013 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2017 -- Name: relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2020 ALTER TABLE ONLY relation_members
2021 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2025 -- Name: relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2028 ALTER TABLE ONLY relation_tags
2029 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2033 -- Name: relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2036 ALTER TABLE ONLY relations
2037 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2041 -- Name: user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2044 ALTER TABLE ONLY user_blocks
2045 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES users(id);
2049 -- Name: user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2052 ALTER TABLE ONLY user_blocks
2053 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES users(id);
2057 -- Name: user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2060 ALTER TABLE ONLY user_blocks
2061 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2065 -- Name: user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2068 ALTER TABLE ONLY user_preferences
2069 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2073 -- Name: user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2076 ALTER TABLE ONLY user_roles
2077 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES users(id);
2081 -- Name: user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2084 ALTER TABLE ONLY user_roles
2085 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2089 -- Name: user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2092 ALTER TABLE ONLY user_tokens
2093 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2097 -- Name: way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2100 ALTER TABLE ONLY way_nodes
2101 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2105 -- Name: way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2108 ALTER TABLE ONLY way_tags
2109 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2113 -- Name: ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2116 ALTER TABLE ONLY ways
2117 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2121 -- PostgreSQL database dump complete
2124 INSERT INTO schema_migrations (version) VALUES ('1');
2126 INSERT INTO schema_migrations (version) VALUES ('10');
2128 INSERT INTO schema_migrations (version) VALUES ('11');
2130 INSERT INTO schema_migrations (version) VALUES ('12');
2132 INSERT INTO schema_migrations (version) VALUES ('13');
2134 INSERT INTO schema_migrations (version) VALUES ('14');
2136 INSERT INTO schema_migrations (version) VALUES ('15');
2138 INSERT INTO schema_migrations (version) VALUES ('16');
2140 INSERT INTO schema_migrations (version) VALUES ('17');
2142 INSERT INTO schema_migrations (version) VALUES ('18');
2144 INSERT INTO schema_migrations (version) VALUES ('19');
2146 INSERT INTO schema_migrations (version) VALUES ('2');
2148 INSERT INTO schema_migrations (version) VALUES ('20');
2150 INSERT INTO schema_migrations (version) VALUES ('20100513171259');
2152 INSERT INTO schema_migrations (version) VALUES ('20100516124737');
2154 INSERT INTO schema_migrations (version) VALUES ('20100910084426');
2156 INSERT INTO schema_migrations (version) VALUES ('20101114011429');
2158 INSERT INTO schema_migrations (version) VALUES ('20110322001319');
2160 INSERT INTO schema_migrations (version) VALUES ('20110925112722');
2162 INSERT INTO schema_migrations (version) VALUES ('20111116184519');
2164 INSERT INTO schema_migrations (version) VALUES ('20111212183945');
2166 INSERT INTO schema_migrations (version) VALUES ('20120123184321');
2168 INSERT INTO schema_migrations (version) VALUES ('20120208122334');
2170 INSERT INTO schema_migrations (version) VALUES ('20120208194454');
2172 INSERT INTO schema_migrations (version) VALUES ('20120214210114');
2174 INSERT INTO schema_migrations (version) VALUES ('20120219161649');
2176 INSERT INTO schema_migrations (version) VALUES ('20120328090602');
2178 INSERT INTO schema_migrations (version) VALUES ('21');
2180 INSERT INTO schema_migrations (version) VALUES ('22');
2182 INSERT INTO schema_migrations (version) VALUES ('23');
2184 INSERT INTO schema_migrations (version) VALUES ('24');
2186 INSERT INTO schema_migrations (version) VALUES ('25');
2188 INSERT INTO schema_migrations (version) VALUES ('26');
2190 INSERT INTO schema_migrations (version) VALUES ('27');
2192 INSERT INTO schema_migrations (version) VALUES ('28');
2194 INSERT INTO schema_migrations (version) VALUES ('29');
2196 INSERT INTO schema_migrations (version) VALUES ('3');
2198 INSERT INTO schema_migrations (version) VALUES ('30');
2200 INSERT INTO schema_migrations (version) VALUES ('31');
2202 INSERT INTO schema_migrations (version) VALUES ('32');
2204 INSERT INTO schema_migrations (version) VALUES ('33');
2206 INSERT INTO schema_migrations (version) VALUES ('34');
2208 INSERT INTO schema_migrations (version) VALUES ('35');
2210 INSERT INTO schema_migrations (version) VALUES ('36');
2212 INSERT INTO schema_migrations (version) VALUES ('37');
2214 INSERT INTO schema_migrations (version) VALUES ('38');
2216 INSERT INTO schema_migrations (version) VALUES ('39');
2218 INSERT INTO schema_migrations (version) VALUES ('4');
2220 INSERT INTO schema_migrations (version) VALUES ('40');
2222 INSERT INTO schema_migrations (version) VALUES ('41');
2224 INSERT INTO schema_migrations (version) VALUES ('42');
2226 INSERT INTO schema_migrations (version) VALUES ('43');
2228 INSERT INTO schema_migrations (version) VALUES ('44');
2230 INSERT INTO schema_migrations (version) VALUES ('45');
2232 INSERT INTO schema_migrations (version) VALUES ('46');
2234 INSERT INTO schema_migrations (version) VALUES ('47');
2236 INSERT INTO schema_migrations (version) VALUES ('48');
2238 INSERT INTO schema_migrations (version) VALUES ('49');
2240 INSERT INTO schema_migrations (version) VALUES ('5');
2242 INSERT INTO schema_migrations (version) VALUES ('50');
2244 INSERT INTO schema_migrations (version) VALUES ('51');
2246 INSERT INTO schema_migrations (version) VALUES ('52');
2248 INSERT INTO schema_migrations (version) VALUES ('6');
2250 INSERT INTO schema_migrations (version) VALUES ('7');
2252 INSERT INTO schema_migrations (version) VALUES ('8');
2254 INSERT INTO schema_migrations (version) VALUES ('9');