catbase/util/migrate/wires.go

23 lines
460 B
Go

package main
import (
"github.com/jmoiron/sqlx"
bh "github.com/timshannon/bolthold"
"github.com/velour/catbase/plugins/rest"
"log"
)
func migrateWires(db *sqlx.DB, store *bh.Store) error {
wires := []rest.Wire{}
log.Printf("Migrating %T", wires)
if err := db.Select(&wires, `select * from wires`); err != nil {
return err
}
for _, w := range wires {
if err := store.Insert(bh.NextSequence(), &w); err != nil {
return err
}
}
return nil
}