Prisma
Use the prismaExtension build extension to use Prisma with Trigger.dev
If you are using Prisma, you should use the prisma build extension.
- Automatically handles copying Prisma files to the build directory
- Generates the Prisma client during the deploy process
- Optionally will migrate the database during the deploy process
- Support for TypedSQL and multiple schema files
- You can use
prismaSchemaFolder
to specify just the directory containing your schema file, instead of the full path - You can add the extension twice if you have multiple separate schemas in the same project (example below)
You can use it for a simple Prisma setup like this:
This does not have any effect when running the dev
command, only when running the deploy
command.
Migrations
If you want to also run migrations during the build process, you can pass in the migrate
option:
clientGenerator
If you have multiple generator
statements defined in your schema file, you can pass in the clientGenerator
option to specify the prisma-client-js
generator, which will prevent other generators from being generated. Some examples where you may need to do this include when using the prisma-kysely
or prisma-json-types-generator
generators.
TypedSQL
If you are using TypedSQL, you’ll need to enable it via the typedSql
option:
The prismaExtension
will inject the DATABASE_URL
environment variable into the build process. Learn more about setting environment variables for deploying in our Environment Variables guide.
These environment variables are only used during the build process and are not embedded in the final container image.
Multiple schemas
If you have multiple separate schemas in the same project you can add the extension multiple times: