CREATE EXTENSION IF NOT EXISTS vector;
CREATE EXTENSION IF NOT EXISTS hstore;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

CREATE TABLE IF NOT EXISTS vector_store (
    id                  uuid DEFAULT uuid_generate_v4() PRIMARY KEY,
    document_id         text,
    title               text,
    chunk_index         text,
    content             text,
    source_url          text,
    date_last_modified  timestamp,
    metadata            jsonb,
    embedding           vector
);

CREATE INDEX ON vector_store USING HNSW (embedding vector_cosine_ops);