You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

444 lines
13 KiB
SQL

--
-- PostgreSQL database dump
--
-- Dumped from database version 15.2 (Ubuntu 15.2-1.pgdg20.04+1)
-- Dumped by pg_dump version 15.2 (Ubuntu 15.2-1.pgdg20.04+1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
--
-- Name: vector; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS vector WITH SCHEMA public;
--
-- Name: EXTENSION vector; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION vector IS 'vector data type and ivfflat access method';
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: chat_complete_conversation; Type: TABLE; Schema: public; Owner: hyperzlib
--
CREATE TABLE public.chat_complete_conversation (
id integer NOT NULL,
user_id integer NOT NULL,
title character varying(255) DEFAULT ''::character varying NOT NULL,
updated_at timestamp without time zone NOT NULL,
pinned boolean DEFAULT false NOT NULL,
rev_id bigint NOT NULL
);
ALTER TABLE public.chat_complete_conversation OWNER TO hyperzlib;
--
-- Name: chat_complete_conversation_chunk; Type: TABLE; Schema: public; Owner: hyperzlib
--
CREATE TABLE public.chat_complete_conversation_chunk (
id integer NOT NULL,
conversation_id bigint NOT NULL,
message_data text,
updated_at timestamp without time zone NOT NULL
);
ALTER TABLE public.chat_complete_conversation_chunk OWNER TO hyperzlib;
--
-- Name: chat_complete_conversation_chunk_conversation_id_seq; Type: SEQUENCE; Schema: public; Owner: hyperzlib
--
CREATE SEQUENCE public.chat_complete_conversation_chunk_conversation_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.chat_complete_conversation_chunk_conversation_id_seq OWNER TO hyperzlib;
--
-- Name: chat_complete_conversation_chunk_conversation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: hyperzlib
--
ALTER SEQUENCE public.chat_complete_conversation_chunk_conversation_id_seq OWNED BY public.chat_complete_conversation_chunk.conversation_id;
--
-- Name: chat_complete_conversation_chunk_id_seq; Type: SEQUENCE; Schema: public; Owner: hyperzlib
--
CREATE SEQUENCE public.chat_complete_conversation_chunk_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.chat_complete_conversation_chunk_id_seq OWNER TO hyperzlib;
--
-- Name: chat_complete_conversation_chunk_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: hyperzlib
--
ALTER SEQUENCE public.chat_complete_conversation_chunk_id_seq OWNED BY public.chat_complete_conversation_chunk.id;
--
-- Name: chat_complete_conversation_id_seq; Type: SEQUENCE; Schema: public; Owner: hyperzlib
--
CREATE SEQUENCE public.chat_complete_conversation_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.chat_complete_conversation_id_seq OWNER TO hyperzlib;
--
-- Name: chat_complete_conversation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: hyperzlib
--
ALTER SEQUENCE public.chat_complete_conversation_id_seq OWNED BY public.chat_complete_conversation.id;
--
-- Name: embedding_search_page_index; Type: TABLE; Schema: public; Owner: hyperzlib
--
CREATE TABLE public.embedding_search_page_index (
id integer NOT NULL,
page_id bigint NOT NULL,
sha1 character varying(40) NOT NULL,
text text NOT NULL,
text_len integer NOT NULL,
markdown text,
markdown_len integer,
embedding public.vector(1536) NOT NULL,
temp_doc_session_id bigint
);
ALTER TABLE public.embedding_search_page_index OWNER TO hyperzlib;
--
-- Name: embedding_search_page_index_id_seq; Type: SEQUENCE; Schema: public; Owner: hyperzlib
--
CREATE SEQUENCE public.embedding_search_page_index_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.embedding_search_page_index_id_seq OWNER TO hyperzlib;
--
-- Name: embedding_search_page_index_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: hyperzlib
--
ALTER SEQUENCE public.embedding_search_page_index_id_seq OWNED BY public.embedding_search_page_index.id;
--
-- Name: embedding_search_page_index_temp_doc_session_id_seq; Type: SEQUENCE; Schema: public; Owner: hyperzlib
--
CREATE SEQUENCE public.embedding_search_page_index_temp_doc_session_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.embedding_search_page_index_temp_doc_session_id_seq OWNER TO hyperzlib;
--
-- Name: embedding_search_page_index_temp_doc_session_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: hyperzlib
--
ALTER SEQUENCE public.embedding_search_page_index_temp_doc_session_id_seq OWNED BY public.embedding_search_page_index.temp_doc_session_id;
--
-- Name: embedding_search_temp_doc_session; Type: TABLE; Schema: public; Owner: hyperzlib
--
CREATE TABLE public.embedding_search_temp_doc_session (
id integer NOT NULL,
user_id bigint NOT NULL,
expired_at timestamp without time zone NOT NULL
);
ALTER TABLE public.embedding_search_temp_doc_session OWNER TO hyperzlib;
--
-- Name: embedding_search_temp_doc_session_id_seq; Type: SEQUENCE; Schema: public; Owner: hyperzlib
--
CREATE SEQUENCE public.embedding_search_temp_doc_session_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.embedding_search_temp_doc_session_id_seq OWNER TO hyperzlib;
--
-- Name: embedding_search_temp_doc_session_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: hyperzlib
--
ALTER SEQUENCE public.embedding_search_temp_doc_session_id_seq OWNED BY public.embedding_search_temp_doc_session.id;
--
-- Name: embedding_search_title_index; Type: TABLE; Schema: public; Owner: hyperzlib
--
CREATE TABLE public.embedding_search_title_index (
id integer NOT NULL,
sha1 character varying(40) NOT NULL,
title text NOT NULL,
rev_id bigint NOT NULL,
embedding public.vector(1536) NOT NULL,
page_id bigint NOT NULL,
parent_page_id bigint
);
ALTER TABLE public.embedding_search_title_index OWNER TO hyperzlib;
--
-- Name: embedding_search_title_index_id_seq; Type: SEQUENCE; Schema: public; Owner: hyperzlib
--
CREATE SEQUENCE public.embedding_search_title_index_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.embedding_search_title_index_id_seq OWNER TO hyperzlib;
--
-- Name: embedding_search_title_index_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: hyperzlib
--
ALTER SEQUENCE public.embedding_search_title_index_id_seq OWNED BY public.embedding_search_title_index.id;
--
-- Name: chat_complete_conversation id; Type: DEFAULT; Schema: public; Owner: hyperzlib
--
ALTER TABLE ONLY public.chat_complete_conversation ALTER COLUMN id SET DEFAULT nextval('public.chat_complete_conversation_id_seq'::regclass);
--
-- Name: chat_complete_conversation_chunk id; Type: DEFAULT; Schema: public; Owner: hyperzlib
--
ALTER TABLE ONLY public.chat_complete_conversation_chunk ALTER COLUMN id SET DEFAULT nextval('public.chat_complete_conversation_chunk_id_seq'::regclass);
--
-- Name: embedding_search_page_index id; Type: DEFAULT; Schema: public; Owner: hyperzlib
--
ALTER TABLE ONLY public.embedding_search_page_index ALTER COLUMN id SET DEFAULT nextval('public.embedding_search_page_index_id_seq'::regclass);
--
-- Name: embedding_search_temp_doc_session id; Type: DEFAULT; Schema: public; Owner: hyperzlib
--
ALTER TABLE ONLY public.embedding_search_temp_doc_session ALTER COLUMN id SET DEFAULT nextval('public.embedding_search_temp_doc_session_id_seq'::regclass);
--
-- Name: embedding_search_title_index id; Type: DEFAULT; Schema: public; Owner: hyperzlib
--
ALTER TABLE ONLY public.embedding_search_title_index ALTER COLUMN id SET DEFAULT nextval('public.embedding_search_title_index_id_seq'::regclass);
--
-- Name: chat_complete_conversation_chunk chat_complete_conversation_chunk_pk; Type: CONSTRAINT; Schema: public; Owner: hyperzlib
--
ALTER TABLE ONLY public.chat_complete_conversation_chunk
ADD CONSTRAINT chat_complete_conversation_chunk_pk PRIMARY KEY (id);
--
-- Name: chat_complete_conversation chat_complete_conversation_pkey; Type: CONSTRAINT; Schema: public; Owner: hyperzlib
--
ALTER TABLE ONLY public.chat_complete_conversation
ADD CONSTRAINT chat_complete_conversation_pkey PRIMARY KEY (id);
--
-- Name: embedding_search_page_index embedding_search_page_index_pkey; Type: CONSTRAINT; Schema: public; Owner: hyperzlib
--
ALTER TABLE ONLY public.embedding_search_page_index
ADD CONSTRAINT embedding_search_page_index_pkey PRIMARY KEY (id);
--
-- Name: embedding_search_temp_doc_session embedding_search_temp_doc_session_pkey; Type: CONSTRAINT; Schema: public; Owner: hyperzlib
--
ALTER TABLE ONLY public.embedding_search_temp_doc_session
ADD CONSTRAINT embedding_search_temp_doc_session_pkey PRIMARY KEY (id);
--
-- Name: embedding_search_title_index embedding_search_title_index_pkey; Type: CONSTRAINT; Schema: public; Owner: hyperzlib
--
ALTER TABLE ONLY public.embedding_search_title_index
ADD CONSTRAINT embedding_search_title_index_pkey PRIMARY KEY (id);
--
-- Name: embedding_search_title_index embedding_search_title_index_sha1_key; Type: CONSTRAINT; Schema: public; Owner: hyperzlib
--
ALTER TABLE ONLY public.embedding_search_title_index
ADD CONSTRAINT embedding_search_title_index_sha1_key UNIQUE (sha1);
--
-- Name: chat_complete_conversation_chunk_updated_at_idx; Type: INDEX; Schema: public; Owner: hyperzlib
--
CREATE INDEX chat_complete_conversation_chunk_updated_at_idx ON public.chat_complete_conversation_chunk USING btree (updated_at);
--
-- Name: chat_complete_conversation_pinned_idx; Type: INDEX; Schema: public; Owner: hyperzlib
--
CREATE INDEX chat_complete_conversation_pinned_idx ON public.chat_complete_conversation USING btree (pinned);
--
-- Name: chat_complete_conversation_updated_at_idx; Type: INDEX; Schema: public; Owner: hyperzlib
--
CREATE INDEX chat_complete_conversation_updated_at_idx ON public.chat_complete_conversation USING btree (updated_at);
--
-- Name: chat_complete_conversation_user_id_idx; Type: INDEX; Schema: public; Owner: hyperzlib
--
CREATE INDEX chat_complete_conversation_user_id_idx ON public.chat_complete_conversation USING btree (user_id);
--
-- Name: embedding_search_page_index_embedding_idx; Type: INDEX; Schema: public; Owner: hyperzlib
--
CREATE INDEX embedding_search_page_index_embedding_idx ON public.embedding_search_page_index USING ivfflat (embedding public.vector_cosine_ops);
--
-- Name: embedding_search_page_index_temp_doc_session_id_idx; Type: INDEX; Schema: public; Owner: hyperzlib
--
CREATE INDEX embedding_search_page_index_temp_doc_session_id_idx ON public.embedding_search_page_index USING btree (temp_doc_session_id);
--
-- Name: embedding_search_title_index_embedding_idx; Type: INDEX; Schema: public; Owner: hyperzlib
--
CREATE INDEX embedding_search_title_index_embedding_idx ON public.embedding_search_title_index USING ivfflat (embedding public.vector_cosine_ops);
--
-- Name: embedding_search_title_index_page_id_idx; Type: INDEX; Schema: public; Owner: hyperzlib
--
CREATE INDEX embedding_search_title_index_page_id_idx ON public.embedding_search_title_index USING btree (page_id);
--
-- Name: embedding_search_title_index_parent_page_id_idx; Type: INDEX; Schema: public; Owner: hyperzlib
--
CREATE INDEX embedding_search_title_index_parent_page_id_idx ON public.embedding_search_title_index USING btree (parent_page_id);
--
-- Name: chat_complete_conversation_chunk chat_complete_conversation_chunk_fk; Type: FK CONSTRAINT; Schema: public; Owner: hyperzlib
--
ALTER TABLE ONLY public.chat_complete_conversation_chunk
ADD CONSTRAINT chat_complete_conversation_chunk_fk FOREIGN KEY (conversation_id) REFERENCES public.chat_complete_conversation(id);
--
-- Name: embedding_search_page_index embedding_search_page_index_fk; Type: FK CONSTRAINT; Schema: public; Owner: hyperzlib
--
ALTER TABLE ONLY public.embedding_search_page_index
ADD CONSTRAINT embedding_search_page_index_fk FOREIGN KEY (page_id) REFERENCES public.embedding_search_page_index(id) ON DELETE CASCADE;
--
-- Name: embedding_search_page_index embedding_search_page_index_fk_1; Type: FK CONSTRAINT; Schema: public; Owner: hyperzlib
--
ALTER TABLE ONLY public.embedding_search_page_index
ADD CONSTRAINT embedding_search_page_index_fk_1 FOREIGN KEY (temp_doc_session_id) REFERENCES public.embedding_search_temp_doc_session(id) ON DELETE CASCADE;
--
-- PostgreSQL database dump complete
--