Problem
ZModel's @db.* native type attributes are validated against the field's type (@@@targetField) but not against the datasource provider. Under a sqlite datasource, this compiles without any diagnostic:
datasource db {
provider = "sqlite"
url = "file:./dev.db"
}
model M {
id Int @id
v String @db.VarChar(200) // silently ignored
}
Prisma's sqlite connector registers no native types at all and fails validation instead (verified with Prisma 6.19):
P1012: Native type VarChar is not supported for sqlite connector.
Since SQLite is affinity-typed, the migration engine (and DDL generation generally) ignores the attribute — so the user's declared intent is silently dropped. This surfaces when switching a project's provider to sqlite or when authoring against multiple providers: no error, no warning, no effect.
Expected
Validation should scope native type attributes by connector, like Prisma:
- reject any
@db.* attribute when the datasource provider is sqlite;
- ideally, also enforce per-connector attribute lists for
postgresql/mysql (e.g. @db.Uuid is pg-only, @db.LongText is mysql-only), which would additionally resolve the related @db.TinyInt-on-Boolean mismatch tracked separately.
Context
Found while building the Prisma physical-schema parity test suite for the native migration engine. Physical-schema parity itself is unaffected (Prisma-validated schemas can't contain the construct), but the validation behavior diverges.
Problem
ZModel's
@db.*native type attributes are validated against the field's type (@@@targetField) but not against the datasource provider. Under asqlitedatasource, this compiles without any diagnostic:Prisma's sqlite connector registers no native types at all and fails validation instead (verified with Prisma 6.19):
Since SQLite is affinity-typed, the migration engine (and DDL generation generally) ignores the attribute — so the user's declared intent is silently dropped. This surfaces when switching a project's provider to sqlite or when authoring against multiple providers: no error, no warning, no effect.
Expected
Validation should scope native type attributes by connector, like Prisma:
@db.*attribute when the datasource provider issqlite;postgresql/mysql(e.g.@db.Uuidis pg-only,@db.LongTextis mysql-only), which would additionally resolve the related@db.TinyInt-on-Boolean mismatch tracked separately.Context
Found while building the Prisma physical-schema parity test suite for the native migration engine. Physical-schema parity itself is unaffected (Prisma-validated schemas can't contain the construct), but the validation behavior diverges.