Schema annotations allow attaching metadata to schema objects like fields and edges and inject them to external templates. An annotation must be a Go type that is serializable to JSON raw value (e.g. struct, map or slice) and implement the Annotation interface.
The builtin annotations allow configuring the different storage drivers (like SQL) and control the code generation output.
A custom table name can be provided for types using the
entsql annotation as follows:
Ent allows to customize the foreign key creation and provide a referential action for the
ON DELETE clause:
The example above configures the foreign key to cascade the deletion of rows in the parent table to the matching rows in the child table.