Skip to content

Commit 6d9fa27

Browse files
Arthur GambyArthur Gamby
authored andcommitted
docs: clarify prisma db seed is only run explicitly in v7
Automatic seeding during migrate dev/reset was removed in v7.
1 parent 7c14b9d commit 6d9fa27

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

content/200-orm/300-prisma-migrate/300-workflows/10-seeding.mdx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,16 @@ export default defineConfig({
3737

3838
Database seeding happens when you run `prisma db seed`. With `prisma db seed`, _you_ decide when to invoke the seed command. It can be useful for a test setup or to prepare a new development environment, for example.
3939

40+
:::info[Prisma ORM v7 changes]
4041

41-
### Prisma 6 Only
42-
Prisma Migrate also integrates seamlessly with your seeds, assuming you follow the steps in the section below. Seeding is triggered automatically when Prisma Migrate resets the development database.
42+
In Prisma ORM v7, seeding is **only triggered explicitly** by running `npx prisma db seed`. Automatic seeding during `prisma migrate dev` or `prisma migrate reset` has been removed.
43+
44+
:::
45+
46+
<details>
47+
<summary>Prisma ORM v6 and earlier</summary>
48+
49+
In Prisma ORM v6 and earlier, Prisma Migrate also integrates seamlessly with your seeds. Seeding is triggered automatically when Prisma Migrate resets the development database.
4350

4451
Prisma Migrate resets the database and triggers seeding in the following scenarios:
4552

@@ -49,6 +56,8 @@ Prisma Migrate resets the database and triggers seeding in the following scenari
4956

5057
When you want to use `prisma migrate dev` or `prisma migrate reset` without seeding, you can pass the `--skip-seed` flag.
5158

59+
</details>
60+
5261
## Example seed scripts
5362

5463
Here we suggest some specific seed scripts for different situations. You are free to customize these in any way, but can also use them as presented here:

content/200-orm/500-reference/325-prisma-config-reference.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,13 @@ The path to the directory where Prisma should store migration files, and look fo
176176

177177
### `migrations.seed`
178178

179-
This option allows you to define a script that Prisma runs to seed your database after running migrations or using the npx prisma db seed command. The string should be a command that can be executed in your terminal, such as with `node`, `ts-node`, or `tsx`.
179+
This option allows you to define a script that Prisma runs when you execute the `npx prisma db seed` command. The string should be a command that can be executed in your terminal, such as with `node`, `ts-node`, or `tsx`.
180+
181+
:::info[Prisma ORM v7 changes]
182+
183+
In Prisma ORM v7, seeding is only triggered explicitly via `npx prisma db seed`. In Prisma ORM v6 and earlier, the seed script also ran automatically after `prisma migrate dev` and `prisma migrate reset`.
184+
185+
:::
180186

181187
| Property | Type | Required | Default |
182188
| ----------------- | -------- | -------- | ------- |

content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/400-upgrading-to-prisma-7.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,16 @@ const prisma = new PrismaClient().$extends({
337337
})
338338
```
339339

340+
### Automatic seeding during migrations has been removed
341+
342+
In Prisma ORM v6 and earlier, running `prisma migrate dev` or `prisma migrate reset` would automatically execute your seed script after applying migrations. This automatic seeding behavior has been removed in Prisma ORM v7.
343+
344+
To seed your database in v7, you must explicitly run:
345+
346+
```terminal
347+
npx prisma db seed
348+
```
349+
340350
### Various environment variables have been removed
341351

342352
We've removed a small selection of Prisma-specific environment variables.

0 commit comments

Comments
 (0)