Light
Dark
System
v2latest
v3dev
v2latest
v1

Mutation rewritesAdded in v3.0

This section describes the SDL declarations pertaining to mutation rewrites (added in 3.0).

Declare two mutation rewrites: one that sets a created property when a new object is inserted and one that sets a modified property on each update:

Copy
type User {
  created: datetime {
    rewrite insert using (datetime_of_statement());
  }
  modified: datetime {
    rewrite update using (datetime_of_statement());
  }
};

Define a new mutation rewrite corresponding to the more explicit DDL commands (added in 3.0).

rewrite {insert | update} [, ...]
  using expr

Mutation rewrites must be defined inside a property or link block.

This declaration defines a new trigger with the following options:

insert | update [, ...]

The query type (or types) the rewrite runs on. Separate multiple values with commas to invoke the same rewrite for multiple types of queries.

expr

The expression to be evaluated to produce the new value of the property.

See also

Schema > Mutation rewrites (added in 3.0)

DDL > Mutation rewrites (added in 3.0)

Introspection > Mutation rewrites (added in 3.0)

Light
Dark
System