Seeding Databases with Prisma

preview_player
Показать описание
With the release of Prisma 2.15, developers now have a way to easily seed their databases by using the prisma db seed command.

In this guide, Ryan Chenkie demonstrates how to prepare a seed script and run it using the prisma db seed command.

------------------------
Next:

------------------------
📚 Resources:

✅ Learn more about Prisma:

------------------------
💬 Connect with Prisma:
Рекомендации по теме
Комментарии
Автор

i wish this video is released sooner. I wrote TypeScript script to populate data

connieleung
Автор

Cool! Please add more examples like "insert multiple rows", "run multiple seeding files". ❤ I see the migration files are "*.sql" files. What if I want to do something else with JS within the migration?

grugbrain
Автор

Thanks, Ryan :).
I guess after releasing `createMany` feature it would be handy in seeds too.
Good luck

pshaddel
Автор

If a product would have say description which is rather long, how would we go about adding it? String is rather limited I’ve noticed and other functions like say JSON is not available for SQLite and I can’t seem to get Text to work, are there another tag than String we can use with SQLite to store longer texts?

saratiko
Автор

It gives me an error right at the start of my seed.ts file after I launch the npx prisma seed db command, because "Cannot use import statement outside a module" :( Why is that?

mcaldex
Автор

i'm doing this very similar.. but i just run node seedscript.ts and done..
but i found this method is not reliable if seed a lot of data

GeraldScholz
Автор

How do you align types like that in the editor? My prettier didn't do that from what I remember...

MaksymMinenko
Автор

I get this error in the tsconfig.json "prisma/seed.ts is not under rootDir".

HELMET
Автор

Do we have a "Faker" to use to generate fake data?

grugbrain
Автор

i need a video on seeding with relationship

_nobody_knows_
Автор

Where does the "product" came from? Your not importing it and it is not your model name, right?

toskito
Автор

The problem is that is not possible to createMany with others relations

paulomattos