Unsupported database features
Prisma Migrate uses the Prisma schema to determine what features to create in the database. However, some database features cannot be represented in the Prisma schema , including but not limited to:
- Stored procedures
- Triggers
- Views
- Partial indexes
To add an unsupported feature to your database, you must customize a migration to include that feature before you apply it.
The Prisma schema is able to represent unsupported field types and native database functions.
This guide does not apply for MongoDB.
Instead of migrate dev
, db push
is used for MongoDB.
Customize a migration to include an unsupported feature
To customize a migration to include an unsupported feature:
Use the
--create-only
flag to generate a new migration without applying it:$npx prisma migrate dev --create-onlyOpen the generated
migration.sql
file and add the unsupported feature - for example, a partial index:CREATE UNIQUE INDEX tests_success_constraintON posts (subject, target)WHERE success;Apply the migration:
$npx prisma migrate devCommit the modified migration to source control.