Hello there. I'm looking into how to handle test d...
# orm-help
s
Hello there. I'm looking into how to handle test data during local development. What are you using for that?
r
@Sébastien Dubois 👋 Are you looking for seeding data in this case?
s
Yes, exactly
j
You have have a look at the share repo above. Prisma has in this feature in built. You can add a
seed.ts
file inside your Prisma folder
The above repo has this example
s
Ah, great!
Thanks for letting me know Joey 🙂
r
There’s also a section here in our docs to setup seeding 🙂
s
Oh, missed that page! Awesome. I'm discovering Prisma & its community, but wow, your docs are great 🙂
🙌 1
j
Yeah, the docs are amazing. Check that out and you can set it up
Speaking of seeding, I have been running into issues when trying to use
prisma db seed --preview-feature
I get the error ;
Copy code
▸    db seed is not a prisma command.
 ▸    Perhaps you meant seed
 ▸    Run prisma help for a list of
 ▸    available commands.
r
That’s strange. What version of Prisma are you on?
j
I had resorted to using
npx ts-node prisma/seed.ts
but would be nice to know whats the issue
Copy code
"@prisma/cli": "2.15.0"
"prisma": "^2.16.0"
"@prisma/client": "2.15.0"
Maybe there are some conflicts?
r
Could you remove
@prisma/cli
and update
@prisma/client
to 2.16.0 and check again?
j
mmhhh, same issue
Do I need to re-init or something?
s
If you want to make sure you're clean; remove node_modules, your lock file, do an npm install then try again?
I'll give this feature a try this afternoon or tomorrow. On my end, the seed command does seem to be there
sebastien@developassion:~/wks/writerPlan$ npx prisma db seed --help warn @Prisma/cli has been renamed to prisma. Please uninstall @Prisma/cli: npm remove @Prisma/cli And install prisma: npm i prisma 🙌 Seed your database WARNING Prisma db seed is currently in Preview (https://pris.ly/d/preview). There may be bugs and it's not recommended to use it in production environments. When using any of the subcommands below you need to explicitly opt-in via the --preview-feature flag. Usage $ prisma db seed [options] --preview-feature Options -h, --help Display this help message --schema Custom path to your Prisma schema Examples Specify a schema $ prisma db seed --preview-feature --schema=./schema.prisma sebastien@developassion:~/wks/writerPlan$
r
Yes I would suggest removing
node_modules
and lockfiles to get a fresh install
j
After using
npx prisma db seed --preview-feature
it worked
I’d need to make sure I have clean and up to date dependancies.
Thanks!
🙌 1