Beispiel #1
0
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
}
Beispiel #2
0
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))
}
Beispiel #3
0
func setMg() (*qbs.Migration, error) {
	db, err := sql.Open(_SQLITE3_DRIVER, DB_NAME)
	mg := qbs.NewMigration(db, DB_NAME, qbs.NewSqlite3())
	return mg, err
}
Beispiel #4
0
func SetMg() (*qbs.Migration, error) {
	db, err := sql.Open(sqlite3Driver, dbName)
	mg := qbs.NewMigration(db, dbName, qbs.NewSqlite3())
	return mg, err
}