Search code examples
postgresqlgraphqlpostgraphile

Graphql - how to omit tables from the auto-generated graphiql


Im working on postgraphile server. the stack is: nodejs, expressjs, postgraphile and knex.

My auto-generated graphiql exposes queries to tables it doesn't need to - knex_migrations.

following this doc: https://medium.com/make-it-heady/graphql-omit-table-from-generating-under-graphiql-postgres-smart-comments-6d3b6abec37

in the pgAdmin, I added in the properties of the knex_migrations table the followings:

@name knex_migrations
@omit create,update,delete
This is the documentation.

still when running the server and opening graphiql, I see queries for the migrations table.

what am I missing


Solution

  • If you want to completely omit the table completely from your graphql schema using a smart comment, you simply need to use the @omit tag without any following actions. Using @omit create,update,delete only removes the autogenerated mutations -but does not remove read operations (usage in queries).

    See docs for @omit for all available options.