catbase/util/migrate/tell.go

25 lines
467 B
Go
Raw Normal View History

2021-12-22 03:36:08 +00:00
package main
import (
"github.com/jmoiron/sqlx"
bh "github.com/timshannon/bolthold"
tell2 "github.com/velour/catbase/plugins/tell"
"log"
)
func migrateTell(db *sqlx.DB, store *bh.Store) error {
tells := []tell2.Tell{}
log.Printf("Migrating %T", tells)
if err := db.Select(&tells, `select * from tell`); err != nil {
return err
}
for _, t := range tells {
2021-12-22 07:53:02 +00:00
if err := store.Insert(bh.NextSequence(), &t); err != nil {
2021-12-22 03:36:08 +00:00
return err
}
}
return nil
}