hey yall, i have a somewhat noob question so hopef...
# prisma-migrate
s
hey yall, i have a somewhat noob question so hopefully there is a simple answer: I have an existing postgresql database and I want to set up a graphql API server to perform basic CRUD on it and feed data to a few client applications we have. My question is, "what steps should i take to set up my prisma server with my existing database?" I originally thought this was a simple SQL migration setup, but as I read the docs, it became unclear if it would work as intended. Can anyone advise me on the steps to take to turn my existing database into a Prisma CRUD API?
j
Hello there! Are you talking about Prisma 2? If so I think you could use Nexus with this CRUD generator https://github.com/paljs/create-nexus-type
s
yeah i am planning on prisma 2
and thank you! i was trying to figure out which graphql server framework to use, this might make the choice easy
j
You’re welcome 🙂
s
nexus can replace apollo server (the framework im most familiar with), correct? another example it replaces is graphql yoga, ya? @Joël
j
Yes indeed but you could also only use https://github.com/graphql-nexus/schema
With Apollo
s
oh great, thank you again!
👍 1
j
I think you will also be able to find examples in the repository
j
The Prisma part itself: You run Introspection, then have a Prisma schema representation of your database, which lets you generate a Prisma Client for your database that you can use in any node application - for example a GraphQL API and its resolvers etc.
💯 1
s
thanks @janpio can you help me understand the order of operations of these steps? • use nexus CRUD generator to create CRUD boilerplate resolvers • prisma introspect the database to build prisma schema • use prisma schema to generate prisma client
j
2, 3, 1.
but the nexus tutorial should cover that really.
s
ok great, thank you! so to repeat what you said myself to make sure i understand it: first i use prisma to introspect my database to build the prisma schema. then i use that schema to generate my prisma client. i connect my prisma client to my graphql API of choice (apollo, nexus, yoga, etc). I then use the nexus CRUD generator on my generated schema (or the client?) to generate the CRUD resolvers
j
I am not sure how the CRUD generator works - that is from a user.
But yes, that should be the order itself.
s
ok great, thank you
yall have been very helpful!
ive used prisma 1 before, very excited to take a crack at prisma 2!
j
Good luck!
Let us know if you have any questions.
👍 1