-
-
Notifications
You must be signed in to change notification settings - Fork 334
Description
What problem are you trying to solve?
When running the EF Core Power Tools or the standard dotnet ef dbcontext scaffold command against a PostgreSQL database using the pgvector extension, the scaffolding process fails to map the vector data type.
As a result, columns intended for embeddings are skipped, and their associated indexes (such as HNSW) are not generated in the DbContext or entity models.
Steps to Reproduce
1.- Have a PostgreSQL database with the pgvector extension enabled.
2.- Create a table with a vector column, for example:
SQL
CREATE TABLE documento_resumen (
id SERIAL PRIMARY KEY,
embedding vector(768)
);
CREATE INDEX idx_doc_resumen_embedding_hnsw ON documento_resumen USING hnsw (embedding vector_cosine_ops);
3.- Run the scaffolding command
4.- Expected Behavior
The scaffolding engine should recognize the vector(n) type (likely mapping it to a Vector or float[] type if the Pgvector.EntityFrameworkCore.PostgreSQL library is present) and include the column and its indexes in the generated code.
5.- Actual Behavior
The following warnings are displayed, and the columns/indexes are omitted:
Describe the solution you'd like
- Proposed Solution
Implement support for the vector data type within the scaffolding type mapper. Since pgvector is becoming a standard for AI-driven applications using PostgreSQL, native support for scaffolding these fields would significantly improve the developer experience for RAG (Retrieval-Augmented Generation) workflows.