
SET transaction_timeout = 0;

--
-- TOC entry 5 (class 2615 OID 2200)
-- Name: public; Type: SCHEMA; Schema: -; Owner: web_sample
--

-- *not* creating schema, since initdb creates it


ALTER SCHEMA public OWNER TO web_sample;

--
-- TOC entry 854 (class 1247 OID 17356)
-- Name: request_type; Type: TYPE; Schema: public; Owner: postgres
--

CREATE TYPE public.request_type AS ENUM (
    'activation',
    'reset'
);


ALTER TYPE public.request_type OWNER TO postgres;



--
-- TOC entry 217 (class 1259 OID 17361)
-- Name: doc_data; Type: TABLE; Schema: public; Owner: web_sample
--

CREATE TABLE public.doc_data (
    doc_id integer NOT NULL,
    doc_name text NOT NULL,
    doc_type integer DEFAULT 0 NOT NULL,
    doc_attribute integer[] DEFAULT '{0}'::integer[],
    doc_url text,
    doc_comment text,
    create_person integer,
    create_date timestamp without time zone,
    update_person integer,
    update_date timestamp without time zone
);


ALTER TABLE public.doc_data OWNER TO web_sample;

--
-- TOC entry 218 (class 1259 OID 17368)
-- Name: doc_data_doc_id_seq; Type: SEQUENCE; Schema: public; Owner: web_sample
--

CREATE SEQUENCE public.doc_data_doc_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.doc_data_doc_id_seq OWNER TO web_sample;

--
-- TOC entry 4971 (class 0 OID 0)
-- Dependencies: 218
-- Name: doc_data_doc_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: web_sample
--

ALTER SEQUENCE public.doc_data_doc_id_seq OWNED BY public.doc_data.doc_id;

--
-- TOC entry 222 (class 1259 OID 17405)
-- Name: users_2fa_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.users_2fa_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.users_2fa_id_seq OWNER TO postgres;

--
-- TOC entry 4972 (class 0 OID 0)
-- Dependencies: 222
-- Name: users_2fa_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.users_2fa_id_seq OWNED BY public.users_2fa.id;


--
-- TOC entry 225 (class 1259 OID 17419)
-- Name: users_audit_log; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.users_audit_log (
    id bigint NOT NULL,
    user_id integer,
    event_at integer NOT NULL,
    event_type character varying(128) NOT NULL COLLATE pg_catalog."C",
    admin_id integer,
    ip_address inet,
    user_agent text,
    details_json jsonb,
    CONSTRAINT users_audit_log_admin_id_check CHECK ((admin_id >= 0)),
    CONSTRAINT users_audit_log_event_at_check CHECK ((event_at >= 0)),
    CONSTRAINT users_audit_log_user_id_check CHECK ((user_id >= 0))
);


ALTER TABLE public.users_audit_log OWNER TO postgres;

--
-- TOC entry 224 (class 1259 OID 17418)
-- Name: users_audit_log_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.users_audit_log_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.users_audit_log_id_seq OWNER TO postgres;

--
-- TOC entry 4973 (class 0 OID 0)
-- Dependencies: 224
-- Name: users_audit_log_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.users_audit_log_id_seq OWNED BY public.users_audit_log.id;


--
-- TOC entry 220 (class 1259 OID 17387)
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.users_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.users_id_seq OWNER TO postgres;

--
-- TOC entry 4974 (class 0 OID 0)
-- Dependencies: 220
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;


--
-- TOC entry 221 (class 1259 OID 17388)
-- Name: users_throttling; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.users_throttling (
    bucket character varying(44) NOT NULL COLLATE pg_catalog."C",
    tokens real NOT NULL,
    replenished_at integer NOT NULL,
    expires_at integer NOT NULL,
    CONSTRAINT users_throttling_expires_at_check CHECK ((expires_at >= 0)),
    CONSTRAINT users_throttling_replenished_at_check CHECK ((replenished_at >= 0)),
    CONSTRAINT users_throttling_tokens_check CHECK ((tokens >= (0)::double precision))
);


ALTER TABLE public.users_throttling OWNER TO postgres;

--
-- TOC entry 4764 (class 2604 OID 17394)
-- Name: doc_data doc_id; Type: DEFAULT; Schema: public; Owner: web_sample
--

