[PR #2033] [MERGED] fix: handle mixed-format bucket configurations in migration #8009

Closed
opened 2026-04-20 17:58:57 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/2033
Author: @kolaente
Created: 12/29/2025
Status: Merged
Merged: 1/5/2026
Merged by: @kolaente

Base: mainHead: fix-bucket-config-migration-filter


📝 Commits (2)

  • 30c38b6 fix: handle mixed-format bucket configurations in migration
  • 0ad3a6f fix missing fields

📊 Changes

1 file changed (+54 additions, -26 deletions)

View changed files

📝 pkg/migration/20251001113831.go (+54 -26)

📄 Description

Summary

  • Uses json.RawMessage to flexibly parse bucket configuration filters that may be in old (string) or new (object) format
  • Detects each filter's format by checking the first JSON character (" = string, { = object)
  • Only updates rows that actually contain string filters needing conversion
  • Simplifies WHERE clause since format detection now happens in code

Problem

Migration 20251001113831 would fail with:

json: cannot unmarshal object into Go struct field bucketConfigurationCatchup.filter of type string

This occurred when a single bucket_configuration JSON array contained mixed formats - some buckets with old string filters and some with already-converted object filters.

Test Plan

  • Run migration on database with mixed-format bucket configurations
  • Verify string filters are converted to object format
  • Verify already-converted object filters are preserved
  • Verify empty/null filters remain nil

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-vikunja/vikunja/pull/2033 **Author:** [@kolaente](https://github.com/kolaente) **Created:** 12/29/2025 **Status:** ✅ Merged **Merged:** 1/5/2026 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `fix-bucket-config-migration-filter` --- ### 📝 Commits (2) - [`30c38b6`](https://github.com/go-vikunja/vikunja/commit/30c38b6f12d5ed49c253cbd7c9b9a601cc29590b) fix: handle mixed-format bucket configurations in migration - [`0ad3a6f`](https://github.com/go-vikunja/vikunja/commit/0ad3a6f406d462fa0f1d80cb38885266a01d90ee) fix missing fields ### 📊 Changes **1 file changed** (+54 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `pkg/migration/20251001113831.go` (+54 -26) </details> ### 📄 Description ## Summary - Uses `json.RawMessage` to flexibly parse bucket configuration filters that may be in old (string) or new (object) format - Detects each filter's format by checking the first JSON character (`"` = string, `{` = object) - Only updates rows that actually contain string filters needing conversion - Simplifies WHERE clause since format detection now happens in code ## Problem Migration `20251001113831` would fail with: ``` json: cannot unmarshal object into Go struct field bucketConfigurationCatchup.filter of type string ``` This occurred when a single `bucket_configuration` JSON array contained mixed formats - some buckets with old string filters and some with already-converted object filters. ## Test Plan - [ ] Run migration on database with mixed-format bucket configurations - [ ] Verify string filters are converted to object format - [ ] Verify already-converted object filters are preserved - [ ] Verify empty/null filters remain nil --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-20 17:58:57 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#8009