Skip to content

Commit

Permalink
Revert Schema version 14 support
Browse files Browse the repository at this point in the history
It seems that JW Library has rolled back
schema version 14 and exported backups
now use v13 again. As mentioned in
#147 (comment)
it seems they change something in the
data between those two version, so it's not
possible to support both schema versions
at the same time. Therefore, we are reverting
back to version 13.
  • Loading branch information
AndreasSko committed Aug 15, 2023
1 parent f400981 commit d99c348
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion model/Database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ func Test_createEmptySQLiteDB(t *testing.T) {
}
hash := fmt.Sprintf("%x", hasher.Sum(nil))

assert.Equal(t, "78edd07c0b04212dcc2dd59be0a5d2edf91088136986378147cd8aa04cf4965c", hash)
assert.Equal(t, "774af7240646c49f6a55e40b6cdf681a6b04fbcf4acebdb19a6e0e2bef53d766", hash)
}

func TestDatabase_saveToNewSQLite(t *testing.T) {
Expand Down
Binary file modified model/data/userData.db
Binary file not shown.
2 changes: 1 addition & 1 deletion model/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

const version = 1
const schemaVersion = 14
const schemaVersion = 13

type manifest struct {
CreationDate string `json:"creationDate"`
Expand Down
7 changes: 3 additions & 4 deletions model/manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package model
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"testing"
"time"
Expand All @@ -17,7 +16,7 @@ var exampleManifest = &manifest{
LastModifiedDate: time.Now().Format("2006-01-02T15:04:05-07:00"),
Hash: "e2e09ceba668bb1ad093b2db317237451a01ae9ff435b38c840b70dc434f184f",
DatabaseName: userDataFilename,
SchemaVersion: 14,
SchemaVersion: 13,
DeviceName: "go-jwlm",
},
Name: "test",
Expand All @@ -37,7 +36,7 @@ func Test_manifest_importManifest(t *testing.T) {
LastModifiedDate: "2020-04-09T05:47:26+02:00",
Hash: "d87a67028133cc4de5536affe1b072841def95899b7f7450a5622112b4b5e63f",
DatabaseName: userDataFilename,
SchemaVersion: 14,
SchemaVersion: 13,
DeviceName: "iPhone",
},
Name: "UserDataBackup_2020-04-11_iPhone",
Expand Down Expand Up @@ -150,7 +149,7 @@ func Test_generateManifest(t *testing.T) {
func Test_exportManifest(t *testing.T) {
tmp, err := ioutil.TempDir("", "go-jwlm")
assert.NoError(t, err)
defer os.RemoveAll(tmp)
//defer os.RemoveAll(tmp)

path := filepath.Join(tmp, "test_manifest.json")
fmt.Println(path)
Expand Down
Binary file modified model/testdata/backup.jwlibrary
Binary file not shown.
Binary file modified model/testdata/backup_shuffled.jwlibrary
Binary file not shown.
Binary file modified model/testdata/backup_withPlaylist.jwlibrary
Binary file not shown.
2 changes: 1 addition & 1 deletion model/testdata/manifest_correct.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"lastModifiedDate": "2020-04-09T05:47:26+02:00",
"hash": "d87a67028133cc4de5536affe1b072841def95899b7f7450a5622112b4b5e63f",
"databaseName": "userData.db",
"schemaVersion": 14,
"schemaVersion": 13,
"deviceName": "iPhone"
},
"name": "UserDataBackup_2020-04-11_iPhone",
Expand Down
2 changes: 1 addition & 1 deletion model/testdata/manifest_outdated.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"lastModifiedDate": "2020-04-09T05:47:26+02:00",
"hash": "d87a67028133cc4de5536affe1b072841def95899b7f7450a5622112b4b5e63f",
"databaseName": "user_data.db",
"schemaVersion": 13,
"schemaVersion": 8,
"deviceName": "iPhone"
},
"name": "UserDataBackup_2020-04-11_iPhone",
Expand Down

0 comments on commit d99c348

Please sign in to comment.