DB seeding
Will there be any plans to add a db seeding template to the T3 stack? Perhaps a script file that users can edit and run a db seed script to populate the database? Thanks!
4 Replies
doubt it. that would be highly dependant on the data you are using. and i dont think ct3a wants to be a "demo" starter app with some random pre initialized data.
im assuming youre using prisma. Its pretty easy to seed, you just make I think prisma automatically uses any file called seed. nvm you have you to add it into package.json.
seed.ts
file in side of your ./src/prisma/
directory.
in there you can load up some json, or make some request to an external api, to get some intial data, and then just use the prisma client to insert said data into your db.
the seed.ts
script will be ran everytime you prima migrate dev
alternatively you can manually run it with prisma db seed
iirc.
Prisma
Seeding your database
Learn how to seed your database using Prisma's integrated seeding functionality and Prisma Client
More specifically:
as regular
ts-node
won't work for t3 app.Unknown User•3y ago
Message Not Public
Sign In & Join Server To View