Quick question: I added a type in database/datamod...
# prisma-whats-new
f
Quick question: I added a type in database/datamodel.graphql then added it to src/schema.graphql, ran
prisma deploy
and
npm start
, but I cannot perform CRUD operations against the new type. The only queries I see in Schema are the ones under Query in src/schema.graphql. Shouldn't I be able to see the generated ones too?
m
@fcosrno it goes
user
->
app
->
Prisma
->
database
. If you've added a new type and deployed it to
Prisma
, it's available to
app
on
prisma
but not
user
until you add it to your
src/schema.graphql
you can import types from the generated file using:
Copy code
# import User from "./generated/prisma.graphql"
f
Thanks! That makes sense. But, can I also import mutations? For instance, let's say I have a
type Film
. If the user queries
{films}
they will not get anything in the app unless I add
films
to the Query const in
Query.ts
and to the
Query
type in
shchema.graphql
? The function will look something like\n
Copy code
films(parent, args, ctx, info) {\n return ctx.db.query.films({}, info);\n }
m
@fcosrno you can import types but you need to create your own queries and mutations for your app
f
👍