Skip to content

fix(settings): JSON-encode plant timezone so saving works on PostgreSQL - #277

Merged
jakub-przepiora merged 1 commit into
developfrom
fix/timezone-json-setting
Aug 31, 2026
Merged

fix(settings): JSON-encode plant timezone so saving works on PostgreSQL#277
jakub-przepiora merged 1 commit into
developfrom
fix/timezone-json-setting

Conversation

@jakub-przepiora

Copy link
Copy Markdown
Contributor

Saving system settings 500s on PostgreSQL

TimezoneRegistry::save() wrote the raw timezone identifier (e.g. Europe/Warsaw) straight into system_settings.value — a JSON column. PostgreSQL rejects a bare string:

SQLSTATE[22P02]: invalid input syntax for type json … Token "Europe" is invalid

so every Settings → System save 500s on a Postgres install (the default Docker deployment). SQLite stores it as text, so the suite passed — and an existing test even asserted the raw value and warned against json_encode, locking the bug in.

Fix

  • save()json_encode($timezone) (valid JSON for the column).
  • stored()json_decode(...), tolerating a legacy raw value.
  • Flip SystemSettingsTimezoneTest to expect JSON storage + round-trip.

Verified live on a PostgreSQL box (save + read round-trip) and the full suite is green (2528).

🤖 Generated with claude-flow

…greSQL

TimezoneRegistry wrote the raw identifier into system_settings.value, which is a
JSON column — PostgreSQL rejects a bare string ('invalid input syntax for type
json'), 500-ing every Settings → System save. SQLite tolerated it, so the suite
(and an assertion that pinned the raw value) missed it. Encode on write, decode on
read (tolerating a legacy raw value), and flip the test to expect JSON storage.
@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • cla-signed

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 250a74f0-a37c-4384-a055-9af27f7746c7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jakub-przepiora
jakub-przepiora merged commit aeaf5d4 into develop Aug 31, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant