-- PostgreSQL setup for pgvector demo
-- Run as superuser (dl) against the vectors_demo database
--
-- Usage:
--   docker exec -i postgresql-database-1 psql -U dl -d vectors_demo -f - < pgvector-demo/sql/setup.sql

CREATE EXTENSION IF NOT EXISTS vector;

CREATE TABLE IF NOT EXISTS images (
    id        SERIAL PRIMARY KEY,
    filename  TEXT NOT NULL UNIQUE,
    filepath  TEXT NOT NULL,
    embedding vector(512)
);

CREATE INDEX IF NOT EXISTS images_embedding_idx
    ON images USING hnsw (embedding vector_cosine_ops);
