2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 06:47:20 +08:00

fix: mysql数据库为空时无法备份

This commit is contained in:
耗子
2024-10-28 21:10:49 +08:00
parent 44c370a119
commit 1e4285b516

View File

@@ -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
}