Fix non-existing anime relations
This commit is contained in:
parent
794b07f948
commit
4748c72eb6
24
patches/fix-nil-relations/fix-nil-relations.go
Normal file
24
patches/fix-nil-relations/fix-nil-relations.go
Normal file
@ -0,0 +1,24 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/akyoto/color"
|
||||
"github.com/animenotifier/notify.moe/arn"
|
||||
)
|
||||
|
||||
func main() {
|
||||
color.Yellow("Fixing non-existing anime relations")
|
||||
defer color.Green("Finished.")
|
||||
defer arn.Node.Close()
|
||||
|
||||
for anime := range arn.StreamAnime() {
|
||||
relations := anime.Relations()
|
||||
|
||||
if relations == nil {
|
||||
relations = &arn.AnimeRelations{
|
||||
AnimeID: anime.ID,
|
||||
}
|
||||
|
||||
relations.Save()
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user