mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 06:47:20 +08:00
fix: mysql数据库为空时无法备份
This commit is contained in:
@@ -94,7 +94,7 @@ func (m *MySQL) DatabaseExists(name string) (bool, error) {
|
||||
|
||||
func (m *MySQL) DatabaseSize(name string) (int64, error) {
|
||||
var size int64
|
||||
err := m.QueryRow(fmt.Sprintf("SELECT SUM(data_length + index_length) FROM information_schema.tables WHERE table_schema = '%s'", name)).Scan(&size)
|
||||
err := m.QueryRow(fmt.Sprintf("SELECT COALESCE(SUM(data_length) + SUM(index_length), 0) FROM information_schema.tables WHERE table_schema = '%s'", name)).Scan(&size)
|
||||
return size, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user