From 528562bf5c265c7d487eddbb8fe865a2f14eae69 Mon Sep 17 00:00:00 2001 From: Isaac Date: Sun, 10 Nov 2024 17:18:11 -0800 Subject: [PATCH] fix(playlist): cascade delete multistream info (#535) * fix(playlist): cascade delete multistream info * run ent generate --- ent/migrate/schema.go | 2 +- ent/schema/playlist.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ent/migrate/schema.go b/ent/migrate/schema.go index eeb63a4b..fc162561 100644 --- a/ent/migrate/schema.go +++ b/ent/migrate/schema.go @@ -159,7 +159,7 @@ var ( Symbol: "multistream_infos_playlists_multistream_info", Columns: []*schema.Column{MultistreamInfosColumns[3]}, RefColumns: []*schema.Column{PlaylistsColumns[0]}, - OnDelete: schema.NoAction, + OnDelete: schema.Cascade, }, }, } diff --git a/ent/schema/playlist.go b/ent/schema/playlist.go index e8a9c4ac..3808f8df 100644 --- a/ent/schema/playlist.go +++ b/ent/schema/playlist.go @@ -4,6 +4,7 @@ import ( "time" "entgo.io/ent" + "entgo.io/ent/dialect/entsql" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" "github.com/google/uuid" @@ -30,6 +31,6 @@ func (Playlist) Fields() []ent.Field { func (Playlist) Edges() []ent.Edge { return []ent.Edge{ edge.To("vods", Vod.Type), - edge.To("multistream_info", MultistreamInfo.Type), + edge.To("multistream_info", MultistreamInfo.Type).Annotations(entsql.OnDelete(entsql.Cascade)), } }