velodrome/sql/mysql.go
func (config *MySQLConfig) CreateDatabase() (*gorm.DB, error) {
	db, err := gorm.Open("mysql", config.getDSN(""))
	if err != nil {
		return nil, err
	}

	db.Exec(fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %v;", config.Db))
	db.Close()

	db, err = gorm.Open("mysql", config.getDSN(config.Db))
	err = db.AutoMigrate(&Assignee{}, &Issue{}, &IssueEvent{}, &Label{}, &Comment{}).Error
	if err != nil {
		return nil, err
	}

	return db, nil
}
func (config *MySQLConfig) CreateDatabase() (*gorm.DB, error) {
	db, err := gorm.Open("mysql", config.getDSN(""))
	if err != nil {
		return nil, err
	}

	db.Exec(fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %v;", config.Db))
	db.Close()

	db, err = gorm.Open("mysql", config.getDSN(config.Db))
	err = db.AutoMigrate(&Assignee{}, &Issue{}, &IssueEvent{}, &Label{}, &Comment{}).Error
	if err != nil {
		return nil, err
	}

	return db, nil
}
func ( config * MySQLConfig ) CreateDatabase ( ) ( * gorm . DB , error ) { db , err := gorm . Open ( " " , config . getDSN ( " " ) ) if err != nil { return nil , err } db . Exec ( fmt . Sprintf ( " " , config . Db ) ) db . Close ( ) db , err = gorm . Open ( " " , config . getDSN ( config . Db ) ) err = db . AutoMigrate ( & Assignee { } , & Issue { } , & IssueEvent { } , & Label { } , & Comment { } ) . Error if err != nil { return nil , err } return db , nil }
// CreateDatabase for the MySQLConfig
CreateDatabase for the MySQLConfig