29 lines
472 B
Go
Raw Normal View History

2019-10-10 05:47:22 +00:00
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()
2019-10-10 05:48:32 +00:00
count := 0
2019-10-10 05:47:22 +00:00
for anime := range arn.StreamAnime() {
relations := anime.Relations()
if relations == nil {
relations = &arn.AnimeRelations{
AnimeID: anime.ID,
}
relations.Save()
2019-10-10 05:48:32 +00:00
count++
2019-10-10 05:47:22 +00:00
}
}
2019-10-10 05:48:32 +00:00
color.Green("Finished adding %d anime relations objects.", count)
2019-10-10 05:47:22 +00:00
}