[Driver Adapters]: missing provider compatibility validation #21864
Labels
bug/2-confirmed
Bug has been reproduced and confirmed.
domain/client
Issue in the "Client" domain: Prisma Client, Prisma Studio etc.
kind/bug
A reported bug.
topic: driverAdapters
topic: preview 👁
Milestone
Consider this (internal) Notion doc.
Considering this
schema.prisma
:The schema clearly uses the
postgres
provider.Now consider a TypeScript snippet in which we load
planetscale
's Driver Adapter:The schema clearly uses the
postgres
provider, yet we are allowed to load theplanetscale
's Driver Adapter, which should required themysql
provider. One can construct a particularly dangerous example in which, as long as the remotemysql
-based database has the same table definitions as the ones inferred in TypeScript from the Prisma schema, the user could accidentally write to the wrong database, and Prisma Client would give absolutely no indication of this mishap.So, we're missing a runtime validation error, which could be phrased as:
In particular, one can check that
adapter.flavour === 'mysql'
(see code).Edge case: Both
postgresql
andpostgres
are validprovider
s in thedatasource
block, but onlypostgres
is a valid value for theflavour
property of anyDriverAdapter
' class.Prisma:
5.5.2
The text was updated successfully, but these errors were encountered: