mirror of
https://github.com/ent/ent.git
synced 2026-03-05 19:35:23 +03:00
doc/md: update doc for OnDelete annotation (#3460)
Signed-off-by: Giau. Tran Minh <hello@giautm.dev>
This commit is contained in:
@@ -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)),
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user