mirror of https://github.com/velour/catbase.git
25 lines
453 B
Go
25 lines
453 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(t.ID, t); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|