Hi everyone. There is an issue with prisma-example...
# orm-help
y
Hi everyone. There is an issue with prisma-examples. STEP 1 ) I downloaded graphql-apollo-server from prisma-examples I changed datasource information as http://prntscr.com/s8b5m6 STEP 2 ) npm install and OKEY http://prntscr.com/s8b7rf STEP 3 ) npx prisma introspect and OKEY http://prntscr.com/s8b980 STEP 4 ) npx prisma generate and OKEY http://prntscr.com/s8banz STEP 5 ) But now there is a problem. (Or I dont know true way) schema.graphql's codes didnt change. // Same with initilization codes http://prntscr.com/s8bbpm and schema.ts file is same also. http://prntscr.com/s8bcv0 How can I auto generate this two files. Because of these problems, I cannot go forward. [💬 Is there a way to regenerate Nexus Codes in script.ts after introspect] Thanks for helps.
r
Hey @Yiğit Rüzgar 👋 Could you try running
npm run generate
after introspect?
a
@Ryan he don’t ask about normal generate he ask how he generate CRUD system auto without typing it
y
Ok. But what ist he difference "*npx prisma generate" with "npm run generate"*
a
@Yiğit Rüzgar you can use my example here https://github.com/AhmedElywa/prisma-tools/tree/master/examples/apollo-nexus-schema it has auto generate CRUD functions
y
And I also tried "npm run generate" Not fix. @Ahmed says correct. Nexus codes cannot be changed
a
you ask how to generate this code look to my example will get it
y
And the other problem with schema.graphql Is there a way to regenerate schema.graphql
a
yes when you run server the nexus rebuild it
y
a
https://github.com/AhmedElywa/prisma-tools/tree/master/examples/apollo-nexus-schema clone this example pull your db in schema.prisma file
npx prisma introspect
yarn generate
yarn dev
just this three commands after adding datasource information
it’s just tree you need to clone all repo https://github.com/AhmedElywa/prisma-tools then
Copy code
cd examples/apollo-nexus-schema
y
Now your folder is in. It is true
I changed db options
a
yes run your
*npx prisma introspect*
to pull your db inside schema file
run any command must be inside
Copy code
apollo-nexus-schema
folder
y
introspect okey. datamodel is now inside
a
replace your new one with old file
then run
yarn generate
yarn dev
y
ı am already in apollo-nexus-schema
yarn generate is must execute in my project directory ?
a
yes
it’s generate prisma/client and curd system and nexus schema
don’t care about old example any command must be here
Copy code
apollo-nexus-schema
y
Copying operation is true ?
datamodel-aaaaa.prisma > schema.graphql is correct ?
a
can you close this vscode and open new windows from
Copy code
apollo-nexus-schema
folder only
all what you need is this folder
Copy code
apollo-nexus-schema
y
Sorry. I am there at now. Copying way is true ?
a
yes this what you need now and then run this two command and your project is done
yarn generate
yarn dev
y
But, schema.prisma's content format is not same with datamodel-aaaa.prisma
a
what was in old one is just test model you need to replace with your’s
y
but formats is diffrent. pls wait ı upload an image
Not same format. Only file extension is similar
a
OH you use prisma version one
y
but all my command is prefix with npx
a
ok best way now is
yarn global add @prisma/cli
and run
prisma introspect
y
What is the way for correct prisma version. So conflicts tired me. I am installing with "npm i @prisma/cli -g"
a
goood
it’s good
just try now
prisma introspect
and look to new code
if same will be fine
y
schema.prisma is changed
a
perfect
yarn generate
yarn dev
or if use npm
npm run generate
y
npm run generate npx run generate Different ?
a
just try this generate code and you will see all your files go good
generate
is package.json script
y
a
run this two commands by any way your project will start fine
y
npx is for prisma ?
a
please install dependencies by run
npm install
forget old example from prisma repo
you have now complete project
y
a
please go with me here https://whereby.com/ahmedelywa
to share your screen and talking faster
or you need to delete this file
apollo-nexus-schema/src/types/Auth.ts
and run generate again
I hope that every thing is Ok now
y
Yes Okey