package main import ( "github.com/jmoiron/sqlx" "github.com/rs/zerolog/log" bh "github.com/timshannon/bolthold" "github.com/velour/catbase/plugins/achievements" goals2 "github.com/velour/catbase/plugins/goals" ) func migrateAwards(db *sqlx.DB, store *bh.Store) error { awards := []achievements.Award{} log.Printf("Migrating %T", awards) err := db.Select(&awards, `select * from awards`) if err != nil { return err } for _, a := range awards { err := store.Insert(bh.NextSequence(), &a) if err != nil { return err } } log.Printf("Migrated %d awards", len(awards)) trophies := []achievements.Trophy{} err = db.Select(&trophies, `select * from trophies`) for _, t := range trophies { err := store.Insert(t.Emojy, t) if err != nil { return err } } log.Printf("Migrated %d trophies", len(trophies)) goals := []goals2.Goal{} log.Printf("Migrating %T", goals) if err := db.Select(&goals, `select * from goals`); err != nil { return err } for _, i := range goals { if err := store.Insert(bh.NextSequence(), &i); err != nil { return err } } return nil }