prisma-nestjs-graphql icon indicating copy to clipboard operation
prisma-nestjs-graphql copied to clipboard

[Question] Ignore whole models / tables

Open apss-pohl opened this issue 3 years ago • 4 comments

Hi,

first things first: Great work! I have a question. This there a way to completely ignore a model? This is useful e.g. for the prisma table that holdes the migrations. It will never be used within the application and is for internal purpose only. I could not find anything in the documentation so far..

Thank you

apss-pohl avatar Dec 15 '22 09:12 apss-pohl

If you are not referencing this type in application it should not appear in graphql schema.

Also try @ObjectType({ isAbstract: true }) https://github.com/unlight/prisma-nestjs-graphql#objecttype

// schema.prisma
/// @ObjectType({ isAbstract: true })
model User {
    id Int @id
}

https://docs.nestjs.com/graphql/resolvers#generics

unlight avatar Dec 15 '22 20:12 unlight

Hiding it from gql is working, thanks you for the hint, and a step into the right direction. But i would prefer not to have the files at all that are generated. Something into the direction of a decorator "///@Ignore" that would skip the whole table if this is possible.

apss-pohl avatar Dec 16 '22 06:12 apss-pohl

Yes it would be great if we can have /// @ignore to ignore the tables.

yiyi-wang-rv avatar May 05 '23 08:05 yiyi-wang-rv

Agreed. The ability to ignore tables would be needed before I could use this unfortunately.

danny98m avatar Jun 06 '23 14:06 danny98m