From 2cdd3264b83c91588366fcfef45f773d13b0f4ed Mon Sep 17 00:00:00 2001 From: martylukyy <35452459+martylukyy@users.noreply.github.com> Date: Wed, 28 Feb 2024 18:04:45 +0100 Subject: [PATCH] fix(database): migrations log correct upgrade var version (#1441) * fix(database): correct upgrade var * fix(database): substitute len(var) with i+1 --- internal/database/postgres.go | 2 +- internal/database/sqlite.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/database/postgres.go b/internal/database/postgres.go index 81f3e6f..18214fe 100644 --- a/internal/database/postgres.go +++ b/internal/database/postgres.go @@ -71,7 +71,7 @@ func (db *DB) migratePostgres() error { } } else { for i := version; i < len(postgresMigrations); i++ { - db.log.Info().Msgf("Upgrading Database schema to version: %v", i) + db.log.Info().Msgf("Upgrading Database schema to version: %v", i+1) if _, err := tx.Exec(postgresMigrations[i]); err != nil { return errors.Wrap(err, "failed to execute migration #%v", i) } diff --git a/internal/database/sqlite.go b/internal/database/sqlite.go index 3d1f70b..264bc2c 100644 --- a/internal/database/sqlite.go +++ b/internal/database/sqlite.go @@ -39,7 +39,7 @@ func (db *DB) openSQLite() error { } // SQLite has a query planner that uses lifecycle stats to fund optimizations. - // This restricts the SQLite query planner optimizer to only run if sufficient + // This restricts the SQLite query planner optimizer to only run if sufficient // information has been gathered over the lifecycle of the connection. // The SQLite documentation is inconsistent in this regard, // suggestions of 400 and 1000 are both "recommended", so lets use the lower bound. @@ -125,7 +125,7 @@ func (db *DB) migrateSQLite() error { } } else { for i := version; i < len(sqliteMigrations); i++ { - db.log.Info().Msgf("Upgrading Database schema to version: %v", i) + db.log.Info().Msgf("Upgrading Database schema to version: %v", i+1) if _, err := tx.Exec(sqliteMigrations[i]); err != nil { return errors.Wrap(err, "failed to execute migration #%v", i) }