catbase/util/migrate/tell.go

25 lines
467 B
Go

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 {
if err := store.Insert(bh.NextSequence(), &t); err != nil {
return err
}
}
return nil
}