--
-- PostgreSQL database dump
--

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;

--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: 
--

CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;


--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: 
--

COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';


SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: migrations; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE migrations (
    version integer NOT NULL
);


ALTER TABLE public.migrations OWNER TO postgres;

--
-- Name: prefs; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE prefs (
    username character varying(255) NOT NULL,
    options text NOT NULL
);


ALTER TABLE public.prefs OWNER TO postgres;

--
-- Name: sessions; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE sessions (
    session_id character varying(40) DEFAULT 0 NOT NULL,
    ip_address character varying(16) DEFAULT 0 NOT NULL,
    user_agent character varying(120) DEFAULT NULL::character varying,
    last_activity bigint DEFAULT 0 NOT NULL,
    user_data text NOT NULL
);


ALTER TABLE public.sessions OWNER TO postgres;

--
-- Name: shared_sid_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE shared_sid_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.shared_sid_seq OWNER TO postgres;

--
-- Name: shared; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE shared (
    sid integer DEFAULT nextval('shared_sid_seq'::regclass) NOT NULL,
    user_from character varying(255) NOT NULL,
    calendar character varying(255) NOT NULL,
    user_which character varying(255) NOT NULL,
    options text DEFAULT ''::text NOT NULL,
    write_access boolean DEFAULT false NOT NULL
);


ALTER TABLE public.shared OWNER TO postgres;

--
-- Name: prefs_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY prefs
    ADD CONSTRAINT prefs_pkey PRIMARY KEY (username);


--
-- Name: sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY sessions
    ADD CONSTRAINT sessions_pkey PRIMARY KEY (session_id);


--
-- Name: shared_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY shared
    ADD CONSTRAINT shared_pkey PRIMARY KEY (sid);


--
-- Name: last_activity_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX last_activity_idx ON sessions USING btree (last_activity);


--
-- Name: sharedwithidx; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX sharedwithidx ON shared USING btree (user_which);


--
-- Name: shareidx; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX shareidx ON shared USING btree (user_from, calendar);


--
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


--
-- PostgreSQL database dump complete
--

