Skip to content

Commit

Permalink
优化数据库升级
Browse files Browse the repository at this point in the history
  • Loading branch information
Jrohy committed Feb 24, 2021
1 parent 400527e commit a8d17a9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ ADD COLUMN expiryDate char(10) DEFAULT '';
return err
}
}
result := db.QueryRow(fmt.Sprintf(
var tableName string
error = db.QueryRow(fmt.Sprintf(
"SELECT * FROM information_schema.TABLES WHERE TABLE_NAME = 'users' AND TABLE_SCHEMA = '%s' ",
mysql.Database) + " AND TABLE_COLLATION LIKE 'utf8%';")
if result.Err() == sql.ErrNoRows {
mysql.Database) + " AND TABLE_COLLATION LIKE 'utf8%';").Scan(&tableName)
if error == sql.ErrNoRows {
tempFile := "temp.sql"
mysql.DumpSql(tempFile)
mysql.ExecSql(tempFile)
Expand Down

0 comments on commit a8d17a9

Please sign in to comment.