The only workaround I can think of is create an endpoint so I can run javascript prisma code in the server when I call that endpoint, but this sounds dangerous and hacky. I desperately need this feature. Please say you have a plan to release this ðŸ˜
c
Chris Tsongas
03/17/2022, 6:19 AM
I'm confused about how prisma db seed fails to cover your use case? I added code to my migration scripts so they can be run any number of times in each environment (development, test, staging, production), checking whether tables have been seeded or individual records added before doing inserts or upserts depending on the logic needed for each table. It's a lot of code for ~50 models * 4 environments but it works.
e
Eric N.
03/17/2022, 9:07 PM
Thank you for your response! I posted a question about this 5 months ago and their answer was that Prisma didn’t have this feature, so I just assumed nothing would work.
Eric N.
03/17/2022, 9:08 PM
Also I for some reason assumed seed resets the database (maybe I think that way because I always ran prisma migrate-dev before seeding), when I’ve actually seen that’s not true
Eric N.
03/17/2022, 9:09 PM
So I guess you can write a seed script and run it in each migration step? How do you organize the seed files? Just in each migration folder?
Eric N.
03/17/2022, 9:10 PM
I guess when they said there’s no support for data migration, they probably meant prisma migrate doesn’t automatically run these seed script (or data migration script) for you in each step
a
Arian Meidow
03/17/2022, 10:27 PM
I also think the way migrations are limited right now, is the biggest part missing: neither can one simply roll back (defining up/down) nor is a data migration possible. Is this really not planned? leads me to leans towards TypeORM, which seem to support that
c
Chris Tsongas
03/22/2022, 4:32 AM
@Eric N. to answer your question about how I organize seed files