Database Connectors
Connectors implement database-specific validation, native types, and capabilities. They extend the generic PSL validation with provider-specific logic.Connector Trait
TheConnector trait defines the interface for all database connectors:
Connectors are stateless - all methods take
&self. Configuration and state live in the Datasource type.Built-in Connectors
PSL provides connectors for all supported databases:PostgreSQL Connector
Provider:postgresql
Capabilities:
- Extensions support (e.g.,
postgis,uuid-ossp) - Multi-schema support
- Advanced indexing (GIN, GIST, BRIN)
- Full-text search
- Partial indexes with WHERE clauses
MySQL Connector
Provider:mysql
Capabilities:
- Index column length prefixing
- Full-text indexes
- Multiple character sets
- Enum type support
SQLite Connector
Provider:sqlite
Capabilities:
- No enums (emulated as CHECK constraints)
- No native JSON type (stored as TEXT)
- Limited ALTER TABLE support
- No foreign key actions in some configurations
SQL Server (MSSQL) Connector
Provider:sqlserver
Capabilities:
CockroachDB Connector
Provider:cockroachdb
Features:
- Extends PostgreSQL connector
- Distributed SQL capabilities
- Some PostgreSQL features unsupported
MongoDB Connector
Provider:mongodb
Status: Limited Query Compiler support
Capabilities:
MongoDB support in Query Compiler is incomplete. Prisma 7 will ship without MongoDB initially, with support added when a driver adapter is available.
Connector Capabilities
Capabilities describe what functionality a connector provides:Schema Capabilities
Enums- Native enum supportScalarLists- Array/list fieldsJson- Native JSON typeJsonLists- JSON array supportCompositeTypes- Embedded/composite typesMultiSchema- Multiple database schemas
ID and Key Capabilities
AutoIncrement- Auto-incrementing IDsAutoIncrementAllowedOnNonId- Autoincrement on non-ID fieldsAutoIncrementMultipleAllowed- Multiple autoincrement fieldsCompoundIds- Multi-field primary keysAnyId- Any unique can serve as IDNamedPrimaryKeys- Custom primary key namesNamedForeignKeys- Custom foreign key names
Index Capabilities
FullTextIndex- Full-text search indexesIndexColumnLengthPrefixing- Index prefix length (MySQL)PartialIndex- Partial indexes with WHEREClusteringSetting- Clustered indexes
Query Capabilities
InsensitiveFilters- Case-insensitive filteringJsonFiltering- JSON field filteringJsonFilteringArrayPath- Array path in JSON (Postgres)JsonFilteringJsonPath- JSON path syntax (MySQL)NativeFullTextSearch- Full-text search queriesOrderByNullsFirstLast- NULL ordering controlLateralJoin- Lateral joinsDistinctOn- DISTINCT ON support
Write Capabilities
CreateMany- Batch insertsCreateSkipDuplicates- INSERT … ON CONFLICT DO NOTHINGCreateManyWriteableAutoIncId- Specify autoincrement values in batchWritableAutoincField- Override autoincrement valuesUpdateableId- Modify primary key valuesNativeUpsert- Native UPSERT supportInsertReturning- INSERT … RETURNINGUpdateReturning- UPDATE … RETURNINGDeleteReturning- DELETE … RETURNING
Transaction Capabilities
SupportsTxIsolationReadUncommittedSupportsTxIsolationReadCommittedSupportsTxIsolationRepeatableReadSupportsTxIsolationSerializableSupportsTxIsolationSnapshot
Relation Modes
Connectors support different relation modes:Foreign Keys Mode
Relations enforced by database constraints:Cascade- Delete/update cascadesRestrict- Prevent if references existNoAction- Like Restrict, but deferrableSetNull- Set to NULLSetDefault- Set to default value
Prisma Mode
Relations emulated by Prisma Client:Prisma mode requires manual indexes on relation fields. The database won’t enforce referential integrity.
Native Type Validation
Connectors validate native type usage:Connector-Specific Validations
Model Validation
- Composite types only on MongoDB
- Enum arrays only on supported databases
- Multi-schema requirements
Enum Validation
Datasource Validation
Flavour System
Flavours group similar databases:- Query syntax variations
- Type system similarities
- Shared capabilities
Custom Connectors
You can implement custom connectors for new databases:Constraint Scopes
Define where constraint names must be unique:String Filters
Connectors can customize available string operations:Testing Connectors
Test connector-specific behavior:Next Steps
PSL Overview
Return to PSL architecture overview
Validation
Learn about the validation pipeline