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 (
52 -- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: -
55 CREATE TYPE gpx_visibility_enum AS ENUM (
64 -- Name: nwr_enum; Type: TYPE; Schema: public; Owner: -
67 CREATE TYPE nwr_enum AS ENUM (
75 -- Name: user_role_enum; Type: TYPE; Schema: public; Owner: -
78 CREATE TYPE user_role_enum AS ENUM (
85 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
88 CREATE TYPE user_status_enum AS ENUM (
98 -- Name: maptile_for_point(bigint, bigint, integer); Type: FUNCTION; Schema: public; Owner: -
101 CREATE FUNCTION maptile_for_point(bigint, bigint, integer) RETURNS integer
103 AS '/srv/www/next.osm.compton.nu/db/functions/libpgosm.so', 'maptile_for_point';
107 -- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
110 CREATE FUNCTION tile_for_point(integer, integer) RETURNS bigint
112 AS '/srv/www/next.osm.compton.nu/db/functions/libpgosm.so', 'tile_for_point';
116 -- Name: xid_to_int4(xid); Type: FUNCTION; Schema: public; Owner: -
119 CREATE FUNCTION xid_to_int4(xid) RETURNS integer
120 LANGUAGE c IMMUTABLE STRICT
121 AS '/srv/www/next.osm.compton.nu/db/functions/libpgosm.so', 'xid_to_int4';
124 SET default_tablespace = '';
126 SET default_with_oids = false;
129 -- Name: acls; Type: TABLE; Schema: public; Owner: -; Tablespace:
135 k character varying(255) NOT NULL,
136 v character varying(255),
137 domain character varying(255)
142 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
145 CREATE SEQUENCE acls_id_seq
154 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
157 ALTER SEQUENCE acls_id_seq OWNED BY acls.id;
161 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
164 CREATE TABLE changeset_tags (
165 changeset_id bigint NOT NULL,
166 k character varying(255) DEFAULT ''::character varying NOT NULL,
167 v character varying(255) DEFAULT ''::character varying NOT NULL
172 -- Name: changesets; Type: TABLE; Schema: public; Owner: -; Tablespace:
175 CREATE TABLE changesets (
177 user_id bigint NOT NULL,
178 created_at timestamp without time zone NOT NULL,
183 closed_at timestamp without time zone NOT NULL,
184 num_changes integer DEFAULT 0 NOT NULL
189 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
192 CREATE SEQUENCE changesets_id_seq
201 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
204 ALTER SEQUENCE changesets_id_seq OWNED BY changesets.id;
208 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -; Tablespace:
211 CREATE TABLE client_applications (
213 name character varying(255),
214 url character varying(255),
215 support_url character varying(255),
216 callback_url character varying(255),
217 key character varying(50),
218 secret character varying(50),
220 created_at timestamp without time zone,
221 updated_at timestamp without time zone,
222 allow_read_prefs boolean DEFAULT false NOT NULL,
223 allow_write_prefs boolean DEFAULT false NOT NULL,
224 allow_write_diary boolean DEFAULT false NOT NULL,
225 allow_write_api boolean DEFAULT false NOT NULL,
226 allow_read_gpx boolean DEFAULT false NOT NULL,
227 allow_write_gpx boolean DEFAULT false NOT NULL
232 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
235 CREATE SEQUENCE client_applications_id_seq
244 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
247 ALTER SEQUENCE client_applications_id_seq OWNED BY client_applications.id;
251 -- Name: countries; Type: TABLE; Schema: public; Owner: -; Tablespace:
254 CREATE TABLE countries (
256 code character varying(2) NOT NULL,
257 min_lat double precision NOT NULL,
258 max_lat double precision NOT NULL,
259 min_lon double precision NOT NULL,
260 max_lon double precision NOT NULL
265 -- Name: countries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
268 CREATE SEQUENCE countries_id_seq
277 -- Name: countries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
280 ALTER SEQUENCE countries_id_seq OWNED BY countries.id;
284 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
287 CREATE TABLE current_node_tags (
288 node_id bigint NOT NULL,
289 k character varying(255) DEFAULT ''::character varying NOT NULL,
290 v character varying(255) DEFAULT ''::character varying NOT NULL
295 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
298 CREATE TABLE current_nodes (
300 latitude integer NOT NULL,
301 longitude integer NOT NULL,
302 changeset_id bigint NOT NULL,
303 visible boolean NOT NULL,
304 "timestamp" timestamp without time zone NOT NULL,
305 tile bigint NOT NULL,
306 version bigint NOT NULL
311 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
314 CREATE SEQUENCE current_nodes_id_seq
323 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
326 ALTER SEQUENCE current_nodes_id_seq OWNED BY current_nodes.id;
330 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -; Tablespace:
333 CREATE TABLE current_relation_members (
334 relation_id bigint NOT NULL,
335 member_type nwr_enum NOT NULL,
336 member_id bigint NOT NULL,
337 member_role character varying(255) NOT NULL,
338 sequence_id integer DEFAULT 0 NOT NULL
343 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
346 CREATE TABLE current_relation_tags (
347 relation_id bigint NOT NULL,
348 k character varying(255) DEFAULT ''::character varying NOT NULL,
349 v character varying(255) DEFAULT ''::character varying NOT NULL
354 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -; Tablespace:
357 CREATE TABLE current_relations (
359 changeset_id bigint NOT NULL,
360 "timestamp" timestamp without time zone NOT NULL,
361 visible boolean NOT NULL,
362 version bigint NOT NULL
367 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
370 CREATE SEQUENCE current_relations_id_seq
379 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
382 ALTER SEQUENCE current_relations_id_seq OWNED BY current_relations.id;
386 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
389 CREATE TABLE current_way_nodes (
390 way_id bigint NOT NULL,
391 node_id bigint NOT NULL,
392 sequence_id bigint NOT NULL
397 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
400 CREATE TABLE current_way_tags (
401 way_id bigint NOT NULL,
402 k character varying(255) DEFAULT ''::character varying NOT NULL,
403 v character varying(255) DEFAULT ''::character varying NOT NULL
408 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -; Tablespace:
411 CREATE TABLE current_ways (
413 changeset_id bigint NOT NULL,
414 "timestamp" timestamp without time zone NOT NULL,
415 visible boolean NOT NULL,
416 version bigint NOT NULL
421 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
424 CREATE SEQUENCE current_ways_id_seq
433 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
436 ALTER SEQUENCE current_ways_id_seq OWNED BY current_ways.id;
440 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -; Tablespace:
443 CREATE TABLE diary_comments (
445 diary_entry_id bigint NOT NULL,
446 user_id bigint NOT NULL,
448 created_at timestamp without time zone NOT NULL,
449 updated_at timestamp without time zone NOT NULL,
450 visible boolean DEFAULT true NOT NULL,
451 body_format format_enum DEFAULT 'html'::format_enum NOT NULL
456 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
459 CREATE SEQUENCE diary_comments_id_seq
468 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
471 ALTER SEQUENCE diary_comments_id_seq OWNED BY diary_comments.id;
475 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -; Tablespace:
478 CREATE TABLE diary_entries (
480 user_id bigint NOT NULL,
481 title character varying(255) NOT NULL,
483 created_at timestamp without time zone NOT NULL,
484 updated_at timestamp without time zone NOT NULL,
485 latitude double precision,
486 longitude double precision,
487 language_code character varying(255) DEFAULT 'en'::character varying NOT NULL,
488 visible boolean DEFAULT true NOT NULL,
489 body_format format_enum DEFAULT 'html'::format_enum NOT NULL
494 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
497 CREATE SEQUENCE diary_entries_id_seq
506 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
509 ALTER SEQUENCE diary_entries_id_seq OWNED BY diary_entries.id;
513 -- Name: friends; Type: TABLE; Schema: public; Owner: -; Tablespace:
516 CREATE TABLE friends (
518 user_id bigint NOT NULL,
519 friend_user_id bigint NOT NULL
524 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
527 CREATE SEQUENCE friends_id_seq
536 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
539 ALTER SEQUENCE friends_id_seq OWNED BY friends.id;
543 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -; Tablespace:
546 CREATE TABLE gps_points (
547 altitude double precision,
548 trackid integer NOT NULL,
549 latitude integer NOT NULL,
550 longitude integer NOT NULL,
551 gpx_id bigint NOT NULL,
552 "timestamp" timestamp without time zone,
558 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
561 CREATE TABLE gpx_file_tags (
562 gpx_id bigint DEFAULT 0 NOT NULL,
563 tag character varying(255) NOT NULL,
569 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
572 CREATE SEQUENCE gpx_file_tags_id_seq
581 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
584 ALTER SEQUENCE gpx_file_tags_id_seq OWNED BY gpx_file_tags.id;
588 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -; Tablespace:
591 CREATE TABLE gpx_files (
593 user_id bigint NOT NULL,
594 visible boolean DEFAULT true NOT NULL,
595 name character varying(255) DEFAULT ''::character varying NOT NULL,
597 latitude double precision,
598 longitude double precision,
599 "timestamp" timestamp without time zone NOT NULL,
600 description character varying(255) DEFAULT ''::character varying NOT NULL,
601 inserted boolean NOT NULL,
602 visibility gpx_visibility_enum DEFAULT 'public'::gpx_visibility_enum NOT NULL
607 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
610 CREATE SEQUENCE gpx_files_id_seq
619 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
622 ALTER SEQUENCE gpx_files_id_seq OWNED BY gpx_files.id;
626 -- Name: languages; Type: TABLE; Schema: public; Owner: -; Tablespace:
629 CREATE TABLE languages (
630 code character varying(255) NOT NULL,
631 english_name character varying(255) NOT NULL,
632 native_name character varying(255)
637 -- Name: messages; Type: TABLE; Schema: public; Owner: -; Tablespace:
640 CREATE TABLE messages (
642 from_user_id bigint NOT NULL,
643 title character varying(255) NOT NULL,
645 sent_on timestamp without time zone NOT NULL,
646 message_read boolean DEFAULT false NOT NULL,
647 to_user_id bigint NOT NULL,
648 to_user_visible boolean DEFAULT true NOT NULL,
649 from_user_visible boolean DEFAULT true NOT NULL,
650 body_format format_enum DEFAULT 'html'::format_enum NOT NULL
655 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
658 CREATE SEQUENCE messages_id_seq
667 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
670 ALTER SEQUENCE messages_id_seq OWNED BY messages.id;
674 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
677 CREATE TABLE node_tags (
678 node_id bigint NOT NULL,
679 version bigint NOT NULL,
680 k character varying(255) DEFAULT ''::character varying NOT NULL,
681 v character varying(255) DEFAULT ''::character varying NOT NULL
686 -- Name: nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
690 node_id bigint NOT NULL,
691 latitude integer NOT NULL,
692 longitude integer NOT NULL,
693 changeset_id bigint NOT NULL,
694 visible boolean NOT NULL,
695 "timestamp" timestamp without time zone NOT NULL,
696 tile bigint NOT NULL,
697 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: redactions; Type: TABLE; Schema: public; Owner: -; Tablespace:
785 CREATE TABLE redactions (
787 title character varying(255),
789 created_at timestamp without time zone NOT NULL,
790 updated_at timestamp without time zone NOT NULL,
791 user_id bigint NOT NULL,
792 description_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
797 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
800 CREATE SEQUENCE redactions_id_seq
809 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
812 ALTER SEQUENCE redactions_id_seq OWNED BY redactions.id;
816 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -; Tablespace:
819 CREATE TABLE relation_members (
820 relation_id bigint DEFAULT 0 NOT NULL,
821 member_type nwr_enum NOT NULL,
822 member_id bigint NOT NULL,
823 member_role character varying(255) NOT NULL,
824 version bigint DEFAULT 0 NOT NULL,
825 sequence_id integer DEFAULT 0 NOT NULL
830 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
833 CREATE TABLE relation_tags (
834 relation_id bigint DEFAULT 0 NOT NULL,
835 k character varying(255) DEFAULT ''::character varying NOT NULL,
836 v character varying(255) DEFAULT ''::character varying NOT NULL,
837 version bigint NOT NULL
842 -- Name: relations; Type: TABLE; Schema: public; Owner: -; Tablespace:
845 CREATE TABLE relations (
846 relation_id bigint DEFAULT 0 NOT NULL,
847 changeset_id bigint NOT NULL,
848 "timestamp" timestamp without time zone NOT NULL,
849 version bigint NOT NULL,
850 visible boolean DEFAULT true NOT NULL,
856 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace:
859 CREATE TABLE schema_migrations (
860 version character varying(255) NOT NULL
865 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -; Tablespace:
868 CREATE TABLE user_blocks (
870 user_id bigint NOT NULL,
871 creator_id bigint NOT NULL,
872 reason text NOT NULL,
873 ends_at timestamp without time zone NOT NULL,
874 needs_view boolean DEFAULT false NOT NULL,
876 created_at timestamp without time zone,
877 updated_at timestamp without time zone,
878 reason_format format_enum DEFAULT 'html'::format_enum NOT NULL
883 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
886 CREATE SEQUENCE user_blocks_id_seq
895 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
898 ALTER SEQUENCE user_blocks_id_seq OWNED BY user_blocks.id;
902 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -; Tablespace:
905 CREATE TABLE user_preferences (
906 user_id bigint NOT NULL,
907 k character varying(255) NOT NULL,
908 v character varying(255) NOT NULL
913 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -; Tablespace:
916 CREATE TABLE user_roles (
918 user_id bigint NOT NULL,
919 created_at timestamp without time zone,
920 updated_at timestamp without time zone,
921 role user_role_enum NOT NULL,
922 granter_id bigint NOT NULL
927 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
930 CREATE SEQUENCE user_roles_id_seq
939 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
942 ALTER SEQUENCE user_roles_id_seq OWNED BY user_roles.id;
946 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -; Tablespace:
949 CREATE TABLE user_tokens (
951 user_id bigint NOT NULL,
952 token character varying(255) NOT NULL,
953 expiry timestamp without time zone NOT NULL,
959 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
962 CREATE SEQUENCE user_tokens_id_seq
971 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
974 ALTER SEQUENCE user_tokens_id_seq OWNED BY user_tokens.id;
978 -- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace:
982 email character varying(255) NOT NULL,
984 pass_crypt character varying(255) NOT NULL,
985 creation_time timestamp without time zone NOT NULL,
986 display_name character varying(255) DEFAULT ''::character varying NOT NULL,
987 data_public boolean DEFAULT false NOT NULL,
988 description text DEFAULT ''::text NOT NULL,
989 home_lat double precision,
990 home_lon double precision,
991 home_zoom smallint DEFAULT 3,
992 nearby integer DEFAULT 50,
993 pass_salt character varying(255),
994 image_file_name text,
995 email_valid boolean DEFAULT false NOT NULL,
996 new_email character varying(255),
997 creation_ip character varying(255),
998 languages character varying(255),
999 status user_status_enum DEFAULT 'pending'::user_status_enum NOT NULL,
1000 terms_agreed timestamp without time zone,
1001 consider_pd boolean DEFAULT false NOT NULL,
1002 openid_url character varying(255),
1003 preferred_editor character varying(255),
1004 terms_seen boolean DEFAULT false NOT NULL,
1005 image_fingerprint character varying(255),
1006 description_format format_enum DEFAULT 'html'::format_enum NOT NULL,
1007 changesets_count integer DEFAULT 0 NOT NULL,
1008 traces_count integer DEFAULT 0 NOT NULL,
1009 diary_entries_count integer DEFAULT 0 NOT NULL,
1010 image_use_gravatar boolean DEFAULT true NOT NULL
1015 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1018 CREATE SEQUENCE users_id_seq
1027 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1030 ALTER SEQUENCE users_id_seq OWNED BY users.id;
1034 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
1037 CREATE TABLE way_nodes (
1038 way_id bigint NOT NULL,
1039 node_id bigint NOT NULL,
1040 version bigint NOT NULL,
1041 sequence_id bigint NOT NULL
1046 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
1049 CREATE TABLE way_tags (
1050 way_id bigint DEFAULT 0 NOT NULL,
1051 k character varying(255) NOT NULL,
1052 v character varying(255) NOT NULL,
1053 version bigint NOT NULL
1058 -- Name: ways; Type: TABLE; Schema: public; Owner: -; Tablespace:
1062 way_id bigint DEFAULT 0 NOT NULL,
1063 changeset_id bigint NOT NULL,
1064 "timestamp" timestamp without time zone NOT NULL,
1065 version bigint NOT NULL,
1066 visible boolean DEFAULT true NOT NULL,
1067 redaction_id integer
1072 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1075 ALTER TABLE ONLY acls ALTER COLUMN id SET DEFAULT nextval('acls_id_seq'::regclass);
1079 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1082 ALTER TABLE ONLY changesets ALTER COLUMN id SET DEFAULT nextval('changesets_id_seq'::regclass);
1086 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1089 ALTER TABLE ONLY client_applications ALTER COLUMN id SET DEFAULT nextval('client_applications_id_seq'::regclass);
1093 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1096 ALTER TABLE ONLY countries ALTER COLUMN id SET DEFAULT nextval('countries_id_seq'::regclass);
1100 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1103 ALTER TABLE ONLY current_nodes ALTER COLUMN id SET DEFAULT nextval('current_nodes_id_seq'::regclass);
1107 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1110 ALTER TABLE ONLY current_relations ALTER COLUMN id SET DEFAULT nextval('current_relations_id_seq'::regclass);
1114 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1117 ALTER TABLE ONLY current_ways ALTER COLUMN id SET DEFAULT nextval('current_ways_id_seq'::regclass);
1121 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1124 ALTER TABLE ONLY diary_comments ALTER COLUMN id SET DEFAULT nextval('diary_comments_id_seq'::regclass);
1128 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1131 ALTER TABLE ONLY diary_entries ALTER COLUMN id SET DEFAULT nextval('diary_entries_id_seq'::regclass);
1135 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1138 ALTER TABLE ONLY friends ALTER COLUMN id SET DEFAULT nextval('friends_id_seq'::regclass);
1142 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1145 ALTER TABLE ONLY gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('gpx_file_tags_id_seq'::regclass);
1149 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1152 ALTER TABLE ONLY gpx_files ALTER COLUMN id SET DEFAULT nextval('gpx_files_id_seq'::regclass);
1156 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1159 ALTER TABLE ONLY messages ALTER COLUMN id SET DEFAULT nextval('messages_id_seq'::regclass);
1163 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1166 ALTER TABLE ONLY oauth_nonces ALTER COLUMN id SET DEFAULT nextval('oauth_nonces_id_seq'::regclass);
1170 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1173 ALTER TABLE ONLY oauth_tokens ALTER COLUMN id SET DEFAULT nextval('oauth_tokens_id_seq'::regclass);
1177 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1180 ALTER TABLE ONLY redactions ALTER COLUMN id SET DEFAULT nextval('redactions_id_seq'::regclass);
1184 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1187 ALTER TABLE ONLY user_blocks ALTER COLUMN id SET DEFAULT nextval('user_blocks_id_seq'::regclass);
1191 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1194 ALTER TABLE ONLY user_roles ALTER COLUMN id SET DEFAULT nextval('user_roles_id_seq'::regclass);
1198 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1201 ALTER TABLE ONLY user_tokens ALTER COLUMN id SET DEFAULT nextval('user_tokens_id_seq'::regclass);
1205 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1208 ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
1212 -- Name: acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1215 ALTER TABLE ONLY acls
1216 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1220 -- Name: changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1223 ALTER TABLE ONLY changesets
1224 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1228 -- Name: client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1231 ALTER TABLE ONLY client_applications
1232 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1236 -- Name: countries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1239 ALTER TABLE ONLY countries
1240 ADD CONSTRAINT countries_pkey PRIMARY KEY (id);
1244 -- Name: current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1247 ALTER TABLE ONLY current_node_tags
1248 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1252 -- Name: current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1255 ALTER TABLE ONLY current_nodes
1256 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1260 -- Name: current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1263 ALTER TABLE ONLY current_relation_members
1264 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1268 -- Name: current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1271 ALTER TABLE ONLY current_relation_tags
1272 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1276 -- Name: current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1279 ALTER TABLE ONLY current_relations
1280 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1284 -- Name: current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1287 ALTER TABLE ONLY current_way_nodes
1288 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1292 -- Name: current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1295 ALTER TABLE ONLY current_way_tags
1296 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1300 -- Name: current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1303 ALTER TABLE ONLY current_ways
1304 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1308 -- Name: diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1311 ALTER TABLE ONLY diary_comments
1312 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1316 -- Name: diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1319 ALTER TABLE ONLY diary_entries
1320 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1324 -- Name: friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1327 ALTER TABLE ONLY friends
1328 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1332 -- Name: gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1335 ALTER TABLE ONLY gpx_file_tags
1336 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1340 -- Name: gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1343 ALTER TABLE ONLY gpx_files
1344 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1348 -- Name: languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1351 ALTER TABLE ONLY languages
1352 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1356 -- Name: messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1359 ALTER TABLE ONLY messages
1360 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1364 -- Name: node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1367 ALTER TABLE ONLY node_tags
1368 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1372 -- Name: nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1375 ALTER TABLE ONLY nodes
1376 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1380 -- Name: oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1383 ALTER TABLE ONLY oauth_nonces
1384 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1388 -- Name: oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1391 ALTER TABLE ONLY oauth_tokens
1392 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1396 -- Name: redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1399 ALTER TABLE ONLY redactions
1400 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1404 -- Name: relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1407 ALTER TABLE ONLY relation_members
1408 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1412 -- Name: relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1415 ALTER TABLE ONLY relation_tags
1416 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1420 -- Name: relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1423 ALTER TABLE ONLY relations
1424 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1428 -- Name: user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1431 ALTER TABLE ONLY user_blocks
1432 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1436 -- Name: user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1439 ALTER TABLE ONLY user_preferences
1440 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1444 -- Name: user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1447 ALTER TABLE ONLY user_roles
1448 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1452 -- Name: user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1455 ALTER TABLE ONLY user_tokens
1456 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
1460 -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1463 ALTER TABLE ONLY users
1464 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
1468 -- Name: way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1471 ALTER TABLE ONLY way_nodes
1472 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
1476 -- Name: way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1479 ALTER TABLE ONLY way_tags
1480 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
1484 -- Name: ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1487 ALTER TABLE ONLY ways
1488 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
1492 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1495 CREATE INDEX acls_k_idx ON acls USING btree (k);
1499 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1502 CREATE INDEX changeset_tags_id_idx ON changeset_tags USING btree (changeset_id);
1506 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1509 CREATE INDEX changesets_bbox_idx ON changesets USING gist (min_lat, max_lat, min_lon, max_lon);
1513 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1516 CREATE INDEX changesets_closed_at_idx ON changesets USING btree (closed_at);
1520 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1523 CREATE INDEX changesets_created_at_idx ON changesets USING btree (created_at);
1527 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1530 CREATE INDEX changesets_user_id_created_at_idx ON changesets USING btree (user_id, created_at);
1534 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1537 CREATE INDEX changesets_user_id_id_idx ON changesets USING btree (user_id, id);
1541 -- Name: countries_code_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1544 CREATE UNIQUE INDEX countries_code_idx ON countries USING btree (code);
1548 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1551 CREATE INDEX current_nodes_tile_idx ON current_nodes USING btree (tile);
1555 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1558 CREATE INDEX current_nodes_timestamp_idx ON current_nodes USING btree ("timestamp");
1562 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1565 CREATE INDEX current_relation_members_member_idx ON current_relation_members USING btree (member_type, member_id);
1569 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1572 CREATE INDEX current_relations_timestamp_idx ON current_relations USING btree ("timestamp");
1576 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1579 CREATE INDEX current_way_nodes_node_idx ON current_way_nodes USING btree (node_id);
1583 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1586 CREATE INDEX current_ways_timestamp_idx ON current_ways USING btree ("timestamp");
1590 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1593 CREATE INDEX diary_comment_user_id_created_at_index ON diary_comments USING btree (user_id, created_at);
1597 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1600 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON diary_comments USING btree (diary_entry_id, id);
1604 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1607 CREATE INDEX diary_entry_created_at_index ON diary_entries USING btree (created_at);
1611 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1614 CREATE INDEX diary_entry_language_code_created_at_index ON diary_entries USING btree (language_code, created_at);
1618 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1621 CREATE INDEX diary_entry_user_id_created_at_index ON diary_entries USING btree (user_id, created_at);
1625 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1628 CREATE INDEX friends_user_id_idx ON friends USING btree (user_id);
1632 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1635 CREATE INDEX gpx_file_tags_gpxid_idx ON gpx_file_tags USING btree (gpx_id);
1639 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1642 CREATE INDEX gpx_file_tags_tag_idx ON gpx_file_tags USING btree (tag);
1646 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1649 CREATE INDEX gpx_files_timestamp_idx ON gpx_files USING btree ("timestamp");
1653 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1656 CREATE INDEX gpx_files_user_id_idx ON gpx_files USING btree (user_id);
1660 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1663 CREATE INDEX gpx_files_visible_visibility_idx ON gpx_files USING btree (visible, visibility);
1667 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -; Tablespace:
1670 CREATE UNIQUE INDEX index_client_applications_on_key ON client_applications USING btree (key);
1674 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -; Tablespace:
1677 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON oauth_nonces USING btree (nonce, "timestamp");
1681 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -; Tablespace:
1684 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON oauth_tokens USING btree (token);
1688 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1691 CREATE INDEX index_user_blocks_on_user_id ON user_blocks USING btree (user_id);
1695 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1698 CREATE INDEX messages_from_user_id_idx ON messages USING btree (from_user_id);
1702 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1705 CREATE INDEX messages_to_user_id_idx ON messages USING btree (to_user_id);
1709 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1712 CREATE INDEX nodes_changeset_id_idx ON nodes USING btree (changeset_id);
1716 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1719 CREATE INDEX nodes_tile_idx ON nodes USING btree (tile);
1723 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1726 CREATE INDEX nodes_timestamp_idx ON nodes USING btree ("timestamp");
1730 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1733 CREATE INDEX points_gpxid_idx ON gps_points USING btree (gpx_id);
1737 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1740 CREATE INDEX points_tile_idx ON gps_points USING btree (tile);
1744 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1747 CREATE INDEX relation_members_member_idx ON relation_members USING btree (member_type, member_id);
1751 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1754 CREATE INDEX relations_changeset_id_idx ON relations USING btree (changeset_id);
1758 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1761 CREATE INDEX relations_timestamp_idx ON relations USING btree ("timestamp");
1765 -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
1768 CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
1772 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1775 CREATE INDEX user_id_idx ON friends USING btree (friend_user_id);
1779 -- Name: user_openid_url_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1782 CREATE UNIQUE INDEX user_openid_url_idx ON users USING btree (openid_url);
1786 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -; Tablespace:
1789 CREATE UNIQUE INDEX user_roles_id_role_unique ON user_roles USING btree (user_id, role);
1793 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1796 CREATE UNIQUE INDEX user_tokens_token_idx ON user_tokens USING btree (token);
1800 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1803 CREATE INDEX user_tokens_user_id_idx ON user_tokens USING btree (user_id);
1807 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1810 CREATE UNIQUE INDEX users_display_name_idx ON users USING btree (display_name);
1814 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1817 CREATE INDEX users_display_name_lower_idx ON users USING btree (lower((display_name)::text));
1821 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1824 CREATE UNIQUE INDEX users_email_idx ON users USING btree (email);
1828 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1831 CREATE INDEX users_email_lower_idx ON users USING btree (lower((email)::text));
1835 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1838 CREATE INDEX way_nodes_node_idx ON way_nodes USING btree (node_id);
1842 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1845 CREATE INDEX ways_changeset_id_idx ON ways USING btree (changeset_id);
1849 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1852 CREATE INDEX ways_timestamp_idx ON ways USING btree ("timestamp");
1856 -- Name: changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1859 ALTER TABLE ONLY changeset_tags
1860 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
1864 -- Name: changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1867 ALTER TABLE ONLY changesets
1868 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1872 -- Name: client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1875 ALTER TABLE ONLY client_applications
1876 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1880 -- Name: current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1883 ALTER TABLE ONLY current_node_tags
1884 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
1888 -- Name: current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1891 ALTER TABLE ONLY current_nodes
1892 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
1896 -- Name: current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1899 ALTER TABLE ONLY current_relation_members
1900 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
1904 -- Name: current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1907 ALTER TABLE ONLY current_relation_tags
1908 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
1912 -- Name: current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1915 ALTER TABLE ONLY current_relations
1916 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
1920 -- Name: current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1923 ALTER TABLE ONLY current_way_nodes
1924 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
1928 -- Name: current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1931 ALTER TABLE ONLY current_way_nodes
1932 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
1936 -- Name: current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1939 ALTER TABLE ONLY current_way_tags
1940 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
1944 -- Name: current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1947 ALTER TABLE ONLY current_ways
1948 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
1952 -- Name: diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1955 ALTER TABLE ONLY diary_comments
1956 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES diary_entries(id);
1960 -- Name: diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1963 ALTER TABLE ONLY diary_comments
1964 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1968 -- Name: diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1971 ALTER TABLE ONLY diary_entries
1972 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES languages(code);
1976 -- Name: diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1979 ALTER TABLE ONLY diary_entries
1980 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1984 -- Name: friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1987 ALTER TABLE ONLY friends
1988 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES users(id);
1992 -- Name: friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1995 ALTER TABLE ONLY friends
1996 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2000 -- Name: gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2003 ALTER TABLE ONLY gps_points
2004 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
2008 -- Name: gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2011 ALTER TABLE ONLY gpx_file_tags
2012 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
2016 -- Name: gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2019 ALTER TABLE ONLY gpx_files
2020 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2024 -- Name: messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2027 ALTER TABLE ONLY messages
2028 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES users(id);
2032 -- Name: messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2035 ALTER TABLE ONLY messages
2036 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES users(id);
2040 -- Name: node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2043 ALTER TABLE ONLY node_tags
2044 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES nodes(node_id, version);
2048 -- Name: nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2051 ALTER TABLE ONLY nodes
2052 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2056 -- Name: nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2059 ALTER TABLE ONLY nodes
2060 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2064 -- Name: oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2067 ALTER TABLE ONLY oauth_tokens
2068 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES client_applications(id);
2072 -- Name: oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2075 ALTER TABLE ONLY oauth_tokens
2076 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2080 -- Name: redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2083 ALTER TABLE ONLY redactions
2084 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2088 -- Name: relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2091 ALTER TABLE ONLY relation_members
2092 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2096 -- Name: relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2099 ALTER TABLE ONLY relation_tags
2100 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2104 -- Name: relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2107 ALTER TABLE ONLY relations
2108 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2112 -- Name: relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2115 ALTER TABLE ONLY relations
2116 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2120 -- Name: user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2123 ALTER TABLE ONLY user_blocks
2124 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES users(id);
2128 -- Name: user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2131 ALTER TABLE ONLY user_blocks
2132 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES users(id);
2136 -- Name: user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2139 ALTER TABLE ONLY user_blocks
2140 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2144 -- Name: user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2147 ALTER TABLE ONLY user_preferences
2148 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2152 -- Name: user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2155 ALTER TABLE ONLY user_roles
2156 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES users(id);
2160 -- Name: user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2163 ALTER TABLE ONLY user_roles
2164 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2168 -- Name: user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2171 ALTER TABLE ONLY user_tokens
2172 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2176 -- Name: way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2179 ALTER TABLE ONLY way_nodes
2180 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2184 -- Name: way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2187 ALTER TABLE ONLY way_tags
2188 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2192 -- Name: ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2195 ALTER TABLE ONLY ways
2196 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2200 -- Name: ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2203 ALTER TABLE ONLY ways
2204 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2208 -- PostgreSQL database dump complete
2211 INSERT INTO schema_migrations (version) VALUES ('1');
2213 INSERT INTO schema_migrations (version) VALUES ('10');
2215 INSERT INTO schema_migrations (version) VALUES ('11');
2217 INSERT INTO schema_migrations (version) VALUES ('12');
2219 INSERT INTO schema_migrations (version) VALUES ('13');
2221 INSERT INTO schema_migrations (version) VALUES ('14');
2223 INSERT INTO schema_migrations (version) VALUES ('15');
2225 INSERT INTO schema_migrations (version) VALUES ('16');
2227 INSERT INTO schema_migrations (version) VALUES ('17');
2229 INSERT INTO schema_migrations (version) VALUES ('18');
2231 INSERT INTO schema_migrations (version) VALUES ('19');
2233 INSERT INTO schema_migrations (version) VALUES ('2');
2235 INSERT INTO schema_migrations (version) VALUES ('20');
2237 INSERT INTO schema_migrations (version) VALUES ('20100513171259');
2239 INSERT INTO schema_migrations (version) VALUES ('20100516124737');
2241 INSERT INTO schema_migrations (version) VALUES ('20100910084426');
2243 INSERT INTO schema_migrations (version) VALUES ('20101114011429');
2245 INSERT INTO schema_migrations (version) VALUES ('20110322001319');
2247 INSERT INTO schema_migrations (version) VALUES ('20110925112722');
2249 INSERT INTO schema_migrations (version) VALUES ('20111116184519');
2251 INSERT INTO schema_migrations (version) VALUES ('20111212183945');
2253 INSERT INTO schema_migrations (version) VALUES ('20120123184321');
2255 INSERT INTO schema_migrations (version) VALUES ('20120208122334');
2257 INSERT INTO schema_migrations (version) VALUES ('20120208194454');
2259 INSERT INTO schema_migrations (version) VALUES ('20120214210114');
2261 INSERT INTO schema_migrations (version) VALUES ('20120219161649');
2263 INSERT INTO schema_migrations (version) VALUES ('20120318201948');
2265 INSERT INTO schema_migrations (version) VALUES ('20120328090602');
2267 INSERT INTO schema_migrations (version) VALUES ('20120404205604');
2269 INSERT INTO schema_migrations (version) VALUES ('20120808231205');
2271 INSERT INTO schema_migrations (version) VALUES ('20121005195010');
2273 INSERT INTO schema_migrations (version) VALUES ('20121012044047');
2275 INSERT INTO schema_migrations (version) VALUES ('21');
2277 INSERT INTO schema_migrations (version) VALUES ('22');
2279 INSERT INTO schema_migrations (version) VALUES ('23');
2281 INSERT INTO schema_migrations (version) VALUES ('24');
2283 INSERT INTO schema_migrations (version) VALUES ('25');
2285 INSERT INTO schema_migrations (version) VALUES ('26');
2287 INSERT INTO schema_migrations (version) VALUES ('27');
2289 INSERT INTO schema_migrations (version) VALUES ('28');
2291 INSERT INTO schema_migrations (version) VALUES ('29');
2293 INSERT INTO schema_migrations (version) VALUES ('3');
2295 INSERT INTO schema_migrations (version) VALUES ('30');
2297 INSERT INTO schema_migrations (version) VALUES ('31');
2299 INSERT INTO schema_migrations (version) VALUES ('32');
2301 INSERT INTO schema_migrations (version) VALUES ('33');
2303 INSERT INTO schema_migrations (version) VALUES ('34');
2305 INSERT INTO schema_migrations (version) VALUES ('35');
2307 INSERT INTO schema_migrations (version) VALUES ('36');
2309 INSERT INTO schema_migrations (version) VALUES ('37');
2311 INSERT INTO schema_migrations (version) VALUES ('38');
2313 INSERT INTO schema_migrations (version) VALUES ('39');
2315 INSERT INTO schema_migrations (version) VALUES ('4');
2317 INSERT INTO schema_migrations (version) VALUES ('40');
2319 INSERT INTO schema_migrations (version) VALUES ('41');
2321 INSERT INTO schema_migrations (version) VALUES ('42');
2323 INSERT INTO schema_migrations (version) VALUES ('43');
2325 INSERT INTO schema_migrations (version) VALUES ('44');
2327 INSERT INTO schema_migrations (version) VALUES ('45');
2329 INSERT INTO schema_migrations (version) VALUES ('46');
2331 INSERT INTO schema_migrations (version) VALUES ('47');
2333 INSERT INTO schema_migrations (version) VALUES ('48');
2335 INSERT INTO schema_migrations (version) VALUES ('49');
2337 INSERT INTO schema_migrations (version) VALUES ('5');
2339 INSERT INTO schema_migrations (version) VALUES ('50');
2341 INSERT INTO schema_migrations (version) VALUES ('51');
2343 INSERT INTO schema_migrations (version) VALUES ('52');
2345 INSERT INTO schema_migrations (version) VALUES ('6');
2347 INSERT INTO schema_migrations (version) VALUES ('7');
2349 INSERT INTO schema_migrations (version) VALUES ('8');
2351 INSERT INTO schema_migrations (version) VALUES ('9');