Skip to content

feat: Generate a client-side database from the models - #4994

Merged
marcelomendoncasoares merged 15 commits into
serverpod:mainfrom
marcelomendoncasoares:client-database-session
May 1, 2026
Merged

marcelomendoncasoares merged 15 commits into
serverpod:mainfrom
marcelomendoncasoares:client-database-session

Conversation

@marcelomendoncasoares

@marcelomendoncasoares marcelomendoncasoares commented Apr 24, 2026 •

Copy link
Copy Markdown
Collaborator

This PR contain all pieces left to allow the creation of client-side databases. Besides having separate issues, it would be impossible to test any of the pieces in isolation. To avoid carrying bugs from PRs that would look complete, but not tested in runtime, I decided to open a single PR that validates the feature end-to-end.

For an easier review, this PR is best reviewed commit by commit.

Closes: #4791
Closes: #4792
Closes: #4793
Closes: #4783
Fixes: #5021

About testing

One third of the changes of this PR come from the tests added on commit 7010922 to validate the runtime behavior of the client-side database. Such tests do not need review as they are a mere copy of the serverpod_test_sqlite_server relation tests - only adapted to create the client session.

The tests are a small subset of the integration because the database is the same SQLite database that runs on the server - the same logic applies for migration tests.

The only area that showed unexpected behaviors was CRUD involving relations, because they depend on private/implicit properties of the models that only existed on the server-side. All other database features that are not tied to the model internals can be considered tested by the existing SQLite integration tests.

Pre-launch Checklist

  • I read the Contribute page and followed the process outlined there for submitting PRs.
  • This update contains only one single feature or bug fix and nothing else. (If you are submitting multiple fixes, please make multiple PRs.)
  • I read and followed the Dart Style Guide and formatted the code with dart format.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///), and made sure that the documentation follows the same style as other Serverpod documentation. I checked spelling and grammar.
  • I added new tests to check the change I am making.
  • All existing and new tests are passing.
  • Any breaking changes are documented below.

If you need help, consider asking for advice on the discussion board.

Breaking changes

None.

@marcelomendoncasoares
marcelomendoncasoares force-pushed the client-database-session branch 3 times, most recently from 0659dcd to 1df3753 Compare April 25, 2026 00:24
@marcelomendoncasoares
marcelomendoncasoares marked this pull request as ready for review April 25, 2026 01:19
@marcelomendoncasoares
marcelomendoncasoares requested a review from a team April 25, 2026 01:19
@marcelomendoncasoares
marcelomendoncasoares force-pushed the client-database-session branch 5 times, most recently from 228c903 to 663d99f Compare May 1, 2026 00:59

@nielsenko nielsenko left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🥇

@marcelomendoncasoares
marcelomendoncasoares merged commit 38a2da7 into serverpod:main May 1, 2026
83 checks passed
@marcelomendoncasoares
marcelomendoncasoares deleted the client-database-session branch May 1, 2026 13:58
@github-actions github-actions Bot locked and limited conversation to collaborators May 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

2 participants