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:
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:
The query type (or types) the rewrite runs on. Separate multiple values with commas to invoke the same rewrite for multiple types of queries.
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) |