Fixed episode deletion
This commit is contained in:
parent
3a77455422
commit
5ec435cf99
@ -49,6 +49,6 @@ func (episode *Episode) Save() {
|
|||||||
|
|
||||||
// Delete deletes the episode list from the database.
|
// Delete deletes the episode list from the database.
|
||||||
func (episode *Episode) Delete() error {
|
func (episode *Episode) Delete() error {
|
||||||
DB.Delete("Episode", episode.AnimeID)
|
DB.Delete("Episode", episode.ID)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
25
patches/delete-broken-episodes/delete-broken-episodes.go
Normal file
25
patches/delete-broken-episodes/delete-broken-episodes.go
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/akyoto/color"
|
||||||
|
"github.com/animenotifier/notify.moe/arn"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
color.Yellow("Fixing non-existing anime relations")
|
||||||
|
defer arn.Node.Close()
|
||||||
|
|
||||||
|
count := 0
|
||||||
|
|
||||||
|
for episode := range arn.StreamEpisodes() {
|
||||||
|
anime := episode.Anime()
|
||||||
|
|
||||||
|
if anime == nil {
|
||||||
|
color.Yellow(episode.AnimeID)
|
||||||
|
episode.Delete()
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
color.Green("Finished deleting %d episodes.", count)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user