ALTER TABLE ONLY public.doc_data ALTER COLUMN doc_id SET DEFAULT nextval('public.doc_data_doc_id_seq'::regclass);


--
-- TOC entry 4776 (class 2604 OID 17422)
-- Name: users_audit_log id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.users_audit_log ALTER COLUMN id SET DEFAULT nextval('public.users_audit_log_id_seq'::regclass);


--
-- TOC entry 4956 (class 0 OID 17361)
-- Dependencies: 217
-- Data for Name: doc_data; Type: TABLE DATA; Schema: public; Owner: web_sample
--

COPY public.doc_data (doc_id, doc_name, doc_type, doc_attribute, doc_url, doc_comment, create_person, create_date, update_person, update_date) FROM stdin;
1	test用のドキュメント１	1	{1,4}	http://www.google.co.jp	ここには、\r\n複数行の文字列が書けます。	1	2011-01-01 12:00:00	1	2011-02-02 08:39:43
2	test用のドキュメント２	3	{1,2,3}	http://www.yahoo.co.jp/	<b>ここに HTML のタグを書いても、\r\n単に文字列として、\r\nそのまま表示されます。</b>	1	2011-01-01 13:00:00	1	2011-02-02 08:10:23
3	test用のドキュメント３	4	{}	http://kakaku.com/	<b>ここに HTML タグを書いても、\r\nそのまま文字列として\r\n表示されます。</b>	1	2011-02-01 15:45:45	1	2011-02-02 08:11:01
\.


--
-- TOC entry 4964 (class 0 OID 17419)
-- Dependencies: 225
-- Data for Name: users_audit_log; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.users_audit_log (id, user_id, event_at, event_type, admin_id, ip_address, user_agent, details_json) FROM stdin;
1	1	1761444745	logout.local	\N	::/48	KxVb6BGyp9y9BNGFerXEgeOyOD1otD1aEyY8E5taRh8=	\N
\.


--
-- TOC entry 4960 (class 0 OID 17388)
-- Dependencies: 221
-- Data for Name: users_throttling; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.users_throttling (bucket, tokens, replenished_at, expires_at) FROM stdin;
Jjl8HEbTSJpZBWoyXOajJXqciuUdngUbah061jwhliE	17.183332	1761401897	1761437897
M9B8aXBXQY5Luv2J4sFxvQ2qgoQMibacUM4PcDs05UQ	497.95486	1761401897	1761574697
ejWtPDKvxt-q7LZ3mFjzUoIWKJYzu47igC8Jd9mffFk	70.290825	1761401981	1761941981
\.



--
-- TOC entry 4795 (class 2606 OID 17397)
-- Name: doc_data doc_data_pkey; Type: CONSTRAINT; Schema: public; Owner: web_sample
--

ALTER TABLE ONLY public.doc_data
    ADD CONSTRAINT doc_data_pkey PRIMARY KEY (doc_id);


--
-- TOC entry 4808 (class 2606 OID 17429)
-- Name: users_audit_log users_audit_log_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.users_audit_log
    ADD CONSTRAINT users_audit_log_pkey PRIMARY KEY (id);


--
-- TOC entry 4802 (class 2606 OID 17403)
-- Name: users_throttling users_throttling_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.users_throttling
    ADD CONSTRAINT users_throttling_pkey PRIMARY KEY (bucket);


--
-- TOC entry 4806 (class 1259 OID 17430)
-- Name: users_audit_log_event_at_ix; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX users_audit_log_event_at_ix ON public.users_audit_log USING btree (event_at);


--
-- TOC entry 4809 (class 1259 OID 17431)
-- Name: users_audit_log_user_id_event_at_ix; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX users_audit_log_user_id_event_at_ix ON public.users_audit_log USING btree (user_id, event_at);


--
-- TOC entry 4810 (class 1259 OID 17432)
-- Name: users_audit_log_user_id_event_type_event_at_ix; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX users_audit_log_user_id_event_type_event_at_ix ON public.users_audit_log USING btree (user_id, event_type, event_at);


--
-- TOC entry 4800 (class 1259 OID 17404)
-- Name: users_throttling_expires_at_ix; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX users_throttling_expires_at_ix ON public.users_throttling USING btree (expires_at);


--
-- TOC entry 4970 (class 0 OID 0)
-- Dependencies: 5
-- Name: SCHEMA public; Type: ACL; Schema: -; Owner: web_sample
--

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