+-- Name: note_comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.note_comments_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: note_comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.note_comments_id_seq OWNED BY public.note_comments.id;
+
+
+--
+-- Name: notes; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.notes (
+ id bigint NOT NULL,
+ latitude integer NOT NULL,
+ longitude integer NOT NULL,
+ tile bigint NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ created_at timestamp without time zone NOT NULL,
+ status public.note_status_enum NOT NULL,
+ closed_at timestamp without time zone
+);
+
+
+--
+-- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.notes_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id;
+
+
+--
+-- Name: oauth_nonces; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.oauth_nonces (
+ id integer NOT NULL,
+ nonce character varying,
+ "timestamp" integer,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone
+);
+
+
+--
+-- Name: oauth_nonces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.oauth_nonces_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: oauth_nonces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.oauth_nonces_id_seq OWNED BY public.oauth_nonces.id;
+
+
+--
+-- Name: oauth_tokens; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.oauth_tokens (
+ id integer NOT NULL,
+ user_id integer,
+ type character varying(20),
+ client_application_id integer,
+ token character varying(50),
+ secret character varying(50),
+ authorized_at timestamp without time zone,
+ invalidated_at timestamp without time zone,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ allow_read_prefs boolean DEFAULT false NOT NULL,
+ allow_write_prefs boolean DEFAULT false NOT NULL,
+ allow_write_diary boolean DEFAULT false NOT NULL,
+ allow_write_api boolean DEFAULT false NOT NULL,
+ allow_read_gpx boolean DEFAULT false NOT NULL,
+ allow_write_gpx boolean DEFAULT false NOT NULL,
+ callback_url character varying,
+ verifier character varying(20),
+ scope character varying,
+ valid_to timestamp without time zone,
+ allow_write_notes boolean DEFAULT false NOT NULL
+);
+
+
+--
+-- Name: oauth_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.oauth_tokens_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: oauth_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.oauth_tokens_id_seq OWNED BY public.oauth_tokens.id;
+
+
+--
+-- Name: redactions; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.redactions (
+ id integer NOT NULL,
+ title character varying,
+ description text,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ user_id bigint NOT NULL,
+ description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
+);
+
+
+--
+-- Name: redactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.redactions_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: redactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.redactions_id_seq OWNED BY public.redactions.id;
+
+
+--
+-- Name: relation_members; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.relation_members (
+ relation_id bigint DEFAULT 0 NOT NULL,
+ member_type public.nwr_enum NOT NULL,
+ member_id bigint NOT NULL,
+ member_role character varying NOT NULL,
+ version bigint DEFAULT 0 NOT NULL,
+ sequence_id integer DEFAULT 0 NOT NULL
+);
+
+
+--
+-- Name: relation_tags; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.relation_tags (
+ relation_id bigint DEFAULT 0 NOT NULL,
+ k character varying DEFAULT ''::character varying NOT NULL,
+ v character varying DEFAULT ''::character varying NOT NULL,
+ version bigint NOT NULL
+);
+
+
+--
+-- Name: relations; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.relations (
+ relation_id bigint DEFAULT 0 NOT NULL,
+ changeset_id bigint NOT NULL,
+ "timestamp" timestamp without time zone NOT NULL,
+ version bigint NOT NULL,
+ visible boolean DEFAULT true NOT NULL,
+ redaction_id integer
+);
+
+
+--
+-- Name: reports; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.reports (
+ id integer NOT NULL,
+ issue_id integer NOT NULL,
+ user_id integer NOT NULL,
+ details text NOT NULL,
+ category character varying NOT NULL,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.reports_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
+
+
+--
+-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.schema_migrations (
+ version character varying NOT NULL
+);
+
+
+--
+-- Name: user_blocks; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.user_blocks (
+ id integer NOT NULL,
+ user_id bigint NOT NULL,
+ creator_id bigint NOT NULL,
+ reason text NOT NULL,
+ ends_at timestamp without time zone NOT NULL,
+ needs_view boolean DEFAULT false NOT NULL,
+ revoker_id bigint,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ reason_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL
+);
+
+
+--
+-- Name: user_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.user_blocks_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: user_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.user_blocks_id_seq OWNED BY public.user_blocks.id;
+
+
+--
+-- Name: user_preferences; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.user_preferences (
+ user_id bigint NOT NULL,
+ k character varying NOT NULL,
+ v character varying NOT NULL
+);
+
+
+--
+-- Name: user_roles; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.user_roles (
+ id integer NOT NULL,
+ user_id bigint NOT NULL,
+ role public.user_role_enum NOT NULL,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ granter_id bigint NOT NULL
+);
+
+
+--
+-- Name: user_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.user_roles_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: user_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.user_roles_id_seq OWNED BY public.user_roles.id;
+
+
+--
+-- Name: user_tokens; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.user_tokens (
+ id bigint NOT NULL,
+ user_id bigint NOT NULL,
+ token character varying NOT NULL,
+ expiry timestamp without time zone NOT NULL,
+ referer text
+);
+
+
+--
+-- Name: user_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.user_tokens_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: user_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.user_tokens_id_seq OWNED BY public.user_tokens.id;
+
+
+--
+-- Name: users; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.users (
+ email character varying NOT NULL,
+ id bigint NOT NULL,
+ pass_crypt character varying NOT NULL,
+ creation_time timestamp without time zone NOT NULL,
+ display_name character varying DEFAULT ''::character varying NOT NULL,
+ data_public boolean DEFAULT false NOT NULL,
+ description text DEFAULT ''::text NOT NULL,
+ home_lat double precision,
+ home_lon double precision,
+ home_zoom smallint DEFAULT 3,
+ pass_salt character varying,
+ email_valid boolean DEFAULT false NOT NULL,
+ new_email character varying,
+ creation_ip character varying,
+ languages character varying,
+ status public.user_status_enum DEFAULT 'pending'::public.user_status_enum NOT NULL,
+ terms_agreed timestamp without time zone,
+ consider_pd boolean DEFAULT false NOT NULL,
+ auth_uid character varying,
+ preferred_editor character varying,
+ terms_seen boolean DEFAULT false NOT NULL,
+ description_format public.format_enum DEFAULT 'markdown'::public.format_enum NOT NULL,
+ changesets_count integer DEFAULT 0 NOT NULL,
+ traces_count integer DEFAULT 0 NOT NULL,
+ diary_entries_count integer DEFAULT 0 NOT NULL,
+ image_use_gravatar boolean DEFAULT false NOT NULL,
+ auth_provider character varying,
+ home_tile bigint,
+ tou_agreed timestamp without time zone
+);
+
+
+--
+-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.users_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
+
+
+--
+-- Name: way_nodes; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.way_nodes (
+ way_id bigint NOT NULL,
+ node_id bigint NOT NULL,
+ version bigint NOT NULL,
+ sequence_id bigint NOT NULL
+);
+
+
+--
+-- Name: way_tags; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.way_tags (
+ way_id bigint DEFAULT 0 NOT NULL,
+ k character varying NOT NULL,
+ v character varying NOT NULL,
+ version bigint NOT NULL
+);
+
+
+--
+-- Name: ways; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.ways (
+ way_id bigint DEFAULT 0 NOT NULL,
+ changeset_id bigint NOT NULL,
+ "timestamp" timestamp without time zone NOT NULL,
+ version bigint NOT NULL,
+ visible boolean DEFAULT true NOT NULL,
+ redaction_id integer
+);
+
+
+--
+-- Name: acls id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.acls ALTER COLUMN id SET DEFAULT nextval('public.acls_id_seq'::regclass);
+
+
+--
+-- Name: active_storage_attachments id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('public.active_storage_attachments_id_seq'::regclass);
+
+
+--
+-- Name: active_storage_blobs id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('public.active_storage_blobs_id_seq'::regclass);
+
+
+--
+-- Name: changeset_comments id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.changeset_comments ALTER COLUMN id SET DEFAULT nextval('public.changeset_comments_id_seq'::regclass);
+
+
+--
+-- Name: changesets id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.changesets ALTER COLUMN id SET DEFAULT nextval('public.changesets_id_seq'::regclass);
+
+
+--
+-- Name: client_applications id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.client_applications ALTER COLUMN id SET DEFAULT nextval('public.client_applications_id_seq'::regclass);
+
+
+--
+-- Name: current_nodes id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.current_nodes ALTER COLUMN id SET DEFAULT nextval('public.current_nodes_id_seq'::regclass);
+
+
+--
+-- Name: current_relations id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.current_relations ALTER COLUMN id SET DEFAULT nextval('public.current_relations_id_seq'::regclass);
+
+
+--
+-- Name: current_ways id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.current_ways ALTER COLUMN id SET DEFAULT nextval('public.current_ways_id_seq'::regclass);
+
+
+--
+-- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass);
+
+
+--
+-- Name: diary_comments id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.diary_comments ALTER COLUMN id SET DEFAULT nextval('public.diary_comments_id_seq'::regclass);
+
+
+--
+-- Name: diary_entries id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.diary_entries ALTER COLUMN id SET DEFAULT nextval('public.diary_entries_id_seq'::regclass);
+
+
+--
+-- Name: friends id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.friends ALTER COLUMN id SET DEFAULT nextval('public.friends_id_seq'::regclass);
+
+
+--
+-- Name: gpx_file_tags id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.gpx_file_tags ALTER COLUMN id SET DEFAULT nextval('public.gpx_file_tags_id_seq'::regclass);
+
+
+--
+-- Name: gpx_files id; Type: DEFAULT; Schema: public; Owner: -