func SetMg() (mg *qbs.Migration, err error) { db, err := OpenDb(dbtypeset) switch { case dbtypeset == "sqlite": mg = qbs.NewMigration(db, DbName, qbs.NewSqlite3()) case dbtypeset == "mysql": mg = qbs.NewMigration(db, DbName, qbs.NewMysql()) case dbtypeset == "pgsql": mg = qbs.NewMigration(db, DbName, qbs.NewPostgres()) } return mg, err }
func CreateUserTable() error { db, err := OpenDb() if err != nil { return err } migration := qbs.NewMigration(db, "qbs_test", qbs.NewMysql()) defer migration.Close() return migration.CreateTableIfNotExists(new(User)) }
func setMg() (*qbs.Migration, error) { db, err := sql.Open(_SQLITE3_DRIVER, DB_NAME) mg := qbs.NewMigration(db, DB_NAME, qbs.NewSqlite3()) return mg, err }
func SetMg() (*qbs.Migration, error) { db, err := sql.Open(sqlite3Driver, dbName) mg := qbs.NewMigration(db, dbName, qbs.NewSqlite3()) return mg, err }