feat: guard GetDb/ImportDB for MariaDB (unsupported SQLite-specific operations)

This commit is contained in:
Sora39831 2026-04-03 09:29:53 +08:00
parent fd910efec2
commit 8a20cbd5c2

View file

@ -882,6 +882,9 @@ func (s *ServerService) GetConfigJson() (any, error) {
}
func (s *ServerService) GetDb() ([]byte, error) {
if config.GetDBTypeFromJSON() == "mariadb" {
return nil, common.NewError("Database export is not supported for MariaDB")
}
// Update by manually trigger a checkpoint operation
err := database.Checkpoint()
if err != nil {
@ -904,6 +907,9 @@ func (s *ServerService) GetDb() ([]byte, error) {
}
func (s *ServerService) ImportDB(file multipart.File) error {
if config.GetDBTypeFromJSON() == "mariadb" {
return common.NewError("Database import is not supported for MariaDB")
}
// Check if the file is a SQLite database
isValidDb, err := database.IsSQLiteDB(file)
if err != nil {