I am trying https://nexus.js.org/docs/database-access-with-prisma-v2 but the docs aren't clear & throws error.
For example, before 1.3. Add dependencies, add a cd myblog/ step which is basic I know but for beginners, it is helpful.
Then Idk why there is npm init -y when we already have package.json created by prisma2 init myblog which I think should be removed as well.
Again tsconfig.json is already created by the prisma2 init myblog command.
1.5. Configure start script in package.json gives another error if I run yarn start
Then in 2. Define models & generators they say edit project.prisma but there is no such file. There exists schema.prisma in prisma/ folder. If that is the file we have to edit, then I guess it's already edited.
Let's assume I edited it & run 3. Migrate database. In that, I run prisma2 lift save --name="init" which gives Everything up-to-date but running prisma2 lift up gives error.
Error: Error in lift engine for rpc migrationProgress:
thread 'main' panicked at 'Could not load migration from database. Migration name was: 20190624162221-init', src/libcore/option.rs:1034:5
It basically is terrible at this point. I don't even know if I'm doing it correctly. It throws a ton of errors. Docs has a lot of problem. Would love if it's been edited properly so it works fine.
Unfortunately, I haven't made it work so can't send a PR.
Some other errors:
objectType is not defined. I think the following should fix it ⸺
import { objectType } from '@prisma/nexus'
Then another error on t.crud. It's a TypeScript error
Property 'crud' does not exist on type 'ObjectDefinitionBlock<"Query">'.ts(2339)
Another error is
Cannot find name 'makePrismaSchema'.ts(2304)
I guess too many errors. I really want to try prisma2 with nexus but can't find any useful resource. Would love it if there's any other working example :)
After some researching, found https://github.com/prisma/photonjs/tree/master/examples/typescript/graphql which should be the basis of the docs 🎉
Hey @deadcoder0904 thanks for your articulate feedback. I've started work on a revamp here https://github.com/jasonkuhrt/nexus/tree/fix/186/prisma-2-docs. I should have a pull-request up within a few days.
Another issue:
t.crud will not be available until after the first build, so it would seem the first build cannot be based on code that contains t.crud. The instructions do not mention this, and it has confused me so far.
But, consider real projects where t.crud may well be present. If the nexus typegen is not committed to the repo, how does the project bootstrap itself as per the above point?
This leads me to think there is something I am missing overall, about the intended workflow.
Yeah good one I was wondering the exact same thing as well. It's pretty unclear.
Most helpful comment
Another issue:
t.crudwill not be available until after the first build, so it would seem the first build cannot be based on code that containst.crud. The instructions do not mention this, and it has confused me so far.But, consider real projects where
t.crudmay well be present. If the nexus typegen is not committed to the repo, how does the project bootstrap itself as per the above point?This leads me to think there is something I am missing overall, about the intended workflow.