// This is your Prisma schema file,
 
// learn more about it in the docs: https://pris.ly/d/prisma-schema
 
  
 
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
 
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
 
  
 
generator client {
 
provider = "prisma-client-js"
 
previewFeatures = ["prismaSchemaFolder", "multiSchema", "strictUndefinedChecks", "postgresqlExtensions", "typedSql"]
 
binaryTargets = ["native", "rhel-openssl-3.0.x", "rhel-openssl-1.0.x"]
 
}
 
  
 
datasource db {
 
provider = "postgresql"
 
url = env("DATABASE_URL")
 
directUrl = env("DIRECT_URL")
 
schemas = ["public"]
 
extensions = [pgvector(map: "vector", schema: "public")]
 
}
 
  
 
model Content {
 
id String @id @default(uuid(7))
 
embedding Unsupported("vector")?
 
  
 
@@schema("public")
 
}

こんな感じのスキーマでpgvector使おうとすると、Supabaseで元々有効になっている拡張機能とコンフリクトしてエラーになる:

$ pnpm db:migrate
 
> prisma-supabsae-pgvector@0.1.0 db:migrate /home/yuta/prisma-supabsae-pgvector
> prisma migrate dev
 
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "postgres", schemas "public" at "aws-0-ap-northeast-1.pooler.supabase.com:5432"
 
Drift detected: Your database schema is not in sync with your migration history.
 
The following is a summary of the differences between the expected database schema given your migrations files, and the actual schema of the database.
 
It should be understood as the set of changes to get from the expected schema to the actual schema.
 
If you are running this the first time on an existing database, please make sure to read this documentation page:
https://www.prisma.io/docs/guides/database/developing-with-prisma-migrate/troubleshooting-development
 
[+] Added extensions
  - pg_graphql
 
[+] Added extensions
  - pg_stat_statements
 
[+] Added extensions
  - pgcrypto
 
[+] Added extensions
  - pgjwt
 
[+] Added extensions
  - pgsodium
 
[+] Added extensions
  - supabase_vault
 
[+] Added extensions
  - uuid-ossp
 
? We need to reset the following schemas: "public" at "aws-0-ap-northeast-1.pooler.supabase.com:5432"
Do you want to continue? All data will be lost. (y/N)