func (db *DB) rootInitSchemas() (err error) {

	// open db handle
	openString := fmt.Sprintf("%s:%s@%s(%s)/", db.dbUsername, db.dbPassword, db.dbAddr.Network(), db.dbAddr.String())
	var rootHandler *sql.DB
	if rootHandler, err = sql.Open("mysql", openString); err != nil {
		err = fmt.Errorf("Error opening database: \n%s", err)
		return
	}

	// When the method is done, close the root connection
	defer rootHandler.Close()

	if err = rootHandler.Ping(); err != nil {
		err = fmt.Errorf("Could not ping the database, is it running: \n%s", err)
		return
	}

	// TODO: !!! PUT THIS IN A CONFIG !!!
	schemasToCreate := []string{
		db.balanceSchema,
		db.depositSchema,
		db.pendingDepositSchema,
		db.orderSchema,
		db.peerSchema,
		db.puzzleSchema,
		db.puzzleTable,
		db.auctionSchema,
		db.auctionOrderSchema,
		db.auctionOrderTable,
	}

	for _, schema := range schemasToCreate {
		if err = rootCreateSchemaForUser(rootHandler, db.dbUsername, schema); err != nil {
			err = fmt.Errorf("Error calling rootCreateSchemaForUser helper: \n%s", err)
			return
		}

	}

	return
}
// rootInitSchemas initializes the schemas, creates users, and grants permissions to those users
rootInitSchemas initializes the schemas, creates users, and grants permissions to those users
// rootInitSchemas initializes the schemas creates users and grants permissions to those users
func (db *DB) rootInitSchemas() (err error) {
	openString := fmt.Sprintf("%s:%s@%s(%s)/", db.dbUsername, db.dbPassword, db.dbAddr.Network(), db.dbAddr.String())
	var rootHandler *sql.DB
	if rootHandler, err = sql.Open("mysql", openString); err != nil {
		err = fmt.Errorf("Error opening database: \n%s", err)
		return
	}
	defer rootHandler.Close()
	if err = rootHandler.Ping(); err != nil {
		err = fmt.Errorf("Could not ping the database, is it running: \n%s", err)
		return
	}
	schemasToCreate := []string{
		db.balanceSchema,
		db.depositSchema,
		db.pendingDepositSchema,
		db.orderSchema,
		db.peerSchema,
		db.puzzleSchema,
		db.puzzleTable,
		db.auctionSchema,
		db.auctionOrderSchema,
		db.auctionOrderTable,
	}
	for _, schema := range schemasToCreate {
		if err = rootCreateSchemaForUser(rootHandler, db.dbUsername, schema); err != nil {
			err = fmt.Errorf("Error calling rootCreateSchemaForUser helper: \n%s", err)
			return
		}
	}
	return
}
func ( db * DB ) rootInitSchemas ( ) ( err error ) { openString := fmt . Sprintf ( " " , db . dbUsername , db . dbPassword , db . dbAddr . Network ( ) , db . dbAddr . String ( ) ) var rootHandler * sql . DB if rootHandler , err = sql . Open ( " " , openString ) ; err != nil { err = fmt . Errorf ( " \n " , err ) return } defer rootHandler . Close ( ) if err = rootHandler . Ping ( ) ; err != nil { err = fmt . Errorf ( " \n " , err ) return } schemasToCreate := [ ] string { db . balanceSchema , db . depositSchema , db . pendingDepositSchema , db . orderSchema , db . peerSchema , db . puzzleSchema , db . puzzleTable , db . auctionSchema , db . auctionOrderSchema , db . auctionOrderTable , } for _ , schema := range schemasToCreate { if err = rootCreateSchemaForUser ( rootHandler , db . dbUsername , schema ) ; err != nil { err = fmt . Errorf ( " \n " , err ) return } } return }
rootInitSchemas initializes the schemas, creates users, and grants permissions to those users
rootInitSchemas initializes the schemas creates users and grants permissions to those users
// open db handle // When the method is done, close the root connection // TODO: !!! PUT THIS IN A CONFIG !!!