Rename project from TopDeck to Canon
- Module github.com/cdnutter/canon, binary/command cmd/canon, Docker image and compose project "canon" - Environment variables now use the CANON_ prefix - Default site title is "<Your name>'s Canon" (or "Canon" with no name); a Site title set in Settings still overrides it - Existing topdeck.db (and WAL files) is renamed to canon.db on start - README: upgrade notes, including moving the old compose volume Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
58a29b7339
commit
3923444b3b
26 files changed
+215
-120
No files matched your search
@@ -4,6 +4,8 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
@@ -177,3 +179,31 @@ func TestCustomList(t *testing.T) {
|
||||
t.Errorf("movie aspect = %q", m.Aspect())
|
||||
}
|
||||
}
|
||||
|
||||
func TestAdoptLegacyDB(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
s, err := Open(dir)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := s.CreateList(context.Background(), List{Title: "Keep me", Category: "movie", MaxItems: 5}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
s.Close()
|
||||
// Pretend this data dir predates the rename.
|
||||
for _, suffix := range []string{"", "-wal", "-shm"} {
|
||||
os.Rename(filepath.Join(dir, "canon.db"+suffix), filepath.Join(dir, "topdeck.db"+suffix))
|
||||
}
|
||||
s, err = Open(dir)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer s.Close()
|
||||
lists, err := s.Lists(context.Background(), true)
|
||||
if err != nil || len(lists) != 1 || lists[0].Title != "Keep me" {
|
||||
t.Fatalf("legacy data not adopted: %v %v", lists, err)
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(dir, "topdeck.db")); !os.IsNotExist(err) {
|
||||
t.Errorf("topdeck.db should have been renamed")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user