Newer
Older
gcprag / schema.sql
CREATE EXTENSION IF NOT EXISTS vector;
CREATE EXTENSION IF NOT EXISTS hstore;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

-- Documents table
CREATE TABLE documents (
    id uuid DEFAULT uuid_generate_v4() PRIMARY KEY,
    source_url text UNIQUE NOT NULL,
    title text,
    date_last_modified timestamp,
    metadata jsonb,
    created_at timestamp DEFAULT CURRENT_TIMESTAMP
);

-- Chunks table
CREATE TABLE chunks (
    id uuid DEFAULT uuid_generate_v4() PRIMARY KEY,
    document_id uuid REFERENCES documents(id) ON DELETE CASCADE,
    chunk_index text,
    content text,
    embedding vector,
    created_at timestamp DEFAULT CURRENT_TIMESTAMP
);