UPDATE: Chatbot module
All checks were successful
Build and Release / release (push) Successful in 2m13s
All checks were successful
Build and Release / release (push) Successful in 2m13s
This commit is contained in:
2
db/migrations/0000013_rag_documents.down.sql
Normal file
2
db/migrations/0000013_rag_documents.down.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
DROP TABLE IF EXISTS rag_chunks;
|
||||
DROP EXTENSION IF EXISTS vector;
|
||||
21
db/migrations/0000013_rag_documents.up.sql
Normal file
21
db/migrations/0000013_rag_documents.up.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
CREATE EXTENSION IF NOT EXISTS vector;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rag_chunks (
|
||||
id UUID PRIMARY KEY DEFAULT uuidv7(),
|
||||
source_type VARCHAR(50) NOT NULL,
|
||||
source_id UUID NOT NULL,
|
||||
project_id UUID REFERENCES projects(id) ON DELETE CASCADE,
|
||||
chunk_index INT NOT NULL,
|
||||
content TEXT NOT NULL,
|
||||
embedding vector(3072),
|
||||
created_at TIMESTAMPTZ DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE INDEX idx_rag_chunks_source ON rag_chunks(source_type, source_id);
|
||||
CREATE INDEX idx_rag_chunks_project ON rag_chunks(project_id);
|
||||
|
||||
CREATE TRIGGER trigger_rag_chunks_updated_at
|
||||
BEFORE UPDATE ON rag_chunks
|
||||
FOR EACH ROW
|
||||
EXECUTE FUNCTION update_updated_at();
|
||||
@@ -1,6 +1,7 @@
|
||||
CREATE EXTENSION IF NOT EXISTS postgis;
|
||||
CREATE EXTENSION IF NOT EXISTS pg_trgm;
|
||||
CREATE EXTENSION IF NOT EXISTS btree_gist;
|
||||
CREATE EXTENSION IF NOT EXISTS vector;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id UUID PRIMARY KEY DEFAULT uuidv7(),
|
||||
|
||||
@@ -4,7 +4,7 @@ CREATE TABLE IF NOT EXISTS wikis (
|
||||
id UUID PRIMARY KEY DEFAULT uuidv7(),
|
||||
project_id UUID NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
|
||||
title TEXT,
|
||||
content JSONB,
|
||||
content TEXT,
|
||||
is_deleted BOOLEAN NOT NULL DEFAULT false,
|
||||
created_at TIMESTAMPTZ DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ DEFAULT now()
|
||||
|
||||
Reference in New Issue
Block a user