Skip to content
On this page

@pg

PostGraphile smart comments for PostgreSQL

Postgres

Example

Add PostGraphile smart comments

Multiple @pg.* tags on one object are combined into a single smart comment.

Input SQL
sql
-- @pg.simpleCollections
-- @pg.name('Customer')
CREATE TABLE users (
  id SERIAL PRIMARY KEY,
  email TEXT NOT NULL
);
Compiled Output
sql
COMMENT ON TABLE "users" IS E'@simpleCollections only\n@name Customer';

Tags

@pg.omit

Omit this object from the PostGraphile GraphQL schema

Targets: table, column, view, function

Arguments: No arguments.

@pg.omit.operations

Omit specific operations from the PostGraphile GraphQL schema

Targets: table, column, view, function

Arguments:

NameTypeRequiredValues
opsarrayYescreate, read, update, delete, all, many

@pg.name

Rename this object in the PostGraphile GraphQL schema

Targets: table, column, view, function, type

Arguments:Positional: string

@pg.deprecated

Mark this object as deprecated in the PostGraphile GraphQL schema

Targets: table, column, view, function, type

Arguments:Positional: string

@pg.simpleCollections

Enable simple collections on this table or view in PostGraphile

Targets: table, view

Arguments: No arguments.

@pg.behavior

Set a custom behavior string (PostGraphile V5)

Targets: table, column, view, function, type

Arguments:Positional: string