Upgrading posts to new data structure
This commit is contained in:
20
patches/update-post-structure/update-post-structure.go
Normal file
20
patches/update-post-structure/update-post-structure.go
Normal file
@ -0,0 +1,20 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
func main() {
|
||||
color.Yellow("Updating post structure")
|
||||
|
||||
defer color.Green("Finished.")
|
||||
defer arn.Node.Close()
|
||||
|
||||
// Iterate over the stream
|
||||
for post := range arn.StreamPosts() {
|
||||
post.ParentID = post.ThreadID
|
||||
post.ParentType = "Thread"
|
||||
post.Save()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user