Repository navigation
feat: Add jsonb column support and GIN index operator classes - #4960
Conversation
…ve serializeAsJsonbAsDefault from experimental feature to CLI config; merge _buildModelTableCustomSerializedFieldTypeReference() into _buildModelTableGeneralFieldExpression()
…pod server models
…e_generation_test; add to index_test
# Conflicts: # packages/serverpod/lib/src/database/adapters/postgres/database_connection.dart # tests/serverpod_test_client/lib/src/protocol/client.dart # tests/serverpod_test_client/lib/src/protocol/protocol.dart # tests/serverpod_test_server/lib/src/generated/endpoints.dart # tests/serverpod_test_server/lib/src/generated/protocol.dart # tests/serverpod_test_server/test_integration/test_tools/serverpod_test_tools.dart # tools/serverpod_cli/lib/src/analyzer/models/yaml_definitions/class_yaml_definition.dart
…keyword; add class-level ValidateNode for the serializationDataType keyword
|
I have read the CLA Document and I hereby sign the CLA |
# Conflicts: # tools/serverpod_cli/lib/src/config/config.dart # tools/serverpod_cli/lib/src/config/experimental_feature.dart
# Conflicts: # tests/serverpod_test_server/migrations/migration_registry.txt
# Conflicts: # tests/serverpod_test_server/migrations/migration_registry.txt
marcelomendoncasoares
left a comment
There was a problem hiding this comment.
Great work with the PR, @developerjamiu!! All comments from the other PR were correctly addressed. Besides comments for improvement on the implementation and tests, there are two main points that are still not completely addressed:
- Proper support for JSONB as BLOB on SQLite (with integration tests).
- Migration support between JSON <-> JSONB (with migration e2e tests).
There is also one small change in the direction of the original implementation that I put for discussion below to create a new ColumnStructured instead of storing a serializationDataType field on the ColumnSerializable.
About the migration support, although it must be in for the feature to be complete, if you're ok with it, I'd suggest we create an issue and split the work to a follow-up PR to avoid bloating this one too much.
Thanks for the thorough review! Agreed on all three main points:
For the remaining comments: I'll push changes and resolve each conversation as addressed. |
marcelomendoncasoares
left a comment
There was a problem hiding this comment.
Good job with the changes, @developerjamiu! A few more comments and we should be ready to merge.
marcelomendoncasoares
left a comment
There was a problem hiding this comment.
Great work with this PR, @developerjamiu! LGTM 🚀
I have only one nit comment about the placement of the default resolution to get even closer to the fields resolution, but feel free to address or merge directly.
Adds JSONB column support for serializable fields, configurable at project/class/field level, with GIN indexes and operator class support.
Carries forward @borutjures's original PR #3934 (32 commits preserved) and resolves all 7 review items from the Sep 23 review. Based on alignment call with @marcelomendoncasoares on 2026-04-08.
Main architectural change: refactored serialization config resolution from top-down to bottom-up three-pass (field → class → project), each pass isolated to its own level. Also adds SQLite dialect support (merged after original PR stalled), GIN-on-non-jsonb validation, and a
copyWithPrefixbug fix that was silently dropping operator classes on inherited indexes.Usage:
Known limitation: migrating an existing
jsoncolumn tojsonbtriggers a destructive warning and requires--forceor a manualALTER COLUMN TYPE. Matches existinginteger ↔ bigintprecedent; auto-generating theALTERis a reasonable follow-up.Closes #3919, Closes #3934
Pre-launch Checklist
///).Breaking changes
None.