Open jake-amicus opened 1 year ago
Yeah I agree this behaviour is not ideal. I already have an open issue regarding support for this in the main Prisma repository, https://github.com/prisma/prisma/issues/10359.
I'd consider adding custom support for this until it's supported natively by Prisma but unfortunately I don't think it's really feasible due to the structure of this feature and the numerous places it's used, especially in commands that perform other related tasks, e.g. prisma migrate dev
.
Problem
The NodeJS Prisma package includes a mechanism for seeding databases with a
prisma db seed
command. This, however, requires configuring the command in thepackage.json
of the project, which would normally be present in a NodeJS project.Interestingly, if I add a file called
package.json
and simply include that JSON block above then the seed script is executed when I runprisma db seed
. I think we just need a more pythonic way of defining what that seed script should be.Suggested solution
I think just looking for a file called either
seed.py
orseed.sh
would be an acceptable solution, since there is already a precedent for required file names, eg.partial_types.py
.Alternatives
We can manually run scripts to see data, but these scripts are not integrated with the Prisma reset/migrate workflows the way the
prisma db seed
command is.Additional context
Node Prisma docs on database seeding