Extensions
Prisma Postgres supports standard PostgreSQL extensions. Extensions add functionality such as vector search, full-text search, fuzzy matching, and cryptographic functions to your database.
Enable any supported extension using standard SQL:
CREATE EXTENSION IF NOT EXISTS vector;This works from any PostgreSQL client: psql, a GUI like TablePlus, a migration file, or a raw SQL query from your application.
The plpgsql extension is enabled by default on all Prisma Postgres instances.
Prisma ORM doesn't natively support all extension types yet. For extensions that introduce custom types (like vector from pgvector), you can use customized migrations and raw SQL or TypedSQL to work with them.
The following walkthrough uses pgvector as an example.
bunx prisma migrate dev --name add-pgvector --create-onlypnpm prisma migrate dev --name add-pgvector --create-onlyyarn prisma migrate dev --name add-pgvector --create-onlynpx prisma migrate dev --name add-pgvector --create-onlyThe --create-only flag creates the migration file without applying it, so you can add custom SQL first.
2. Add the extension and table to your migration
Section titled “2. Add the extension and table to your migration”Edit the generated migration file to enable the extension and create your table:
-- prisma/migrations/<timestamp>-add-pgvector/migration.sql
CREATE EXTENSION IF NOT EXISTS vector;
CREATE TABLE "Document" (
id SERIAL PRIMARY KEY,
title TEXT NOT NULL,
embedding VECTOR(4) -- dimensions depend on your embedding model
);bunx prisma migrate deploypnpm prisma migrate deployyarn prisma migrate deploynpx prisma migrate deployIntrospect your database to update your Prisma schema with the new table:
bunx prisma db pullpnpm prisma db pullyarn prisma db pullnpx prisma db pullBecause Prisma ORM doesn't natively support the VECTOR type, it will be represented as Unsupported:
model Document {
id Int @id @default(autoincrement())
title String
embedding Unsupported("vector")?
}Because Prisma ORM doesn't natively support the VECTOR type, it will be represented as Unsupported:
model Document {
id Int @id @default(autoincrement())
title String
embedding Unsupported("vector")?
}Use $executeRaw or $queryRaw to interact with extension-specific types:
await prisma.$executeRaw`
INSERT INTO "Document" (title, embedding)
VALUES ('My Title', '[1,22,1,42]'::vector)
`;You can also use TypedSQL for type-safe queries.
View all supported extensions
amcheckautoincbloombtree_ginbtree_gistcitextcubedblinkdict_intdict_xsynearthdistancefile_fdwfuzzystrmatchhstoreinsert_usernameintaggintarrayisnloltreemoddatetimepageinspectpg_buffercachepg_freespacemappg_prewarmpg_searchpg_stat_statementspg_surgerypg_trgmpg_visibilitypg_walinspectpgcryptopgrowlockspgstattupleplpgsql(enabled by default)postgres_fdwrefintsegsslinfotablefunctcntsm_system_rowstsm_system_timeunaccentuuid-osspvectorxml2
If you need an extension that is not listed, request an extension.
- Prisma Studio does not support tables that use custom types from extensions (e.g.,
VECTOR). Queries against those tables will return a deserialization error. - Prisma ORM does not natively support all extension types. Custom types are represented as
Unsupportedin your schema and must be queried with raw SQL.