diff --git a/patches/fix-nil-relations/fix-nil-relations.go b/patches/fix-nil-relations/fix-nil-relations.go new file mode 100644 index 00000000..1d7532b2 --- /dev/null +++ b/patches/fix-nil-relations/fix-nil-relations.go @@ -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() + } + } +}