doc/md: update doc for OnDelete annotation (#3460)

Signed-off-by: Giau. Tran Minh <hello@giautm.dev>
This commit is contained in:
Giau. Tran Minh
2023-04-10 00:21:25 +07:00
committed by GitHub
parent baaa22d018
commit 36d16536ea

View File

@@ -49,7 +49,7 @@ func (User) Fields() []ent.Field {
Ent allows to customize the foreign key creation and provide a [referential action](https://dev.mysql.com/doc/refman/8.0/en/create-table-foreign-keys.html#foreign-key-referential-actions)
for the `ON DELETE` clause:
```go title="ent/schema/user.go"
```go title="ent/schema/user.go" {27}
package schema
import (
@@ -76,9 +76,7 @@ func (User) Fields() []ent.Field {
func (User) Edges() []ent.Edge {
return []ent.Edge{
edge.To("posts", Post.Type).
Annotations(entsql.Annotation{
OnDelete: entsql.Cascade,
}),
Annotations(entsql.OnDelete(entsql.Cascade)),
}
}
```