Browse Source

fix database not exist

topic
KuiLiao 5 years ago
parent
commit
3fe9888e0a
  1. 2
      helper/bench/prepare.sh
  2. 4
      helper/bench/svr/http.go

2
helper/bench/prepare.sh

@ -7,4 +7,4 @@ git clone https://github.com/dtm-labs/dtm.git && cd dtm && git checkout alpha &&
echo 'all prepared. you shoud run following commands to test in different terminal' echo 'all prepared. you shoud run following commands to test in different terminal'
echo echo
echo 'cd dtf && go run helper/bench/main.go redis|boltdb|db' echo 'cd dtf && go run helper/bench/main.go redis|boltdb|db'
echo 'cd dtf/helper && bench/run-redis|boltdb|mysql.sh' echo 'cd dtf && ./helper/bench/test-redis|boltdb|mysql.sh'

4
helper/bench/svr/http.go

@ -73,7 +73,9 @@ var sqls = 1
// PrepareBenchDB prepares db data for bench // PrepareBenchDB prepares db data for bench
func PrepareBenchDB() { func PrepareBenchDB() {
db := pdbGet() db := pdbGet()
_, err := dtmimp.DBExec(db, "drop table if exists dtm_busi.user_account_log") _, err := dtmimp.DBExec(db, "CREATE DATABASE if not exists dtm_busi")
logger.FatalIfError(err)
_, err = dtmimp.DBExec(db, "drop table if exists dtm_busi.user_account_log")
logger.FatalIfError(err) logger.FatalIfError(err)
_, err = dtmimp.DBExec(db, `create table if not exists dtm_busi.user_account_log ( _, err = dtmimp.DBExec(db, `create table if not exists dtm_busi.user_account_log (
id INT(11) AUTO_INCREMENT PRIMARY KEY, id INT(11) AUTO_INCREMENT PRIMARY KEY,

Loading…
Cancel
Save