mirror of
https://github.com/likelovewant/ollama-for-amd.git
synced 2025-12-21 22:33:56 +00:00
app: add code for macOS and Windows apps under 'app' (#12933)
* app: add code for macOS and Windows apps under 'app' * app: add readme * app: windows and linux only for now * ci: fix ui CI validation --------- Co-authored-by: jmorganca <jmorganca@gmail.com>
This commit is contained in:
60
app/store/schema_test.go
Normal file
60
app/store/schema_test.go
Normal file
@@ -0,0 +1,60 @@
|
||||
//go:build windows || darwin
|
||||
|
||||
package store
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSchemaVersioning(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
// Override legacy config path to avoid migration logs
|
||||
oldLegacyConfigPath := legacyConfigPath
|
||||
legacyConfigPath = filepath.Join(tmpDir, "config.json")
|
||||
defer func() { legacyConfigPath = oldLegacyConfigPath }()
|
||||
|
||||
t.Run("new database has correct schema version", func(t *testing.T) {
|
||||
dbPath := filepath.Join(tmpDir, "new_db.sqlite")
|
||||
db, err := newDatabase(dbPath)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create database: %v", err)
|
||||
}
|
||||
defer db.Close()
|
||||
|
||||
// Check schema version
|
||||
version, err := db.getSchemaVersion()
|
||||
if err != nil {
|
||||
t.Fatalf("failed to get schema version: %v", err)
|
||||
}
|
||||
|
||||
if version != currentSchemaVersion {
|
||||
t.Errorf("expected schema version %d, got %d", currentSchemaVersion, version)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("can update schema version", func(t *testing.T) {
|
||||
dbPath := filepath.Join(tmpDir, "update_db.sqlite")
|
||||
db, err := newDatabase(dbPath)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create database: %v", err)
|
||||
}
|
||||
defer db.Close()
|
||||
|
||||
// Set a different version
|
||||
testVersion := 42
|
||||
if err := db.setSchemaVersion(testVersion); err != nil {
|
||||
t.Fatalf("failed to set schema version: %v", err)
|
||||
}
|
||||
|
||||
// Verify it was updated
|
||||
version, err := db.getSchemaVersion()
|
||||
if err != nil {
|
||||
t.Fatalf("failed to get schema version: %v", err)
|
||||
}
|
||||
|
||||
if version != testVersion {
|
||||
t.Errorf("expected schema version %d, got %d", testVersion, version)
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user