--
--

\restrict DqVhAj2Wuw8VqTMgYlHlhNiuBphmZSPDpZw74TS9HTUr1oOzUqJim5SPXKFpBoV


-- Started on 2025-10-26 11:12:58

SET transaction_timeout = 0;
SELECT pg_catalog.set_config('search_path', '', false);

--
-- 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 219 (class 1259 OID 17369)
-- Name: users; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.users (
    id integer NOT NULL,
    email character varying(249) NOT NULL,
    password character varying(255) NOT NULL COLLATE pg_catalog."C",
    username character varying(100) DEFAULT NULL::character varying,
    status smallint DEFAULT 0 NOT NULL,
    verified smallint DEFAULT 0 NOT NULL,
    resettable smallint DEFAULT 1 NOT NULL,
    roles_mask integer DEFAULT 0 NOT NULL,
    registered integer NOT NULL,
    last_login integer,
    force_logout integer DEFAULT 0 NOT NULL,
    CONSTRAINT users_force_logout_check CHECK ((force_logout >= 0)),
    CONSTRAINT users_last_login_check CHECK ((last_login >= 0)),
    CONSTRAINT users_registered_check CHECK ((registered >= 0)),
    CONSTRAINT users_resettable_check CHECK (((resettable >= 0) AND (resettable <= 1))),
    CONSTRAINT users_roles_mask_check CHECK ((roles_mask >= 0)),
    CONSTRAINT users_status_check CHECK ((status >= 0)),
    CONSTRAINT users_verified_check CHECK (((verified >= 0) AND (verified <= 1)))
);


ALTER TABLE public.users OWNER TO postgres;

--
-- TOC entry 223 (class 1259 OID 17406)
-- Name: users_2fa; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.users_2fa (
    id bigint NOT NULL,
    user_id integer NOT NULL,
    mechanism smallint NOT NULL,
    seed character varying(255) DEFAULT NULL::character varying COLLATE pg_catalog."C",
    created_at integer NOT NULL,
    expires_at integer,
    CONSTRAINT users_2fa_created_at_check CHECK ((created_at >= 0)),
    CONSTRAINT users_2fa_expires_at_check CHECK ((expires_at >= 0)),
    CONSTRAINT users_2fa_mechanism_check CHECK ((mechanism >= 0)),
    CONSTRAINT users_2fa_user_id_check CHECK ((user_id >= 0))
);


ALTER TABLE public.users_2fa OWNER TO postgres;

--
-- 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 4767 (class 2604 OID 17395)
-- Name: users id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- TOC entry 4774 (class 2604 OID 17409)
-- Name: users_2fa id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.users_2fa ALTER COLUMN id SET DEFAULT nextval('public.users_2fa_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 4958 (class 0 OID 17369)
-- Dependencies: 219
-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.users (id, email, password, username, status, verified, resettable, roles_mask, registered, last_login, force_logout) FROM stdin;
1	user1@sample.com	$2y$12$r6XODnNnzcKFwsVrZdEdFuxqYfecMIbC4mcie5G4usfTNtURFJup.	user1	0	1	1	0	1761401673	\N	0
2	user2@sample.com	$2y$12$r6XODnNnzcKFwsVrZdEdFuxqYfecMIbC4mcie5G4usfTNtURFJup.	user2	0	1	1	0	1761401673	\N	0
3	user3@sample.com	$2y$12$r6XODnNnzcKFwsVrZdEdFuxqYfecMIbC4mcie5G4usfTNtURFJup.	user3	0	1	1	0	1761401673	\N	0
\.


--
-- TOC entry 4962 (class 0 OID 17406)
-- Dependencies: 223
-- Data for Name: users_2fa; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.users_2fa (id, user_id, mechanism, seed, created_at, expires_at) FROM stdin;
\.


--
-- 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 4975 (class 0 OID 0)
-- Dependencies: 218
-- Name: doc_data_doc_id_seq; Type: SEQUENCE SET; Schema: public; Owner: web_sample
--

SELECT pg_catalog.setval('public.doc_data_doc_id_seq', 28, true);


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

SELECT pg_catalog.setval('public.users_2fa_id_seq', 1, false);


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

SELECT pg_catalog.setval('public.users_audit_log_id_seq', 1, true);


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

SELECT pg_catalog.setval('public.users_id_seq', 1, false);


--
-- 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 4804 (class 2606 OID 17416)
-- Name: users_2fa users_2fa_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.users_2fa
    ADD CONSTRAINT users_2fa_pkey PRIMARY KEY (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 4797 (class 2606 OID 17399)
-- Name: users users_email_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.users
    ADD CONSTRAINT users_email_key UNIQUE (email);


--
-- TOC entry 4799 (class 2606 OID 17401)
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.users
    ADD CONSTRAINT users_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 4805 (class 1259 OID 17417)
-- Name: users_2fa_user_id_mechanism_uq; Type: INDEX; Schema: public; Owner: postgres
--

CREATE UNIQUE INDEX users_2fa_user_id_mechanism_uq ON public.users_2fa USING btree (user_id, mechanism);


--
-- 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;


-- Completed on 2025-10-26 11:12:58

--
--

\unrestrict DqVhAj2Wuw8VqTMgYlHlhNiuBphmZSPDpZw74TS9HTUr1oOzUqJim5SPXKFpBoV

