Repository navigation
fix(db seed): redesign of db seed - #8146
Conversation
|
Can be tried with |
tomhoule
left a comment
There was a problem hiding this comment.
Very nice! The new code is nice and easy to follow.
…ehavior * integration/db-seed-new-behavior: fix node types for seed small tweaks/debug & add chmod +x for Bash # Conflicts: # src/packages/migrate/src/utils/seed.ts
|
Can be tried with Streaming of seed stdout should be smooth now. |
janpio
left a comment
There was a problem hiding this comment.
Looking good.
Do the new tests confirm that the actual seed command was successfully executed and output made it to the executing terminal?
|
@janpio just tried With the proposed ts-node-setup the seed is failing as before: What works though, is to setup ts-node with it's experimental esm-loader: I think that should be at least reflected in docs/help as this kind of setup will get more common and more users will struggle with the advised setup failing... |
|
Thanks @benbender, can you optimally open a new issue so we can start a discussion about this? Thanks. |


Internal: https://www.notion.so/prismaio/db-seed-workshop-2a104a37762e4fb7bf3100c0227569ff
prisma db seedis currently a Preview feature.During this phase, we noticed different issues caused by the complexity of the current implementation.
The Migrations Team decided to remove the complexity and make it a lot easier to understand for users and to maintain.
The new implementation is in this PR.
How it will work is that a
prisma.seedproperty in thepackage.jsonof your project will be required if you want to useprisma db seed.The CLI will give examples that can be copy-pasted.
If you are currently using the previous implementation of
prisma db seedand upgrade to this new version then it will throw an error with an upgrade help message which should be easy to fix (addprisma.seedto thepackage.json)package.jsonexample for a JavaScript projectpackage.jsonexample for a TypeScript projectExample of a
prisma/seed.jsnpx prisma db seed --preview-featureresults in something likeif file path is invalid
if seed exits with error
if command is not found
if we detect a seed.ts file but no "prisma.seed" in package.json
if we detect a seed.js file but no "prisma.seed" in package.json
if we detect a seed.sh file but no "prisma.seed" in package.json
If we didn't detect a seed.ts/.js/.sh we error with