Implement cache migrations

This commit is contained in:
2024-12-31 20:12:02 -05:00
parent 30d86d72ed
commit 2f0e1b0d46
3 changed files with 60 additions and 18 deletions

View File

@@ -122,8 +122,16 @@ func (c *Cache) Read() error {
d.Decode(c)
// Perform migrations
if err := c.doMigrations(); err != nil {
c.log.Error("Failed to run cache migrations", c.log.Args("error", err))
err, migrated := c.doMigrations()
if err != nil {
c.log.Error("Failed to run cache migrations",
c.log.Args(
"migrated", migrated,
"error", err,
))
} else if migrated > 0 {
c.log.Info("Migrations run successfully", c.log.Args(
"migrated", migrated))
}
c.readFromFile = true