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
1080 -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1083 CREATE SEQUENCE users_id_seq
1092 -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1095 ALTER SEQUENCE users_id_seq OWNED BY users.id;
1099 -- Name: way_nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
1102 CREATE TABLE way_nodes (
1103 way_id bigint NOT NULL,
1104 node_id bigint NOT NULL,
1105 version bigint NOT NULL,
1106 sequence_id bigint NOT NULL
1111 -- Name: way_tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
1114 CREATE TABLE way_tags (
1115 way_id bigint DEFAULT 0 NOT NULL,
1116 k character varying(255) NOT NULL,
1117 v character varying(255) NOT NULL,
1118 version bigint NOT NULL
1123 -- Name: ways; Type: TABLE; Schema: public; Owner: -; Tablespace:
1127 way_id bigint DEFAULT 0 NOT NULL,
1128 changeset_id bigint NOT NULL,
1129 "timestamp" timestamp without time zone NOT NULL,
1130 version bigint NOT NULL,
1131 visible boolean DEFAULT true NOT NULL,
1132 redaction_id integer
1137 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1140 ALTER TABLE ONLY acls ALTER COLUMN id SET DEFAULT nextval('acls_id_seq'::regclass);
1144 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1147 ALTER TABLE ONLY changesets ALTER COLUMN id SET DEFAULT nextval('changesets_id_seq'::regclass);
1151 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1154 ALTER TABLE ONLY client_applications ALTER COLUMN id SET DEFAULT nextval('client_applications_id_seq'::regclass);
1158 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1161 ALTER TABLE ONLY current_nodes ALTER COLUMN id SET DEFAULT nextval('current_nodes_id_seq'::regclass);
1165 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1168 ALTER TABLE ONLY current_relations ALTER COLUMN id SET DEFAULT nextval('current_relations_id_seq'::regclass);
1172 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1175 ALTER TABLE ONLY current_ways ALTER COLUMN id SET DEFAULT nextval('current_ways_id_seq'::regclass);
1179 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1182 ALTER TABLE ONLY diary_comments ALTER COLUMN id SET DEFAULT nextval('diary_comments_id_seq'::regclass);
1186 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1189 ALTER TABLE ONLY diary_entries ALTER COLUMN id SET DEFAULT nextval('diary_entries_id_seq'::regclass);
1193 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1196 ALTER TABLE ONLY friends ALTER COLUMN id SET DEFAULT nextval('friends_id_seq'::regclass);
1200 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1203 ALTER TABLE ONLY gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('gpx_file_tags_id_seq'::regclass);
1207 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1210 ALTER TABLE ONLY gpx_files ALTER COLUMN id SET DEFAULT nextval('gpx_files_id_seq'::regclass);
1214 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1217 ALTER TABLE ONLY messages ALTER COLUMN id SET DEFAULT nextval('messages_id_seq'::regclass);
1221 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1224 ALTER TABLE ONLY note_comments ALTER COLUMN id SET DEFAULT nextval('note_comments_id_seq'::regclass);
1228 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1231 ALTER TABLE ONLY notes ALTER COLUMN id SET DEFAULT nextval('notes_id_seq'::regclass);
1235 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1238 ALTER TABLE ONLY oauth_nonces ALTER COLUMN id SET DEFAULT nextval('oauth_nonces_id_seq'::regclass);
1242 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1245 ALTER TABLE ONLY oauth_tokens ALTER COLUMN id SET DEFAULT nextval('oauth_tokens_id_seq'::regclass);
1249 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1252 ALTER TABLE ONLY redactions ALTER COLUMN id SET DEFAULT nextval('redactions_id_seq'::regclass);
1256 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1259 ALTER TABLE ONLY user_blocks ALTER COLUMN id SET DEFAULT nextval('user_blocks_id_seq'::regclass);
1263 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1266 ALTER TABLE ONLY user_roles ALTER COLUMN id SET DEFAULT nextval('user_roles_id_seq'::regclass);
1270 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1273 ALTER TABLE ONLY user_tokens ALTER COLUMN id SET DEFAULT nextval('user_tokens_id_seq'::regclass);
1277 -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1280 ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
1284 -- Name: acls_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1287 ALTER TABLE ONLY acls
1288 ADD CONSTRAINT acls_pkey PRIMARY KEY (id);
1292 -- Name: changesets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1295 ALTER TABLE ONLY changesets
1296 ADD CONSTRAINT changesets_pkey PRIMARY KEY (id);
1300 -- Name: client_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1303 ALTER TABLE ONLY client_applications
1304 ADD CONSTRAINT client_applications_pkey PRIMARY KEY (id);
1308 -- Name: current_node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1311 ALTER TABLE ONLY current_node_tags
1312 ADD CONSTRAINT current_node_tags_pkey PRIMARY KEY (node_id, k);
1316 -- Name: current_nodes_pkey1; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1319 ALTER TABLE ONLY current_nodes
1320 ADD CONSTRAINT current_nodes_pkey1 PRIMARY KEY (id);
1324 -- Name: current_relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1327 ALTER TABLE ONLY current_relation_members
1328 ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
1332 -- Name: current_relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1335 ALTER TABLE ONLY current_relation_tags
1336 ADD CONSTRAINT current_relation_tags_pkey PRIMARY KEY (relation_id, k);
1340 -- Name: current_relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1343 ALTER TABLE ONLY current_relations
1344 ADD CONSTRAINT current_relations_pkey PRIMARY KEY (id);
1348 -- Name: current_way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1351 ALTER TABLE ONLY current_way_nodes
1352 ADD CONSTRAINT current_way_nodes_pkey PRIMARY KEY (way_id, sequence_id);
1356 -- Name: current_way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1359 ALTER TABLE ONLY current_way_tags
1360 ADD CONSTRAINT current_way_tags_pkey PRIMARY KEY (way_id, k);
1364 -- Name: current_ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1367 ALTER TABLE ONLY current_ways
1368 ADD CONSTRAINT current_ways_pkey PRIMARY KEY (id);
1372 -- Name: diary_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1375 ALTER TABLE ONLY diary_comments
1376 ADD CONSTRAINT diary_comments_pkey PRIMARY KEY (id);
1380 -- Name: diary_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1383 ALTER TABLE ONLY diary_entries
1384 ADD CONSTRAINT diary_entries_pkey PRIMARY KEY (id);
1388 -- Name: friends_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1391 ALTER TABLE ONLY friends
1392 ADD CONSTRAINT friends_pkey PRIMARY KEY (id);
1396 -- Name: gpx_file_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1399 ALTER TABLE ONLY gpx_file_tags
1400 ADD CONSTRAINT gpx_file_tags_pkey PRIMARY KEY (id);
1404 -- Name: gpx_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1407 ALTER TABLE ONLY gpx_files
1408 ADD CONSTRAINT gpx_files_pkey PRIMARY KEY (id);
1412 -- Name: languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1415 ALTER TABLE ONLY languages
1416 ADD CONSTRAINT languages_pkey PRIMARY KEY (code);
1420 -- Name: messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1423 ALTER TABLE ONLY messages
1424 ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
1428 -- Name: node_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1431 ALTER TABLE ONLY node_tags
1432 ADD CONSTRAINT node_tags_pkey PRIMARY KEY (node_id, version, k);
1436 -- Name: nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1439 ALTER TABLE ONLY nodes
1440 ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id, version);
1444 -- Name: note_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1447 ALTER TABLE ONLY note_comments
1448 ADD CONSTRAINT note_comments_pkey PRIMARY KEY (id);
1452 -- Name: notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1455 ALTER TABLE ONLY notes
1456 ADD CONSTRAINT notes_pkey PRIMARY KEY (id);
1460 -- Name: oauth_nonces_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1463 ALTER TABLE ONLY oauth_nonces
1464 ADD CONSTRAINT oauth_nonces_pkey PRIMARY KEY (id);
1468 -- Name: oauth_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1471 ALTER TABLE ONLY oauth_tokens
1472 ADD CONSTRAINT oauth_tokens_pkey PRIMARY KEY (id);
1476 -- Name: redactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1479 ALTER TABLE ONLY redactions
1480 ADD CONSTRAINT redactions_pkey PRIMARY KEY (id);
1484 -- Name: relation_members_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1487 ALTER TABLE ONLY relation_members
1488 ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
1492 -- Name: relation_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1495 ALTER TABLE ONLY relation_tags
1496 ADD CONSTRAINT relation_tags_pkey PRIMARY KEY (relation_id, version, k);
1500 -- Name: relations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1503 ALTER TABLE ONLY relations
1504 ADD CONSTRAINT relations_pkey PRIMARY KEY (relation_id, version);
1508 -- Name: user_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1511 ALTER TABLE ONLY user_blocks
1512 ADD CONSTRAINT user_blocks_pkey PRIMARY KEY (id);
1516 -- Name: user_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1519 ALTER TABLE ONLY user_preferences
1520 ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (user_id, k);
1524 -- Name: user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1527 ALTER TABLE ONLY user_roles
1528 ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);
1532 -- Name: user_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1535 ALTER TABLE ONLY user_tokens
1536 ADD CONSTRAINT user_tokens_pkey PRIMARY KEY (id);
1540 -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1543 ALTER TABLE ONLY users
1544 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
1548 -- Name: way_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1551 ALTER TABLE ONLY way_nodes
1552 ADD CONSTRAINT way_nodes_pkey PRIMARY KEY (way_id, version, sequence_id);
1556 -- Name: way_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1559 ALTER TABLE ONLY way_tags
1560 ADD CONSTRAINT way_tags_pkey PRIMARY KEY (way_id, version, k);
1564 -- Name: ways_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1567 ALTER TABLE ONLY ways
1568 ADD CONSTRAINT ways_pkey PRIMARY KEY (way_id, version);
1572 -- Name: acls_k_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1575 CREATE INDEX acls_k_idx ON acls USING btree (k);
1579 -- Name: changeset_tags_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1582 CREATE INDEX changeset_tags_id_idx ON changeset_tags USING btree (changeset_id);
1586 -- Name: changesets_bbox_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1589 CREATE INDEX changesets_bbox_idx ON changesets USING gist (min_lat, max_lat, min_lon, max_lon);
1593 -- Name: changesets_closed_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1596 CREATE INDEX changesets_closed_at_idx ON changesets USING btree (closed_at);
1600 -- Name: changesets_created_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1603 CREATE INDEX changesets_created_at_idx ON changesets USING btree (created_at);
1607 -- Name: changesets_user_id_created_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1610 CREATE INDEX changesets_user_id_created_at_idx ON changesets USING btree (user_id, created_at);
1614 -- Name: changesets_user_id_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1617 CREATE INDEX changesets_user_id_id_idx ON changesets USING btree (user_id, id);
1621 -- Name: current_nodes_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1624 CREATE INDEX current_nodes_tile_idx ON current_nodes USING btree (tile);
1628 -- Name: current_nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1631 CREATE INDEX current_nodes_timestamp_idx ON current_nodes USING btree ("timestamp");
1635 -- Name: current_relation_members_member_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1638 CREATE INDEX current_relation_members_member_idx ON current_relation_members USING btree (member_type, member_id);
1642 -- Name: current_relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1645 CREATE INDEX current_relations_timestamp_idx ON current_relations USING btree ("timestamp");
1649 -- Name: current_way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1652 CREATE INDEX current_way_nodes_node_idx ON current_way_nodes USING btree (node_id);
1656 -- Name: current_ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1659 CREATE INDEX current_ways_timestamp_idx ON current_ways USING btree ("timestamp");
1663 -- Name: diary_comment_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1666 CREATE INDEX diary_comment_user_id_created_at_index ON diary_comments USING btree (user_id, created_at);
1670 -- Name: diary_comments_entry_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1673 CREATE UNIQUE INDEX diary_comments_entry_id_idx ON diary_comments USING btree (diary_entry_id, id);
1677 -- Name: diary_entry_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1680 CREATE INDEX diary_entry_created_at_index ON diary_entries USING btree (created_at);
1684 -- Name: diary_entry_language_code_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1687 CREATE INDEX diary_entry_language_code_created_at_index ON diary_entries USING btree (language_code, created_at);
1691 -- Name: diary_entry_user_id_created_at_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
1694 CREATE INDEX diary_entry_user_id_created_at_index ON diary_entries USING btree (user_id, created_at);
1698 -- Name: friends_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1701 CREATE INDEX friends_user_id_idx ON friends USING btree (user_id);
1705 -- Name: gpx_file_tags_gpxid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1708 CREATE INDEX gpx_file_tags_gpxid_idx ON gpx_file_tags USING btree (gpx_id);
1712 -- Name: gpx_file_tags_tag_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1715 CREATE INDEX gpx_file_tags_tag_idx ON gpx_file_tags USING btree (tag);
1719 -- Name: gpx_files_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1722 CREATE INDEX gpx_files_timestamp_idx ON gpx_files USING btree ("timestamp");
1726 -- Name: gpx_files_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1729 CREATE INDEX gpx_files_user_id_idx ON gpx_files USING btree (user_id);
1733 -- Name: gpx_files_visible_visibility_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1736 CREATE INDEX gpx_files_visible_visibility_idx ON gpx_files USING btree (visible, visibility);
1740 -- Name: index_client_applications_on_key; Type: INDEX; Schema: public; Owner: -; Tablespace:
1743 CREATE UNIQUE INDEX index_client_applications_on_key ON client_applications USING btree (key);
1747 -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: -; Tablespace:
1750 CREATE INDEX index_note_comments_on_body ON note_comments USING gin (to_tsvector('english'::regconfig, body));
1754 -- Name: index_note_comments_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
1757 CREATE INDEX index_note_comments_on_created_at ON note_comments USING btree (created_at);
1761 -- Name: index_oauth_nonces_on_nonce_and_timestamp; Type: INDEX; Schema: public; Owner: -; Tablespace:
1764 CREATE UNIQUE INDEX index_oauth_nonces_on_nonce_and_timestamp ON oauth_nonces USING btree (nonce, "timestamp");
1768 -- Name: index_oauth_tokens_on_token; Type: INDEX; Schema: public; Owner: -; Tablespace:
1771 CREATE UNIQUE INDEX index_oauth_tokens_on_token ON oauth_tokens USING btree (token);
1775 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1778 CREATE INDEX index_user_blocks_on_user_id ON user_blocks USING btree (user_id);
1782 -- Name: messages_from_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1785 CREATE INDEX messages_from_user_id_idx ON messages USING btree (from_user_id);
1789 -- Name: messages_to_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1792 CREATE INDEX messages_to_user_id_idx ON messages USING btree (to_user_id);
1796 -- Name: nodes_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1799 CREATE INDEX nodes_changeset_id_idx ON nodes USING btree (changeset_id);
1803 -- Name: nodes_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1806 CREATE INDEX nodes_tile_idx ON nodes USING btree (tile);
1810 -- Name: nodes_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1813 CREATE INDEX nodes_timestamp_idx ON nodes USING btree ("timestamp");
1817 -- Name: note_comments_note_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1820 CREATE INDEX note_comments_note_id_idx ON note_comments USING btree (note_id);
1824 -- Name: notes_created_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1827 CREATE INDEX notes_created_at_idx ON notes USING btree (created_at);
1831 -- Name: notes_tile_status_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1834 CREATE INDEX notes_tile_status_idx ON notes USING btree (tile, status);
1838 -- Name: notes_updated_at_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1841 CREATE INDEX notes_updated_at_idx ON notes USING btree (updated_at);
1845 -- Name: points_gpxid_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1848 CREATE INDEX points_gpxid_idx ON gps_points USING btree (gpx_id);
1852 -- Name: points_tile_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1855 CREATE INDEX points_tile_idx ON gps_points USING btree (tile);
1859 -- Name: relation_members_member_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1862 CREATE INDEX relation_members_member_idx ON relation_members USING btree (member_type, member_id);
1866 -- Name: relations_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1869 CREATE INDEX relations_changeset_id_idx ON relations USING btree (changeset_id);
1873 -- Name: relations_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1876 CREATE INDEX relations_timestamp_idx ON relations USING btree ("timestamp");
1880 -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
1883 CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
1887 -- Name: user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1890 CREATE INDEX user_id_idx ON friends USING btree (friend_user_id);
1894 -- Name: user_openid_url_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1897 CREATE UNIQUE INDEX user_openid_url_idx ON users USING btree (openid_url);
1901 -- Name: user_roles_id_role_unique; Type: INDEX; Schema: public; Owner: -; Tablespace:
1904 CREATE UNIQUE INDEX user_roles_id_role_unique ON user_roles USING btree (user_id, role);
1908 -- Name: user_tokens_token_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1911 CREATE UNIQUE INDEX user_tokens_token_idx ON user_tokens USING btree (token);
1915 -- Name: user_tokens_user_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1918 CREATE INDEX user_tokens_user_id_idx ON user_tokens USING btree (user_id);
1922 -- Name: users_display_name_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1925 CREATE UNIQUE INDEX users_display_name_idx ON users USING btree (display_name);
1929 -- Name: users_display_name_lower_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1932 CREATE INDEX users_display_name_lower_idx ON users USING btree (lower((display_name)::text));
1936 -- Name: users_email_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1939 CREATE UNIQUE INDEX users_email_idx ON users USING btree (email);
1943 -- Name: users_email_lower_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1946 CREATE INDEX users_email_lower_idx ON users USING btree (lower((email)::text));
1950 -- Name: way_nodes_node_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1953 CREATE INDEX way_nodes_node_idx ON way_nodes USING btree (node_id);
1957 -- Name: ways_changeset_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1960 CREATE INDEX ways_changeset_id_idx ON ways USING btree (changeset_id);
1964 -- Name: ways_timestamp_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1967 CREATE INDEX ways_timestamp_idx ON ways USING btree ("timestamp");
1971 -- Name: changeset_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1974 ALTER TABLE ONLY changeset_tags
1975 ADD CONSTRAINT changeset_tags_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
1979 -- Name: changesets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1982 ALTER TABLE ONLY changesets
1983 ADD CONSTRAINT changesets_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1987 -- Name: client_applications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1990 ALTER TABLE ONLY client_applications
1991 ADD CONSTRAINT client_applications_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
1995 -- Name: current_node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
1998 ALTER TABLE ONLY current_node_tags
1999 ADD CONSTRAINT current_node_tags_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
2003 -- Name: current_nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2006 ALTER TABLE ONLY current_nodes
2007 ADD CONSTRAINT current_nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2011 -- Name: current_relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2014 ALTER TABLE ONLY current_relation_members
2015 ADD CONSTRAINT current_relation_members_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
2019 -- Name: current_relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2022 ALTER TABLE ONLY current_relation_tags
2023 ADD CONSTRAINT current_relation_tags_id_fkey FOREIGN KEY (relation_id) REFERENCES current_relations(id);
2027 -- Name: current_relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2030 ALTER TABLE ONLY current_relations
2031 ADD CONSTRAINT current_relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2035 -- Name: current_way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2038 ALTER TABLE ONLY current_way_nodes
2039 ADD CONSTRAINT current_way_nodes_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
2043 -- Name: current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2046 ALTER TABLE ONLY current_way_nodes
2047 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id);
2051 -- Name: current_way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2054 ALTER TABLE ONLY current_way_tags
2055 ADD CONSTRAINT current_way_tags_id_fkey FOREIGN KEY (way_id) REFERENCES current_ways(id);
2059 -- Name: current_ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2062 ALTER TABLE ONLY current_ways
2063 ADD CONSTRAINT current_ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2067 -- Name: diary_comments_diary_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2070 ALTER TABLE ONLY diary_comments
2071 ADD CONSTRAINT diary_comments_diary_entry_id_fkey FOREIGN KEY (diary_entry_id) REFERENCES diary_entries(id);
2075 -- Name: diary_comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2078 ALTER TABLE ONLY diary_comments
2079 ADD CONSTRAINT diary_comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2083 -- Name: diary_entries_language_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2086 ALTER TABLE ONLY diary_entries
2087 ADD CONSTRAINT diary_entries_language_code_fkey FOREIGN KEY (language_code) REFERENCES languages(code);
2091 -- Name: diary_entries_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2094 ALTER TABLE ONLY diary_entries
2095 ADD CONSTRAINT diary_entries_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2099 -- Name: friends_friend_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2102 ALTER TABLE ONLY friends
2103 ADD CONSTRAINT friends_friend_user_id_fkey FOREIGN KEY (friend_user_id) REFERENCES users(id);
2107 -- Name: friends_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2110 ALTER TABLE ONLY friends
2111 ADD CONSTRAINT friends_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2115 -- Name: gps_points_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2118 ALTER TABLE ONLY gps_points
2119 ADD CONSTRAINT gps_points_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
2123 -- Name: gpx_file_tags_gpx_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2126 ALTER TABLE ONLY gpx_file_tags
2127 ADD CONSTRAINT gpx_file_tags_gpx_id_fkey FOREIGN KEY (gpx_id) REFERENCES gpx_files(id);
2131 -- Name: gpx_files_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2134 ALTER TABLE ONLY gpx_files
2135 ADD CONSTRAINT gpx_files_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2139 -- Name: messages_from_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2142 ALTER TABLE ONLY messages
2143 ADD CONSTRAINT messages_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES users(id);
2147 -- Name: messages_to_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2150 ALTER TABLE ONLY messages
2151 ADD CONSTRAINT messages_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES users(id);
2155 -- Name: node_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2158 ALTER TABLE ONLY node_tags
2159 ADD CONSTRAINT node_tags_id_fkey FOREIGN KEY (node_id, version) REFERENCES nodes(node_id, version);
2163 -- Name: nodes_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2166 ALTER TABLE ONLY nodes
2167 ADD CONSTRAINT nodes_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2171 -- Name: nodes_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2174 ALTER TABLE ONLY nodes
2175 ADD CONSTRAINT nodes_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2179 -- Name: note_comments_author_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2182 ALTER TABLE ONLY note_comments
2183 ADD CONSTRAINT note_comments_author_id_fkey FOREIGN KEY (author_id) REFERENCES users(id);
2187 -- Name: note_comments_note_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2190 ALTER TABLE ONLY note_comments
2191 ADD CONSTRAINT note_comments_note_id_fkey FOREIGN KEY (note_id) REFERENCES notes(id);
2195 -- Name: oauth_tokens_client_application_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2198 ALTER TABLE ONLY oauth_tokens
2199 ADD CONSTRAINT oauth_tokens_client_application_id_fkey FOREIGN KEY (client_application_id) REFERENCES client_applications(id);
2203 -- Name: oauth_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2206 ALTER TABLE ONLY oauth_tokens
2207 ADD CONSTRAINT oauth_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2211 -- Name: redactions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2214 ALTER TABLE ONLY redactions
2215 ADD CONSTRAINT redactions_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2219 -- Name: relation_members_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2222 ALTER TABLE ONLY relation_members
2223 ADD CONSTRAINT relation_members_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2227 -- Name: relation_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2230 ALTER TABLE ONLY relation_tags
2231 ADD CONSTRAINT relation_tags_id_fkey FOREIGN KEY (relation_id, version) REFERENCES relations(relation_id, version);
2235 -- Name: relations_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2238 ALTER TABLE ONLY relations
2239 ADD CONSTRAINT relations_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2243 -- Name: relations_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2246 ALTER TABLE ONLY relations
2247 ADD CONSTRAINT relations_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2251 -- Name: user_blocks_moderator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2254 ALTER TABLE ONLY user_blocks
2255 ADD CONSTRAINT user_blocks_moderator_id_fkey FOREIGN KEY (creator_id) REFERENCES users(id);
2259 -- Name: user_blocks_revoker_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2262 ALTER TABLE ONLY user_blocks
2263 ADD CONSTRAINT user_blocks_revoker_id_fkey FOREIGN KEY (revoker_id) REFERENCES users(id);
2267 -- Name: user_blocks_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2270 ALTER TABLE ONLY user_blocks
2271 ADD CONSTRAINT user_blocks_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2275 -- Name: user_preferences_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2278 ALTER TABLE ONLY user_preferences
2279 ADD CONSTRAINT user_preferences_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2283 -- Name: user_roles_granter_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2286 ALTER TABLE ONLY user_roles
2287 ADD CONSTRAINT user_roles_granter_id_fkey FOREIGN KEY (granter_id) REFERENCES users(id);
2291 -- Name: user_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2294 ALTER TABLE ONLY user_roles
2295 ADD CONSTRAINT user_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2299 -- Name: user_tokens_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2302 ALTER TABLE ONLY user_tokens
2303 ADD CONSTRAINT user_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
2307 -- Name: way_nodes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2310 ALTER TABLE ONLY way_nodes
2311 ADD CONSTRAINT way_nodes_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2315 -- Name: way_tags_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2318 ALTER TABLE ONLY way_tags
2319 ADD CONSTRAINT way_tags_id_fkey FOREIGN KEY (way_id, version) REFERENCES ways(way_id, version);
2323 -- Name: ways_changeset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2326 ALTER TABLE ONLY ways
2327 ADD CONSTRAINT ways_changeset_id_fkey FOREIGN KEY (changeset_id) REFERENCES changesets(id);
2331 -- Name: ways_redaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2334 ALTER TABLE ONLY ways
2335 ADD CONSTRAINT ways_redaction_id_fkey FOREIGN KEY (redaction_id) REFERENCES redactions(id);
2339 -- PostgreSQL database dump complete
2342 SET search_path TO "$user",public;
2344 INSERT INTO schema_migrations (version) VALUES ('1');
2346 INSERT INTO schema_migrations (version) VALUES ('10');
2348 INSERT INTO schema_migrations (version) VALUES ('11');
2350 INSERT INTO schema_migrations (version) VALUES ('12');
2352 INSERT INTO schema_migrations (version) VALUES ('13');
2354 INSERT INTO schema_migrations (version) VALUES ('14');
2356 INSERT INTO schema_migrations (version) VALUES ('15');
2358 INSERT INTO schema_migrations (version) VALUES ('16');
2360 INSERT INTO schema_migrations (version) VALUES ('17');
2362 INSERT INTO schema_migrations (version) VALUES ('18');
2364 INSERT INTO schema_migrations (version) VALUES ('19');
2366 INSERT INTO schema_migrations (version) VALUES ('2');
2368 INSERT INTO schema_migrations (version) VALUES ('20');
2370 INSERT INTO schema_migrations (version) VALUES ('20100513171259');
2372 INSERT INTO schema_migrations (version) VALUES ('20100516124737');
2374 INSERT INTO schema_migrations (version) VALUES ('20100910084426');
2376 INSERT INTO schema_migrations (version) VALUES ('20101114011429');
2378 INSERT INTO schema_migrations (version) VALUES ('20110322001319');
2380 INSERT INTO schema_migrations (version) VALUES ('20110508145337');
2382 INSERT INTO schema_migrations (version) VALUES ('20110521142405');
2384 INSERT INTO schema_migrations (version) VALUES ('20110925112722');
2386 INSERT INTO schema_migrations (version) VALUES ('20111116184519');
2388 INSERT INTO schema_migrations (version) VALUES ('20111212183945');
2390 INSERT INTO schema_migrations (version) VALUES ('20120123184321');
2392 INSERT INTO schema_migrations (version) VALUES ('20120208122334');
2394 INSERT INTO schema_migrations (version) VALUES ('20120208194454');
2396 INSERT INTO schema_migrations (version) VALUES ('20120214210114');
2398 INSERT INTO schema_migrations (version) VALUES ('20120219161649');
2400 INSERT INTO schema_migrations (version) VALUES ('20120318201948');
2402 INSERT INTO schema_migrations (version) VALUES ('20120328090602');
2404 INSERT INTO schema_migrations (version) VALUES ('20120404205604');
2406 INSERT INTO schema_migrations (version) VALUES ('20120808231205');
2408 INSERT INTO schema_migrations (version) VALUES ('20121005195010');
2410 INSERT INTO schema_migrations (version) VALUES ('20121012044047');
2412 INSERT INTO schema_migrations (version) VALUES ('20121119165817');
2414 INSERT INTO schema_migrations (version) VALUES ('20121202155309');
2416 INSERT INTO schema_migrations (version) VALUES ('20121203124841');
2418 INSERT INTO schema_migrations (version) VALUES ('20130328184137');
2420 INSERT INTO schema_migrations (version) VALUES ('20131212124700');
2422 INSERT INTO schema_migrations (version) VALUES ('20140115192822');
2424 INSERT INTO schema_migrations (version) VALUES ('20140117185510');
2426 INSERT INTO schema_migrations (version) VALUES ('21');
2428 INSERT INTO schema_migrations (version) VALUES ('22');
2430 INSERT INTO schema_migrations (version) VALUES ('23');
2432 INSERT INTO schema_migrations (version) VALUES ('24');
2434 INSERT INTO schema_migrations (version) VALUES ('25');
2436 INSERT INTO schema_migrations (version) VALUES ('26');
2438 INSERT INTO schema_migrations (version) VALUES ('27');
2440 INSERT INTO schema_migrations (version) VALUES ('28');
2442 INSERT INTO schema_migrations (version) VALUES ('29');
2444 INSERT INTO schema_migrations (version) VALUES ('3');
2446 INSERT INTO schema_migrations (version) VALUES ('30');
2448 INSERT INTO schema_migrations (version) VALUES ('31');
2450 INSERT INTO schema_migrations (version) VALUES ('32');
2452 INSERT INTO schema_migrations (version) VALUES ('33');
2454 INSERT INTO schema_migrations (version) VALUES ('34');
2456 INSERT INTO schema_migrations (version) VALUES ('35');
2458 INSERT INTO schema_migrations (version) VALUES ('36');
2460 INSERT INTO schema_migrations (version) VALUES ('37');
2462 INSERT INTO schema_migrations (version) VALUES ('38');
2464 INSERT INTO schema_migrations (version) VALUES ('39');
2466 INSERT INTO schema_migrations (version) VALUES ('4');
2468 INSERT INTO schema_migrations (version) VALUES ('40');
2470 INSERT INTO schema_migrations (version) VALUES ('41');
2472 INSERT INTO schema_migrations (version) VALUES ('42');
2474 INSERT INTO schema_migrations (version) VALUES ('43');
2476 INSERT INTO schema_migrations (version) VALUES ('44');
2478 INSERT INTO schema_migrations (version) VALUES ('45');
2480 INSERT INTO schema_migrations (version) VALUES ('46');
2482 INSERT INTO schema_migrations (version) VALUES ('47');
2484 INSERT INTO schema_migrations (version) VALUES ('48');
2486 INSERT INTO schema_migrations (version) VALUES ('49');
2488 INSERT INTO schema_migrations (version) VALUES ('5');
2490 INSERT INTO schema_migrations (version) VALUES ('50');
2492 INSERT INTO schema_migrations (version) VALUES ('51');
2494 INSERT INTO schema_migrations (version) VALUES ('52');
2496 INSERT INTO schema_migrations (version) VALUES ('53');
2498 INSERT INTO schema_migrations (version) VALUES ('54');
2500 INSERT INTO schema_migrations (version) VALUES ('55');
2502 INSERT INTO schema_migrations (version) VALUES ('56');
2504 INSERT INTO schema_migrations (version) VALUES ('57');
2506 INSERT INTO schema_migrations (version) VALUES ('6');
2508 INSERT INTO schema_migrations (version) VALUES ('7');
2510 INSERT INTO schema_migrations (version) VALUES ('8');
2512 INSERT INTO schema_migrations (version) VALUES ('9');