2017-06-06 13:51:22 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/animenotifier/arn"
|
|
|
|
"github.com/fatih/color"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
color.Yellow("Updating user references")
|
|
|
|
|
2017-06-12 18:06:31 +00:00
|
|
|
arn.DB.DeleteTable("NickToUser")
|
|
|
|
arn.DB.DeleteTable("EmailToUser")
|
2017-06-06 13:51:22 +00:00
|
|
|
|
|
|
|
// Get a stream of all anime
|
|
|
|
allUsers, err := arn.AllUsers()
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Iterate over the stream
|
|
|
|
count := 0
|
|
|
|
for user := range allUsers {
|
|
|
|
count++
|
|
|
|
println(count, user.Nick)
|
|
|
|
|
2017-06-07 19:12:59 +00:00
|
|
|
user.SetNick(user.Nick)
|
2017-06-08 09:51:34 +00:00
|
|
|
|
|
|
|
if user.Email != "" {
|
|
|
|
user.SetEmail(user.Email)
|
|
|
|
}
|
2017-06-06 13:51:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
color.Green("Finished.")
|
|
|
|
}
|