mirror of https://github.com/velour/catbase.git
23 lines
449 B
Go
23 lines
449 B
Go
package main
|
|
|
|
import (
|
|
"github.com/jmoiron/sqlx"
|
|
bh "github.com/timshannon/bolthold"
|
|
sms2 "github.com/velour/catbase/plugins/sms"
|
|
"log"
|
|
)
|
|
|
|
func migrateSMS(db *sqlx.DB, store *bh.Store) error {
|
|
smses := []sms2.Person{}
|
|
log.Printf("Migrating %T", smses)
|
|
if err := db.Select(&smses, `select * from sms`); err != nil {
|
|
return err
|
|
}
|
|
for _, s := range smses {
|
|
if err := store.Insert(s.Who, s); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|