-- Oracle 23ai Vector Store Schema
-- Run this against your Oracle 23ai instance before starting the MCP server.

CREATE TABLE vector_store (
    id          VARCHAR2(36)  DEFAULT SYS_GUID()   NOT NULL,
    doc_id      VARCHAR2(255)                       NOT NULL,
    chunk_text  CLOB                                NOT NULL,
    embedding   VECTOR(1536, FLOAT32),
    created_at  TIMESTAMP     DEFAULT SYSTIMESTAMP  NOT NULL,
    updated_at  TIMESTAMP     DEFAULT SYSTIMESTAMP  NOT NULL,
    CONSTRAINT pk_vector_store PRIMARY KEY (id)
);

-- Vector index for cosine similarity search
CREATE VECTOR INDEX idx_vector_store_embedding
    ON vector_store (embedding)
    ORGANIZATION NEIGHBOR PARTITIONS
    WITH DISTANCE COSINE;
