Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions internal/cmd/db_wakeup.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"fmt"
"strings"
"time"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -38,6 +39,16 @@ func wakeupDatabase(client *turso.Client, name string) error {
defer s.Stop()

if err := client.Databases.Wakeup(name); err != nil {
// If the database is part of a group the server tells us so
// but doesn't tell the user what to run instead. Look up the
// database to grab its group and suggest the right command.
// See #918.
if strings.Contains(err.Error(), "part of a group") {
if db, lookupErr := client.Databases.Get(name); lookupErr == nil && db.Group != "" {
cmd := internal.Emph(fmt.Sprintf("turso group unarchive %s", db.Group))
return fmt.Errorf("%w. Run %s instead", err, cmd)
}
}
return err
}
s.Stop()
Expand Down
Loading