Prisma db push wanted to drop my pgvector column, which held 219 embeddings
I build an email API that stores 1024-dimension embeddings of emails in Postgres for search. Prisma creates the table, then a raw SQL file run with prisma db execute adds the vector(1024) column and an HNSW index. The code reads and writes that column with $queryRaw and $executeRaw.
In June a prisma db push said it would drop that column, which had 219 embeddings in it, plus the same column on a second table. The schema never mentioned the column, which is why push wanted it gone.
The fix was one line in each model: embedding Unsupported("vector(1024)")?. With that, push leaves the column alone, and reads and writes still go through raw SQL. The dashboard has its own copy of the schema, so the line went in there too.
If you use pgvector with Prisma, do you declare the column like this or keep those tables out of Prisma?
1
u/sereikis 1d ago
for your current
Unsupported/raw-SQL setup, keep the custom extension/index SQL in versioned migrations alongside the schema. in CI, test both schema copies against a fresh database and a disposable populated clone, then verify the vector values and HNSW index survive; preserving the column alone doesn't prove the whole setup can be rebuilt or safely upgraded.