Skip to content
On this page

@pg

PostGraphile smart comments for PostgreSQL

Postgres

Example

Input SQL
sql
-- @pg.simpleCollections
-- @pg.name('Customer')
CREATE TABLE users (
  id SERIAL PRIMARY KEY,
  email VARCHAR(255) NOT NULL,
  -- @pg.omit(update)
  created_at TIMESTAMP DEFAULT now()
);
Compiled Output
sql
COMMENT ON TABLE "users" IS E'@simpleCollections only\n@name Customer';
COMMENT ON COLUMN "users"."created_at" IS '@omit update';

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
opsarrayNocreate, 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