Fix non-existing anime relations

This commit is contained in:
Eduard Urbach 2019-10-10 14:47:22 +09:00
parent 794b07f948
commit 4748c72eb6
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0

View 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()
}
}
}