From 9c8557a124101b3aa1d98ed8ed53216a0fb13289 Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Fri, 15 May 2026 06:32:58 +0300 Subject: [PATCH] updated changelog --- CHANGELOG.md | 3 ++- migrations/1778828400_normalize_indexes.go | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8769b7b3..808b9f7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,8 @@ - Added error marker for each collection tab and fixed the styles of the raw errors tooltip. - Fixed indexes collection update error ([#7689](https://github.com/pocketbase/pocketbase/issues/7689)). - _The fix comes with a system migration that resaves all collection models to ensure that their indexes are normalized and available in the collection model (it will also include indexes created manually via the sqlite3 cli or other external tools)._ + _⚠️ The fix comes with a system migration that resaves all collections with indexes to ensure that all indexes are normalized and available in the `Collection.Indexes` field (it will also include indexes created manually via the sqlite3 cli or other external tool)._ + _If you are using a test `pb_data` for your Go automation tests you may want to apply the migration to it too so that it runs only once and not for each execution of your tests, aka. you could run once `go run main.go migrate up --dir="/path/to/test_pb_data"`._ - Updated `modernc.org/sqlite` to v1.50.1 (SQLite 3.53.1). diff --git a/migrations/1778828400_normalize_indexes.go b/migrations/1778828400_normalize_indexes.go index ced218a9..96e70d1d 100644 --- a/migrations/1778828400_normalize_indexes.go +++ b/migrations/1778828400_normalize_indexes.go @@ -58,7 +58,7 @@ func init() { cParsed := dbutils.ParseIndex(raw) // index already exists (if needed it will be normalized on resave) - if strings.EqualFold(cParsed.IndexName, mParsed.IndexName) { + if cParsed.IndexName != "" && strings.EqualFold(cParsed.IndexName, mParsed.IndexName) { continue masterLoop } } @@ -70,6 +70,11 @@ func init() { for _, missing := range missingParsedIndexes { missingSQL := missing.Build() + // it shouldn't be possible but for just in case if there is an edge case the regex doesn't cover + if missingSQL == "" { + return fmt.Errorf("failed to build sqlite_master index: %v", missingSQL) + } + // drop the missing index to recreate later _, err := txApp.DB().DropIndex(missing.TableName, missing.IndexName).Execute() if err != nil {