Setting the file. One moment.
Subchapter 1.3
references/db-execute.mdMarkdown2 KBView on GitHub
prisma db execute [options]--file) or stdin (--stdin)migrate diff| Option | Description |
|---|---|
--file | Path to a file containing the script to execute |
--stdin | Use terminal standard input as the script |
--config | Custom path to your Prisma config file |
prisma db execute uses the datasource configured in prisma.config.ts. Use --config if you need a separate config file for another environment.
prisma db execute --file ./script.sqlecho "TRUNCATE TABLE User;" | prisma db execute --stdinPipe the output of migrate diff directly to the database:
prisma migrate diff \
--from-empty \
--to-schema prisma/schema.prisma \
--script \
| prisma db execute --stdinUses datasource from prisma.config.ts:
export default defineConfig({
datasource: {
url: env('DATABASE_URL'),
},
})migrate diff scriptsprisma studio to view data.