mirror of
https://github.com/safing/portmaster
synced 2025-09-02 02:29:12 +00:00
Improve profile ID migration errors and run migration again
This commit is contained in:
parent
c999d5559a
commit
1e2491c3b3
1 changed files with 5 additions and 2 deletions
|
@ -11,6 +11,7 @@ import (
|
||||||
"github.com/safing/portbase/database/migration"
|
"github.com/safing/portbase/database/migration"
|
||||||
"github.com/safing/portbase/database/query"
|
"github.com/safing/portbase/database/query"
|
||||||
"github.com/safing/portbase/log"
|
"github.com/safing/portbase/log"
|
||||||
|
"github.com/safing/portmaster/profile/icons"
|
||||||
)
|
)
|
||||||
|
|
||||||
func registerMigrations() error {
|
func registerMigrations() error {
|
||||||
|
@ -27,7 +28,7 @@ func registerMigrations() error {
|
||||||
},
|
},
|
||||||
migration.Migration{
|
migration.Migration{
|
||||||
Description: "Migrate from random profile IDs to fingerprint-derived IDs",
|
Description: "Migrate from random profile IDs to fingerprint-derived IDs",
|
||||||
Version: "v1.6.0",
|
Version: "v1.6.3", // Re-run after mixed results in v1.6.0
|
||||||
MigrateFunc: migrateToDerivedIDs,
|
MigrateFunc: migrateToDerivedIDs,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -102,7 +103,7 @@ func migrateIcons(ctx context.Context, _, to *version.Version, db *database.Inte
|
||||||
}
|
}
|
||||||
|
|
||||||
// Migrate to icon list.
|
// Migrate to icon list.
|
||||||
profile.Icons = []Icon{{
|
profile.Icons = []icons.Icon{{
|
||||||
Type: profile.IconType,
|
Type: profile.IconType,
|
||||||
Value: profile.Icon,
|
Value: profile.Icon,
|
||||||
}}
|
}}
|
||||||
|
@ -161,6 +162,8 @@ func migrateToDerivedIDs(ctx context.Context, _, to *version.Version, db *databa
|
||||||
// Parse profile.
|
// Parse profile.
|
||||||
profile, err := EnsureProfile(r)
|
profile, err := EnsureProfile(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
failed++
|
||||||
|
lastErr = err
|
||||||
log.Tracer(ctx).Debugf("profiles: failed to parse profile %s for migration: %s", r.Key(), err)
|
log.Tracer(ctx).Debugf("profiles: failed to parse profile %s for migration: %s", r.Key(), err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue