2 -- PostgreSQL database dump
5 SET statement_timeout = 0;
7 SET client_encoding = 'UTF8';
8 SET standard_conforming_strings = on;
9 SET check_function_bodies = false;
10 SET client_min_messages = warning;
13 -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
16 CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
20 -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
23 COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
27 -- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: -
30 CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public;
34 -- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner: -
37 COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST';
40 SET search_path = public, pg_catalog;
43 -- Name: format_enum; Type: TYPE; Schema: public; Owner: -
46 CREATE TYPE format_enum AS ENUM (
54 -- Name: gpx_visibility_enum; Type: TYPE; Schema: public; Owner: -
57 CREATE TYPE gpx_visibility_enum AS ENUM (
66 -- Name: note_event_enum; Type: TYPE; Schema: public; Owner: -
69 CREATE TYPE note_event_enum AS ENUM (
79 -- Name: note_status_enum; Type: TYPE; Schema: public; Owner: -
82 CREATE TYPE note_status_enum AS ENUM (
90 -- Name: nwr_enum; Type: TYPE; Schema: public; Owner: -
93 CREATE TYPE nwr_enum AS ENUM (
101 -- Name: user_role_enum; Type: TYPE; Schema: public; Owner: -
104 CREATE TYPE user_role_enum AS ENUM (
111 -- Name: user_status_enum; Type: TYPE; Schema: public; Owner: -
114 CREATE TYPE user_status_enum AS ENUM (
124 -- Name: maptile_for_point(bigint, bigint, integer); Type: FUNCTION; Schema: public; Owner: -
127 CREATE FUNCTION maptile_for_point(bigint, bigint, integer) RETURNS integer
129 AS '/srv/www/master.osm.compton.nu/db/functions/libpgosm.so', 'maptile_for_point';
133 -- Name: tile_for_point(integer, integer); Type: FUNCTION; Schema: public; Owner: -
136 CREATE FUNCTION tile_for_point(integer, integer) RETURNS bigint
138 AS '/srv/www/master.osm.compton.nu/db/functions/libpgosm.so', 'tile_for_point';
142 -- Name: xid_to_int4(xid); Type: FUNCTION; Schema: public; Owner: -
145 CREATE FUNCTION xid_to_int4(xid) RETURNS integer
146 LANGUAGE c IMMUTABLE STRICT
147 AS '/srv/www/master.osm.compton.nu/db/functions/libpgosm.so', 'xid_to_int4';
150 SET default_tablespace = '';
152 SET default_with_oids = false;
155 -- Name: acls; Type: TABLE; Schema: public; Owner: -; Tablespace:
161 k character varying(255) NOT NULL,
162 v character varying(255),
163 domain character varying(255)
168 -- Name: acls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
171 CREATE SEQUENCE acls_id_seq
180 -- Name: acls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
183 ALTER SEQUENCE acls_id_seq OWNED BY acls.id;
187 -- Name: changeset_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
190 CREATE TABLE changeset_tags (
191 changeset_id bigint NOT NULL,
192 k character varying(255) DEFAULT ''::character varying NOT NULL,
193 v character varying(255) DEFAULT ''::character varying NOT NULL
198 -- Name: changesets; Type: TABLE; Schema: public; Owner: -; Tablespace:
201 CREATE TABLE changesets (
203 user_id bigint NOT NULL,
204 created_at timestamp without time zone NOT NULL,
209 closed_at timestamp without time zone NOT NULL,
210 num_changes integer DEFAULT 0 NOT NULL
215 -- Name: changesets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
218 CREATE SEQUENCE changesets_id_seq
227 -- Name: changesets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
230 ALTER SEQUENCE changesets_id_seq OWNED BY changesets.id;
234 -- Name: client_applications; Type: TABLE; Schema: public; Owner: -; Tablespace:
237 CREATE TABLE client_applications (
239 name character varying(255),
240 url character varying(255),
241 support_url character varying(255),
242 callback_url character varying(255),
243 key character varying(50),
244 secret character varying(50),
246 created_at timestamp without time zone,
247 updated_at timestamp without time zone,
248 allow_read_prefs boolean DEFAULT false NOT NULL,
249 allow_write_prefs boolean DEFAULT false NOT NULL,
250 allow_write_diary boolean DEFAULT false NOT NULL,
251 allow_write_api boolean DEFAULT false NOT NULL,
252 allow_read_gpx boolean DEFAULT false NOT NULL,
253 allow_write_gpx boolean DEFAULT false NOT NULL,
254 allow_write_notes boolean DEFAULT false NOT NULL
259 -- Name: client_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
262 CREATE SEQUENCE client_applications_id_seq
271 -- Name: client_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
274 ALTER SEQUENCE client_applications_id_seq OWNED BY client_applications.id;
278 -- Name: current_node_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
281 CREATE TABLE current_node_tags (
282 node_id bigint NOT NULL,
283 k character varying(255) DEFAULT ''::character varying NOT NULL,
284 v character varying(255) DEFAULT ''::character varying NOT NULL
289 -- Name: current_nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
292 CREATE TABLE current_nodes (
294 latitude integer NOT NULL,
295 longitude integer NOT NULL,
296 changeset_id bigint NOT NULL,
297 visible boolean NOT NULL,
298 "timestamp" timestamp without time zone NOT NULL,
299 tile bigint NOT NULL,
300 version bigint NOT NULL
305 -- Name: current_nodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
308 CREATE SEQUENCE current_nodes_id_seq
317 -- Name: current_nodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
320 ALTER SEQUENCE current_nodes_id_seq OWNED BY current_nodes.id;
324 -- Name: current_relation_members; Type: TABLE; Schema: public; Owner: -; Tablespace:
327 CREATE TABLE current_relation_members (
328 relation_id bigint NOT NULL,
329 member_type nwr_enum NOT NULL,
330 member_id bigint NOT NULL,
331 member_role character varying(255) NOT NULL,
332 sequence_id integer DEFAULT 0 NOT NULL
337 -- Name: current_relation_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
340 CREATE TABLE current_relation_tags (
341 relation_id bigint NOT NULL,
342 k character varying(255) DEFAULT ''::character varying NOT NULL,
343 v character varying(255) DEFAULT ''::character varying NOT NULL
348 -- Name: current_relations; Type: TABLE; Schema: public; Owner: -; Tablespace:
351 CREATE TABLE current_relations (
353 changeset_id bigint NOT NULL,
354 "timestamp" timestamp without time zone NOT NULL,
355 visible boolean NOT NULL,
356 version bigint NOT NULL
361 -- Name: current_relations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
364 CREATE SEQUENCE current_relations_id_seq
373 -- Name: current_relations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
376 ALTER SEQUENCE current_relations_id_seq OWNED BY current_relations.id;
380 -- Name: current_way_nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
383 CREATE TABLE current_way_nodes (
384 way_id bigint NOT NULL,
385 node_id bigint NOT NULL,
386 sequence_id bigint NOT NULL
391 -- Name: current_way_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
394 CREATE TABLE current_way_tags (
395 way_id bigint NOT NULL,
396 k character varying(255) DEFAULT ''::character varying NOT NULL,
397 v character varying(255) DEFAULT ''::character varying NOT NULL
402 -- Name: current_ways; Type: TABLE; Schema: public; Owner: -; Tablespace:
405 CREATE TABLE current_ways (
407 changeset_id bigint NOT NULL,
408 "timestamp" timestamp without time zone NOT NULL,
409 visible boolean NOT NULL,
410 version bigint NOT NULL
415 -- Name: current_ways_id_seq; Type: SEQUENCE; Schema: public; Owner: -
418 CREATE SEQUENCE current_ways_id_seq
427 -- Name: current_ways_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
430 ALTER SEQUENCE current_ways_id_seq OWNED BY current_ways.id;
434 -- Name: diary_comments; Type: TABLE; Schema: public; Owner: -; Tablespace:
437 CREATE TABLE diary_comments (
439 diary_entry_id bigint NOT NULL,
440 user_id bigint NOT NULL,
442 created_at timestamp without time zone NOT NULL,
443 updated_at timestamp without time zone NOT NULL,
444 visible boolean DEFAULT true NOT NULL,
445 body_format format_enum DEFAULT 'html'::format_enum NOT NULL
450 -- Name: diary_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
453 CREATE SEQUENCE diary_comments_id_seq
462 -- Name: diary_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
465 ALTER SEQUENCE diary_comments_id_seq OWNED BY diary_comments.id;
469 -- Name: diary_entries; Type: TABLE; Schema: public; Owner: -; Tablespace:
472 CREATE TABLE diary_entries (
474 user_id bigint NOT NULL,
475 title character varying(255) NOT NULL,
477 created_at timestamp without time zone NOT NULL,
478 updated_at timestamp without time zone NOT NULL,
479 latitude double precision,
480 longitude double precision,
481 language_code character varying(255) DEFAULT 'en'::character varying NOT NULL,
482 visible boolean DEFAULT true NOT NULL,
483 body_format format_enum DEFAULT 'html'::format_enum NOT NULL
488 -- Name: diary_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
491 CREATE SEQUENCE diary_entries_id_seq
500 -- Name: diary_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
503 ALTER SEQUENCE diary_entries_id_seq OWNED BY diary_entries.id;
507 -- Name: friends; Type: TABLE; Schema: public; Owner: -; Tablespace:
510 CREATE TABLE friends (
512 user_id bigint NOT NULL,
513 friend_user_id bigint NOT NULL
518 -- Name: friends_id_seq; Type: SEQUENCE; Schema: public; Owner: -
521 CREATE SEQUENCE friends_id_seq
530 -- Name: friends_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
533 ALTER SEQUENCE friends_id_seq OWNED BY friends.id;
537 -- Name: gps_points; Type: TABLE; Schema: public; Owner: -; Tablespace:
540 CREATE TABLE gps_points (
541 altitude double precision,
542 trackid integer NOT NULL,
543 latitude integer NOT NULL,
544 longitude integer NOT NULL,
545 gpx_id bigint NOT NULL,
546 "timestamp" timestamp without time zone,
552 -- Name: gpx_file_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
555 CREATE TABLE gpx_file_tags (
556 gpx_id bigint DEFAULT 0 NOT NULL,
557 tag character varying(255) NOT NULL,
563 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
566 CREATE SEQUENCE gpx_file_tags_id_seq
575 -- Name: gpx_file_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
578 ALTER SEQUENCE gpx_file_tags_id_seq OWNED BY gpx_file_tags.id;
582 -- Name: gpx_files; Type: TABLE; Schema: public; Owner: -; Tablespace:
585 CREATE TABLE gpx_files (
587 user_id bigint NOT NULL,
588 visible boolean DEFAULT true NOT NULL,
589 name character varying(255) DEFAULT ''::character varying NOT NULL,
591 latitude double precision,
592 longitude double precision,
593 "timestamp" timestamp without time zone NOT NULL,
594 description character varying(255) DEFAULT ''::character varying NOT NULL,
595 inserted boolean NOT NULL,
596 visibility gpx_visibility_enum DEFAULT 'public'::gpx_visibility_enum NOT NULL
601 -- Name: gpx_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
604 CREATE SEQUENCE gpx_files_id_seq
613 -- Name: gpx_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
616 ALTER SEQUENCE gpx_files_id_seq OWNED BY gpx_files.id;
620 -- Name: languages; Type: TABLE; Schema: public; Owner: -; Tablespace:
623 CREATE TABLE languages (
624 code character varying(255) NOT NULL,
625 english_name character varying(255) NOT NULL,
626 native_name character varying(255)
631 -- Name: messages; Type: TABLE; Schema: public; Owner: -; Tablespace:
634 CREATE TABLE messages (
636 from_user_id bigint NOT NULL,
637 title character varying(255) NOT NULL,
639 sent_on timestamp without time zone NOT NULL,
640 message_read boolean DEFAULT false NOT NULL,
641 to_user_id bigint NOT NULL,
642 to_user_visible boolean DEFAULT true NOT NULL,
643 from_user_visible boolean DEFAULT true NOT NULL,
644 body_format format_enum DEFAULT 'html'::format_enum NOT NULL
649 -- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
652 CREATE SEQUENCE messages_id_seq
661 -- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
664 ALTER SEQUENCE messages_id_seq OWNED BY messages.id;
668 -- Name: node_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
671 CREATE TABLE node_tags (
672 node_id bigint NOT NULL,
673 version bigint NOT NULL,
674 k character varying(255) DEFAULT ''::character varying NOT NULL,
675 v character varying(255) DEFAULT ''::character varying NOT NULL
680 -- Name: nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
684 node_id bigint NOT NULL,
685 latitude integer NOT NULL,
686 longitude integer NOT NULL,
687 changeset_id bigint NOT NULL,
688 visible boolean NOT NULL,
689 "timestamp" timestamp without time zone NOT NULL,
690 tile bigint NOT NULL,
691 version bigint NOT NULL,
697 -- Name: note_comments; Type: TABLE; Schema: public; Owner: -; Tablespace:
700 CREATE TABLE note_comments (
702 note_id bigint NOT NULL,
703 visible boolean NOT NULL,
704 created_at timestamp without time zone NOT NULL,
708 event note_event_enum
713 -- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
716 CREATE SEQUENCE note_comments_id_seq
725 -- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
728 ALTER SEQUENCE note_comments_id_seq OWNED BY note_comments.id;
732 -- Name: notes; Type: TABLE; Schema: public; Owner: -; Tablespace:
737 latitude integer NOT NULL,
738 longitude integer NOT NULL,
739 tile bigint NOT NULL,
740 updated_at timestamp without time zone NOT NULL,
741 created_at timestamp without time zone NOT NULL,
742 status note_status_enum NOT NULL,
743 closed_at timestamp without time zone
748 -- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
751 CREATE SEQUENCE notes_id_seq
760 -- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
763 ALTER SEQUENCE notes_id_seq OWNED BY notes.id;
767 -- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -; Tablespace:
770 CREATE TABLE oauth_nonces (
772 nonce character varying(255),
774 created_at timestamp without time zone,
775 updated_at timestamp without time zone
780 -- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
783 CREATE SEQUENCE oauth_nonces_id_seq
792 -- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
795 ALTER SEQUENCE oauth_nonces_id_seq OWNED BY oauth_nonces.id;
799 -- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -; Tablespace:
802 CREATE TABLE oauth_tokens (
805 type character varying(20),
806 client_application_id integer,
807 token character varying(50),
808 secret character varying(50),
809 authorized_at timestamp without time zone,
810 invalidated_at timestamp without time zone,
811 created_at timestamp without time zone,
812 updated_at timestamp without time zone,
813 allow_read_prefs boolean DEFAULT false NOT NULL,
814 allow_write_prefs boolean DEFAULT false NOT NULL,
815 allow_write_diary boolean DEFAULT false NOT NULL,
816 allow_write_api boolean DEFAULT false NOT NULL,
817 allow_read_gpx boolean DEFAULT false NOT NULL,
818 allow_write_gpx boolean DEFAULT false NOT NULL,
819 callback_url character varying(255),
820 verifier character varying(20),
821 scope character varying(255),
822 valid_to timestamp without time zone,
823 allow_write_notes boolean DEFAULT false NOT NULL
828 -- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
831 CREATE SEQUENCE oauth_tokens_id_seq
840 -- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
843 ALTER SEQUENCE oauth_tokens_id_seq OWNED BY oauth_tokens.id;
847 -- Name: redactions; Type: TABLE; Schema: public; Owner: -; Tablespace:
850 CREATE TABLE redactions (
852 title character varying(255),
854 created_at timestamp without time zone NOT NULL,
855 updated_at timestamp without time zone NOT NULL,
856 user_id bigint NOT NULL,
857 description_format format_enum DEFAULT 'markdown'::format_enum NOT NULL
862 -- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
865 CREATE SEQUENCE redactions_id_seq
874 -- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
877 ALTER SEQUENCE redactions_id_seq OWNED BY redactions.id;
881 -- Name: relation_members; Type: TABLE; Schema: public; Owner: -; Tablespace:
884 CREATE TABLE relation_members (
885 relation_id bigint DEFAULT 0 NOT NULL,
886 member_type nwr_enum NOT NULL,
887 member_id bigint NOT NULL,
888 member_role character varying(255) NOT NULL,
889 version bigint DEFAULT 0 NOT NULL,
890 sequence_id integer DEFAULT 0 NOT NULL
895 -- Name: relation_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
898 CREATE TABLE relation_tags (
899 relation_id bigint DEFAULT 0 NOT NULL,
900 k character varying(255) DEFAULT ''::character varying NOT NULL,
901 v character varying(255) DEFAULT ''::character varying NOT NULL,
902 version bigint NOT NULL
907 -- Name: relations; Type: TABLE; Schema: public; Owner: -; Tablespace:
910 CREATE TABLE relations (
911 relation_id bigint DEFAULT 0 NOT NULL,
912 changeset_id bigint NOT NULL,
913 "timestamp" timestamp without time zone NOT NULL,
914 version bigint NOT NULL,
915 visible boolean DEFAULT true NOT NULL,
921 -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace:
924 CREATE TABLE schema_migrations (
925 version character varying(255) NOT NULL
930 -- Name: user_blocks; Type: TABLE; Schema: public; Owner: -; Tablespace:
933 CREATE TABLE user_blocks (
935 user_id bigint NOT NULL,
936 creator_id bigint NOT NULL,
937 reason text NOT NULL,
938 ends_at timestamp without time zone NOT NULL,
939 needs_view boolean DEFAULT false NOT NULL,
941 created_at timestamp without time zone,
942 updated_at timestamp without time zone,
943 reason_format format_enum DEFAULT 'html'::format_enum NOT NULL
948 -- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
951 CREATE SEQUENCE user_blocks_id_seq
960 -- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
963 ALTER SEQUENCE user_blocks_id_seq OWNED BY user_blocks.id;
967 -- Name: user_preferences; Type: TABLE; Schema: public; Owner: -; Tablespace:
970 CREATE TABLE user_preferences (
971 user_id bigint NOT NULL,
972 k character varying(255) NOT NULL,
973 v character varying(255) NOT NULL
978 -- Name: user_roles; Type: TABLE; Schema: public; Owner: -; Tablespace:
981 CREATE TABLE user_roles (
983 user_id bigint NOT NULL,
984 created_at timestamp without time zone,
985 updated_at timestamp without time zone,
986 role user_role_enum NOT NULL,
987 granter_id bigint NOT NULL
992 -- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
995 CREATE SEQUENCE user_roles_id_seq
1004 -- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1007 ALTER SEQUENCE user_roles_id_seq OWNED BY user_roles.id;
1011 -- Name: user_tokens; Type: TABLE; Schema: public; Owner: -; Tablespace:
1014 CREATE TABLE user_tokens (
1016 user_id bigint NOT NULL,
1017 token character varying(255) NOT NULL,
1018 expiry timestamp without time zone NOT NULL,
1024 -- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1027 CREATE SEQUENCE user_tokens_id_seq
1036 -- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1039 ALTER SEQUENCE user_tokens_id_seq OWNED BY user_tokens.id;
1043 -- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace:
1046 CREATE TABLE users (
1047 email character varying(255) NOT NULL,
1049 pass_crypt character varying(255) NOT NULL,
1050 creation_time timestamp without time zone NOT NULL,
1051 display_name character varying(255) DEFAULT ''::character varying NOT NULL,
1052 data_public boolean DEFAULT false NOT NULL,
1053 description text DEFAULT ''::text NOT NULL,
1054 home_lat double precision,
1055 home_lon double precision,
1056 home_zoom smallint DEFAULT 3,
1057 nearby integer DEFAULT 50,
1058 pass_salt character varying(255),
1059 image_file_name text,
1060 email_valid boolean DEFAULT false NOT NULL,
1061 new_email character varying(255),
1062 creation_ip character varying(255),
1063 languages character varying(255),
1064 status user_status_enum DEFAULT 'pending'::user_status_enum NOT NULL,
1065 terms_agreed timestamp without time zone,
1066 consider_pd boolean DEFAULT false NOT NULL,
1067 preferred_editor character varying(255),
1068 terms_seen boolean DEFAULT false NOT NULL,
1069 openid_url character varying(255),
1070 description_format format_enum DEFAULT 'html'::format_enum NOT NULL,
1071 image_fingerprint character varying(255),
1072 changesets_count integer DEFAULT 0 NOT NULL,
1073 traces_count integer DEFAULT 0 NOT NULL,
1074 diary_entries_count integer DEFAULT 0 NOT NULL,
1075 image_use_gravatar boolean DEFAULT true NOT NULL,
1076 image_content_type character varying(255)
1081 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1084 CREATE SEQUENCE users_id_seq
1093 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1096 ALTER SEQUENCE users_id_seq OWNED BY users.id;
1100 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
1103 CREATE TABLE way_nodes (
1104 way_id bigint NOT NULL,
1105 node_id bigint NOT NULL,
1106 version bigint NOT NULL,
1107 sequence_id bigint NOT NULL
1112 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
1115 CREATE TABLE way_tags (
1116 way_id bigint DEFAULT 0 NOT NULL,
1117 k character varying(255) NOT NULL,
1118 v character varying(255) NOT NULL,
1119 version bigint NOT NULL
1124 -- Name: ways; Type: TABLE; Schema: public; Owner: -; Tablespace:
1128 way_id bigint DEFAULT 0 NOT NULL,
1129 changeset_id bigint NOT NULL,
1130 "timestamp" timestamp without time zone NOT NULL,
1131 version bigint NOT NULL,
1132 visible boolean DEFAULT true NOT NULL,
1133 redaction_id integer
1138 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1141 ALTER TABLE ONLY acls ALTER COLUMN id SET DEFAULT nextval('acls_id_seq'::regclass);
1145 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1148 ALTER TABLE ONLY changesets ALTER COLUMN id SET DEFAULT nextval('changesets_id_seq'::regclass);
1152 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1155 ALTER TABLE ONLY client_applications ALTER COLUMN id SET DEFAULT nextval('client_applications_id_seq'::regclass);
1159 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1162 ALTER TABLE ONLY current_nodes ALTER COLUMN id SET DEFAULT nextval('current_nodes_id_seq'::regclass);
1166 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1169 ALTER TABLE ONLY current_relations ALTER COLUMN id SET DEFAULT nextval('current_relations_id_seq'::regclass);
1173 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1176 ALTER TABLE ONLY current_ways ALTER COLUMN id SET DEFAULT nextval('current_ways_id_seq'::regclass);
1180 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1183 ALTER TABLE ONLY diary_comments ALTER COLUMN id SET DEFAULT nextval('diary_comments_id_seq'::regclass);
1187 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1190 ALTER TABLE ONLY diary_entries ALTER COLUMN id SET DEFAULT nextval('diary_entries_id_seq'::regclass);
1194 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1197 ALTER TABLE ONLY friends ALTER COLUMN id SET DEFAULT nextval('friends_id_seq'::regclass);
1201 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1204 ALTER TABLE ONLY gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('gpx_file_tags_id_seq'::regclass);
1208 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1211 ALTER TABLE ONLY gpx_files ALTER COLUMN id SET DEFAULT nextval('gpx_files_id_seq'::regclass);
1215 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1218 ALTER TABLE ONLY messages ALTER COLUMN id SET DEFAULT nextval('messages_id_seq'::regclass);
1222 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1225 ALTER TABLE ONLY note_comments ALTER COLUMN id SET DEFAULT nextval('note_comments_id_seq'::regclass);
1229 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1232 ALTER TABLE ONLY notes ALTER COLUMN id SET DEFAULT nextval('notes_id_seq'::regclass);
1236 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1239 ALTER TABLE ONLY oauth_nonces ALTER COLUMN id SET DEFAULT nextval('oauth_nonces_id_seq'::regclass);
1243 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1246 ALTER TABLE ONLY oauth_tokens ALTER COLUMN id SET DEFAULT nextval('oauth_tokens_id_seq'::regclass);
1250 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1253 ALTER TABLE ONLY redactions ALTER COLUMN id SET DEFAULT nextval('redactions_id_seq'::regclass);
1257 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1260 ALTER TABLE ONLY user_blocks ALTER COLUMN id SET DEFAULT nextval('user_blocks_id_seq'::regclass);
1264 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1267 ALTER TABLE ONLY user_roles ALTER COLUMN id SET DEFAULT nextval('user_roles_id_seq'::regclass);
1271 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1274 ALTER TABLE ONLY user_tokens ALTER COLUMN id SET DEFAULT nextval('user_tokens_id_seq'::regclass);
1278 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1281 ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
1285 -- Name: acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1288 ALTER TABLE ONLY acls
1289 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1293 -- Name: changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1296 ALTER TABLE ONLY changesets
1297 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1301 -- Name: client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1304 ALTER TABLE ONLY client_applications
1305 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1309 -- Name: current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1312 ALTER TABLE ONLY current_node_tags
1313 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1317 -- Name: current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1320 ALTER TABLE ONLY current_nodes
1321 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1325 -- Name: current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1328 ALTER TABLE ONLY current_relation_members
1329 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1333 -- Name: current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1336 ALTER TABLE ONLY current_relation_tags
1337 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1341 -- Name: current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1344 ALTER TABLE ONLY current_relations
1345 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1349 -- Name: current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1352 ALTER TABLE ONLY current_way_nodes
1353 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1357 -- Name: current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1360 ALTER TABLE ONLY current_way_tags
1361 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1365 -- Name: current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1368 ALTER TABLE ONLY current_ways
1369 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1373 -- Name: diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1376 ALTER TABLE ONLY diary_comments
1377 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1381 -- Name: diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1384 ALTER TABLE ONLY diary_entries
1385 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1389 -- Name: friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1392 ALTER TABLE ONLY friends
1393 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1397 -- Name: gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1400 ALTER TABLE ONLY gpx_file_tags
1401 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1405 -- Name: gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1408 ALTER TABLE ONLY gpx_files
1409 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1413 -- Name: languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1416 ALTER TABLE ONLY languages
1417 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1421 -- Name: messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1424 ALTER TABLE ONLY messages
1425 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1429 -- Name: node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1432 ALTER TABLE ONLY node_tags
1433 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1437 -- Name: nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1440 ALTER TABLE ONLY nodes
1441 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1445 -- Name: note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1448 ALTER TABLE ONLY note_comments
1449 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1453 -- Name: notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1456 ALTER TABLE ONLY notes
1457 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1461 -- Name: oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1464 ALTER TABLE ONLY oauth_nonces
1465 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1469 -- Name: oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1472 ALTER TABLE ONLY oauth_tokens
1473 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1477 -- Name: redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1480 ALTER TABLE ONLY redactions
1481 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1485 -- Name: relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1488 ALTER TABLE ONLY relation_members
1489 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1493 -- Name: relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1496 ALTER TABLE ONLY relation_tags
1497 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1501 -- Name: relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1504 ALTER TABLE ONLY relations
1505 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1509 -- Name: user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1512 ALTER TABLE ONLY user_blocks
1513 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1517 -- Name: user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1520 ALTER TABLE ONLY user_preferences
1521 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1525 -- Name: user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1528 ALTER TABLE ONLY user_roles
1529 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1533 -- Name: user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1536 ALTER TABLE ONLY user_tokens
1537 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
1541 -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1544 ALTER TABLE ONLY users
1545 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
1549 -- Name: way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1552 ALTER TABLE ONLY way_nodes
1553 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
1557 -- Name: way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1560 ALTER TABLE ONLY way_tags
1561 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
1565 -- Name: ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1568 ALTER TABLE ONLY ways
1569 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
1573 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1576 CREATE INDEX acls_k_idx ON acls USING btree (k);
1580 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1583 CREATE INDEX changeset_tags_id_idx ON changeset_tags USING btree (changeset_id);
1587 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1590 CREATE INDEX changesets_bbox_idx ON changesets USING gist (min_lat, max_lat, min_lon, max_lon);
1594 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1597 CREATE INDEX changesets_closed_at_idx ON changesets USING btree (closed_at);
1601 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1604 CREATE INDEX changesets_created_at_idx ON changesets USING btree (created_at);
1608 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1611 CREATE INDEX changesets_user_id_created_at_idx ON changesets USING btree (user_id, created_at);
1615 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1618 CREATE INDEX changesets_user_id_id_idx ON changesets USING btree (user_id, id);
1622 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1625 CREATE INDEX current_nodes_tile_idx ON current_nodes USING btree (tile);
1629 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1632 CREATE INDEX current_nodes_timestamp_idx ON current_nodes USING btree ("timestamp");
1636 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1639 CREATE INDEX current_relation_members_member_idx ON current_relation_members USING btree (member_type, member_id);
1643 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1646 CREATE INDEX current_relations_timestamp_idx ON current_relations USING btree ("timestamp");
1650 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1653 CREATE INDEX current_way_nodes_node_idx ON current_way_nodes USING btree (node_id);
1657 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1660 CREATE INDEX current_ways_timestamp_idx ON current_ways USING btree ("timestamp");
1664 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1667 CREATE INDEX diary_comment_user_id_created_at_index ON diary_comments USING btree (user_id, created_at);
1671 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1674 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON diary_comments USING btree (diary_entry_id, id);
1678 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1681 CREATE INDEX diary_entry_created_at_index ON diary_entries USING btree (created_at);
1685 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1688 CREATE INDEX diary_entry_language_code_created_at_index ON diary_entries USING btree (language_code, created_at);
1692 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1695 CREATE INDEX diary_entry_user_id_created_at_index ON diary_entries USING btree (user_id, created_at);
1699 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1702 CREATE INDEX friends_user_id_idx ON friends USING btree (user_id);
1706 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1709 CREATE INDEX gpx_file_tags_gpxid_idx ON gpx_file_tags USING btree (gpx_id);
1713 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1716 CREATE INDEX gpx_file_tags_tag_idx ON gpx_file_tags USING btree (tag);
1720 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1723 CREATE INDEX gpx_files_timestamp_idx ON gpx_files USING btree ("timestamp");
1727 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1730 CREATE INDEX gpx_files_user_id_idx ON gpx_files USING btree (user_id);
1734 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1737 CREATE INDEX gpx_files_visible_visibility_idx ON gpx_files USING btree (visible, visibility);
1741 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -; Tablespace:
1744 CREATE UNIQUE INDEX index_client_applications_on_key ON client_applications USING btree (key);
1748 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -; Tablespace:
1751 CREATE INDEX index_note_comments_on_body ON note_comments USING gin (to_tsvector('english'::regconfig, body));
1755 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
1758 CREATE INDEX index_note_comments_on_created_at ON note_comments USING btree (created_at);
1762 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -; Tablespace:
1765 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON oauth_nonces USING btree (nonce, "timestamp");
1769 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -; Tablespace:
1772 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON oauth_tokens USING btree (token);
1776 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1779 CREATE INDEX index_user_blocks_on_user_id ON user_blocks USING btree (user_id);
1783 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1786 CREATE INDEX messages_from_user_id_idx ON messages USING btree (from_user_id);
1790 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1793 CREATE INDEX messages_to_user_id_idx ON messages USING btree (to_user_id);
1797 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1800 CREATE INDEX nodes_changeset_id_idx ON nodes USING btree (changeset_id);
1804 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1807 CREATE INDEX nodes_tile_idx ON nodes USING btree (tile);
1811 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1814 CREATE INDEX nodes_timestamp_idx ON nodes USING btree ("timestamp");
1818 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1821 CREATE INDEX note_comments_note_id_idx ON note_comments USING btree (note_id);
1825 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1828 CREATE INDEX notes_created_at_idx ON notes USING btree (created_at);
1832 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1835 CREATE INDEX notes_tile_status_idx ON notes USING btree (tile, status);
1839 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1842 CREATE INDEX notes_updated_at_idx ON notes USING btree (updated_at);
1846 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1849 CREATE INDEX points_gpxid_idx ON gps_points USING btree (gpx_id);
1853 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1856 CREATE INDEX points_tile_idx ON gps_points USING btree (tile);
1860 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1863 CREATE INDEX relation_members_member_idx ON relation_members USING btree (member_type, member_id);
1867 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1870 CREATE INDEX relations_changeset_id_idx ON relations USING btree (changeset_id);
1874 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1877 CREATE INDEX relations_timestamp_idx ON relations USING btree ("timestamp");
1881 -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
1884 CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
1888 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1891 CREATE INDEX user_id_idx ON friends USING btree (friend_user_id);
1895 -- Name: user_openid_url_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1898 CREATE UNIQUE INDEX user_openid_url_idx ON users USING btree (openid_url);
1902 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -; Tablespace:
1905 CREATE UNIQUE INDEX user_roles_id_role_unique ON user_roles USING btree (user_id, role);
1909 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1912 CREATE UNIQUE INDEX user_tokens_token_idx ON user_tokens USING btree (token);
1916 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1919 CREATE INDEX user_tokens_user_id_idx ON user_tokens USING btree (user_id);
1923 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1926 CREATE UNIQUE INDEX users_display_name_idx ON users USING btree (display_name);
1930 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1933 CREATE INDEX users_display_name_lower_idx ON users USING btree (lower((display_name)::text));
1937 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1940 CREATE UNIQUE INDEX users_email_idx ON users USING btree (email);
1944 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1947 CREATE INDEX users_email_lower_idx ON users USING btree (lower((email)::text));
1951 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1954 CREATE INDEX way_nodes_node_idx ON way_nodes USING btree (node_id);
1958 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1961 CREATE INDEX ways_changeset_id_idx ON ways USING btree (changeset_id);
1965 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1968 CREATE INDEX ways_timestamp_idx ON ways USING btree ("timestamp");
1972 -- Name: changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1975 ALTER TABLE ONLY changeset_tags
1976 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
1980 -- Name: changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1983 ALTER TABLE ONLY changesets
1984 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1988 -- Name: client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1991 ALTER TABLE ONLY client_applications
1992 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1996 -- Name: current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1999 ALTER TABLE ONLY current_node_tags
2000 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
2004 -- Name: current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2007 ALTER TABLE ONLY current_nodes
2008 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2012 -- Name: current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2015 ALTER TABLE ONLY current_relation_members
2016 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
2020 -- Name: current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2023 ALTER TABLE ONLY current_relation_tags
2024 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
2028 -- Name: current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2031 ALTER TABLE ONLY current_relations
2032 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2036 -- Name: current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2039 ALTER TABLE ONLY current_way_nodes
2040 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
2044 -- Name: current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2047 ALTER TABLE ONLY current_way_nodes
2048 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
2052 -- Name: current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2055 ALTER TABLE ONLY current_way_tags
2056 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
2060 -- Name: current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2063 ALTER TABLE ONLY current_ways
2064 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2068 -- Name: diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2071 ALTER TABLE ONLY diary_comments
2072 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES diary_entries(id);
2076 -- Name: diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2079 ALTER TABLE ONLY diary_comments
2080 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2084 -- Name: diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2087 ALTER TABLE ONLY diary_entries
2088 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES languages(code);
2092 -- Name: diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2095 ALTER TABLE ONLY diary_entries
2096 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2100 -- Name: friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2103 ALTER TABLE ONLY friends
2104 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES users(id);
2108 -- Name: friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2111 ALTER TABLE ONLY friends
2112 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2116 -- Name: gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2119 ALTER TABLE ONLY gps_points
2120 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
2124 -- Name: gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2127 ALTER TABLE ONLY gpx_file_tags
2128 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
2132 -- Name: gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2135 ALTER TABLE ONLY gpx_files
2136 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2140 -- Name: messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2143 ALTER TABLE ONLY messages
2144 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES users(id);
2148 -- Name: messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2151 ALTER TABLE ONLY messages
2152 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES users(id);
2156 -- Name: node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2159 ALTER TABLE ONLY node_tags
2160 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES nodes(node_id, version);
2164 -- Name: nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2167 ALTER TABLE ONLY nodes
2168 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2172 -- Name: nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2175 ALTER TABLE ONLY nodes
2176 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2180 -- Name: note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2183 ALTER TABLE ONLY note_comments
2184 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES users(id);
2188 -- Name: note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2191 ALTER TABLE ONLY note_comments
2192 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES notes(id);
2196 -- Name: oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2199 ALTER TABLE ONLY oauth_tokens
2200 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES client_applications(id);
2204 -- Name: oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2207 ALTER TABLE ONLY oauth_tokens
2208 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2212 -- Name: redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2215 ALTER TABLE ONLY redactions
2216 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2220 -- Name: relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2223 ALTER TABLE ONLY relation_members
2224 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2228 -- Name: relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2231 ALTER TABLE ONLY relation_tags
2232 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2236 -- Name: relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2239 ALTER TABLE ONLY relations
2240 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2244 -- Name: relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2247 ALTER TABLE ONLY relations
2248 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2252 -- Name: user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2255 ALTER TABLE ONLY user_blocks
2256 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES users(id);
2260 -- Name: user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2263 ALTER TABLE ONLY user_blocks
2264 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES users(id);
2268 -- Name: user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2271 ALTER TABLE ONLY user_blocks
2272 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2276 -- Name: user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2279 ALTER TABLE ONLY user_preferences
2280 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2284 -- Name: user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2287 ALTER TABLE ONLY user_roles
2288 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES users(id);
2292 -- Name: user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2295 ALTER TABLE ONLY user_roles
2296 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2300 -- Name: user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2303 ALTER TABLE ONLY user_tokens
2304 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2308 -- Name: way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2311 ALTER TABLE ONLY way_nodes
2312 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2316 -- Name: way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2319 ALTER TABLE ONLY way_tags
2320 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2324 -- Name: ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2327 ALTER TABLE ONLY ways
2328 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2332 -- Name: ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2335 ALTER TABLE ONLY ways
2336 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2340 -- PostgreSQL database dump complete
2343 SET search_path TO "$user",public;
2345 INSERT INTO schema_migrations (version) VALUES ('1');
2347 INSERT INTO schema_migrations (version) VALUES ('10');
2349 INSERT INTO schema_migrations (version) VALUES ('11');
2351 INSERT INTO schema_migrations (version) VALUES ('12');
2353 INSERT INTO schema_migrations (version) VALUES ('13');
2355 INSERT INTO schema_migrations (version) VALUES ('14');
2357 INSERT INTO schema_migrations (version) VALUES ('15');
2359 INSERT INTO schema_migrations (version) VALUES ('16');
2361 INSERT INTO schema_migrations (version) VALUES ('17');
2363 INSERT INTO schema_migrations (version) VALUES ('18');
2365 INSERT INTO schema_migrations (version) VALUES ('19');
2367 INSERT INTO schema_migrations (version) VALUES ('2');
2369 INSERT INTO schema_migrations (version) VALUES ('20');
2371 INSERT INTO schema_migrations (version) VALUES ('20100513171259');
2373 INSERT INTO schema_migrations (version) VALUES ('20100516124737');
2375 INSERT INTO schema_migrations (version) VALUES ('20100910084426');
2377 INSERT INTO schema_migrations (version) VALUES ('20101114011429');
2379 INSERT INTO schema_migrations (version) VALUES ('20110322001319');
2381 INSERT INTO schema_migrations (version) VALUES ('20110508145337');
2383 INSERT INTO schema_migrations (version) VALUES ('20110521142405');
2385 INSERT INTO schema_migrations (version) VALUES ('20110925112722');
2387 INSERT INTO schema_migrations (version) VALUES ('20111116184519');
2389 INSERT INTO schema_migrations (version) VALUES ('20111212183945');
2391 INSERT INTO schema_migrations (version) VALUES ('20120123184321');
2393 INSERT INTO schema_migrations (version) VALUES ('20120208122334');
2395 INSERT INTO schema_migrations (version) VALUES ('20120208194454');
2397 INSERT INTO schema_migrations (version) VALUES ('20120214210114');
2399 INSERT INTO schema_migrations (version) VALUES ('20120219161649');
2401 INSERT INTO schema_migrations (version) VALUES ('20120318201948');
2403 INSERT INTO schema_migrations (version) VALUES ('20120328090602');
2405 INSERT INTO schema_migrations (version) VALUES ('20120404205604');
2407 INSERT INTO schema_migrations (version) VALUES ('20120808231205');
2409 INSERT INTO schema_migrations (version) VALUES ('20121005195010');
2411 INSERT INTO schema_migrations (version) VALUES ('20121012044047');
2413 INSERT INTO schema_migrations (version) VALUES ('20121119165817');
2415 INSERT INTO schema_migrations (version) VALUES ('20121202155309');
2417 INSERT INTO schema_migrations (version) VALUES ('20121203124841');
2419 INSERT INTO schema_migrations (version) VALUES ('20130328184137');
2421 INSERT INTO schema_migrations (version) VALUES ('20131212124700');
2423 INSERT INTO schema_migrations (version) VALUES ('20140115192822');
2425 INSERT INTO schema_migrations (version) VALUES ('20140117185510');
2427 INSERT INTO schema_migrations (version) VALUES ('20140210003018');
2429 INSERT INTO schema_migrations (version) VALUES ('21');
2431 INSERT INTO schema_migrations (version) VALUES ('22');
2433 INSERT INTO schema_migrations (version) VALUES ('23');
2435 INSERT INTO schema_migrations (version) VALUES ('24');
2437 INSERT INTO schema_migrations (version) VALUES ('25');
2439 INSERT INTO schema_migrations (version) VALUES ('26');
2441 INSERT INTO schema_migrations (version) VALUES ('27');
2443 INSERT INTO schema_migrations (version) VALUES ('28');
2445 INSERT INTO schema_migrations (version) VALUES ('29');
2447 INSERT INTO schema_migrations (version) VALUES ('3');
2449 INSERT INTO schema_migrations (version) VALUES ('30');
2451 INSERT INTO schema_migrations (version) VALUES ('31');
2453 INSERT INTO schema_migrations (version) VALUES ('32');
2455 INSERT INTO schema_migrations (version) VALUES ('33');
2457 INSERT INTO schema_migrations (version) VALUES ('34');
2459 INSERT INTO schema_migrations (version) VALUES ('35');
2461 INSERT INTO schema_migrations (version) VALUES ('36');
2463 INSERT INTO schema_migrations (version) VALUES ('37');
2465 INSERT INTO schema_migrations (version) VALUES ('38');
2467 INSERT INTO schema_migrations (version) VALUES ('39');
2469 INSERT INTO schema_migrations (version) VALUES ('4');
2471 INSERT INTO schema_migrations (version) VALUES ('40');
2473 INSERT INTO schema_migrations (version) VALUES ('41');
2475 INSERT INTO schema_migrations (version) VALUES ('42');
2477 INSERT INTO schema_migrations (version) VALUES ('43');
2479 INSERT INTO schema_migrations (version) VALUES ('44');
2481 INSERT INTO schema_migrations (version) VALUES ('45');
2483 INSERT INTO schema_migrations (version) VALUES ('46');
2485 INSERT INTO schema_migrations (version) VALUES ('47');
2487 INSERT INTO schema_migrations (version) VALUES ('48');
2489 INSERT INTO schema_migrations (version) VALUES ('49');
2491 INSERT INTO schema_migrations (version) VALUES ('5');
2493 INSERT INTO schema_migrations (version) VALUES ('50');
2495 INSERT INTO schema_migrations (version) VALUES ('51');
2497 INSERT INTO schema_migrations (version) VALUES ('52');
2499 INSERT INTO schema_migrations (version) VALUES ('53');
2501 INSERT INTO schema_migrations (version) VALUES ('54');
2503 INSERT INTO schema_migrations (version) VALUES ('55');
2505 INSERT INTO schema_migrations (version) VALUES ('56');
2507 INSERT INTO schema_migrations (version) VALUES ('57');
2509 INSERT INTO schema_migrations (version) VALUES ('6');
2511 INSERT INTO schema_migrations (version) VALUES ('7');
2513 INSERT INTO schema_migrations (version) VALUES ('8');
2515 INSERT INTO schema_migrations (version) VALUES ('9');