This commit is contained in:
Eva Ho 2025-12-18 10:29:07 -05:00
parent 0eb320e74c
commit c6f941adb3
3 changed files with 14 additions and 11 deletions

View File

@ -9,7 +9,7 @@ import (
"strings"
"time"
sqlite3 "github.com/mattn/go-sqlite3"
_ "github.com/mattn/go-sqlite3"
)
// currentSchemaVersion defines the current database schema version.
@ -504,19 +504,11 @@ func (db *database) cleanupOrphanedData() error {
}
func duplicateColumnError(err error) bool {
if sqlite3Err, ok := err.(sqlite3.Error); ok {
return sqlite3Err.Code == sqlite3.ErrError &&
strings.Contains(sqlite3Err.Error(), "duplicate column name")
}
return false
return err != nil && strings.Contains(err.Error(), "duplicate column name")
}
func columnNotExists(err error) bool {
if sqlite3Err, ok := err.(sqlite3.Error); ok {
return sqlite3Err.Code == sqlite3.ErrError &&
strings.Contains(sqlite3Err.Error(), "no such column")
}
return false
return err != nil && strings.Contains(err.Error(), "no such column")
}
func (db *database) getAllChats() ([]Chat, error) {

View File

@ -86,6 +86,16 @@ func TestBackgoundChecker(t *testing.T) {
updater := &Updater{Store: &store.Store{}}
defer updater.Store.Close() // Ensure database is closed
settings, err := updater.Store.Settings()
if err != nil {
t.Fatal(err)
}
settings.AutoUpdateEnabled = true
if err := updater.Store.SetSettings(settings); err != nil {
t.Fatal(err)
}
updater.StartBackgroundUpdaterChecker(ctx, cb)
select {
case <-stallTimer.C:

View File

@ -41,6 +41,7 @@ type TrayCallbacks interface {
Quit()
TrayRun()
UpdateAvailable(ver string) error
ClearUpdateAvailable() error
GetIconHandle() windows.Handle
}