From 98d14befa942230d9f9a680c979104de7b9e526d Mon Sep 17 00:00:00 2001 From: Simon Ding Date: Sun, 29 Sep 2024 16:16:05 +0800 Subject: [PATCH] fix: remove episodes no media id --- db/db.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/db/db.go b/db/db.go index 804ea8b..a6e4481 100644 --- a/db/db.go +++ b/db/db.go @@ -649,8 +649,7 @@ func (c *Client) GetMovingNamingFormat() string { return s } - func (c *Client) CleanAllDanglingEpisodes() error { - _, err := c.ent.Episode.Delete().Where(episode.MediaID(0)).Exec(context.Background()) + _, err := c.ent.Episode.Delete().Where(episode.Not(episode.HasMedia())).Exec(context.Background()) return err -} \ No newline at end of file +}