Repository navigation
feat: Implement SQLite database support - #4912
Merged
marcelomendoncasoares merged 38 commits intoApr 13, 2026
Merged
Conversation
marcelomendoncasoares
force-pushed
the
sqlite
branch
8 times, most recently
from
April 1, 2026 22:54
52664ec to
dd6c04d
Compare
marcelomendoncasoares
force-pushed
the
sqlite
branch
3 times, most recently
from
April 2, 2026 03:02
2915f8a to
1e912fb
Compare
marcelomendoncasoares
force-pushed
the
sqlite
branch
from
April 2, 2026 03:35
1e912fb to
18cfd93
Compare
marcelomendoncasoares
marked this pull request as ready for review
April 2, 2026 03:52
…write with no transaction
Crazelu
reviewed
Apr 7, 2026
Crazelu
reviewed
Apr 7, 2026
marcelomendoncasoares
force-pushed
the
sqlite
branch
from
April 7, 2026 23:23
b47d4b6 to
5246959
Compare
nielsenko
reviewed
Apr 8, 2026
nielsenko
left a comment
Collaborator
There was a problem hiding this comment.
This was a big one. Looks good, but got some comments/questions.
nielsenko
reviewed
Apr 8, 2026
nielsenko
reviewed
Apr 8, 2026
nielsenko
reviewed
Apr 8, 2026
nielsenko
reviewed
Apr 8, 2026
nielsenko
reviewed
Apr 8, 2026
nielsenko
approved these changes
Apr 13, 2026
nielsenko
left a comment
Collaborator
There was a problem hiding this comment.
LGTM 🎸
We have a recurring issue with:
serverpod_test_server-1 | +1654 ~6 -1: test_integration/future_calls/broken_future_calls_test.dart: Given a Serverpod server instance with default config and at least 1000future calls in the database containing unregistered and broken future calls when starting Serverpod then a warning is logged about skipping the check for broken future calls [E]
etc.
But not related to this PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes: #4785
Closes: #160
Implementation followed closely the spec on the issue (worth reading before reviewing this PR).
The only deviation was to ignore unsupported indexes instead of forbidding. This was preferred because it allows the same project definition to be used for different dialects - which is specially important for modules, that will be used in different projects with different dialects.
About batch operations
The original idea was to completely reuse all SQL query builders from Postgres, since SQLite is mostly compatible on the syntax. However, for
insertandupdateoperations, Postgres rely on theDEFAULTkeyword that can be used inside theVALUESclause, and this is not supported by SQLite. On SQLite, we need to use theDEFAULTkeyword outside theVALUESclause and omit the columns that have a default value for it to take effect.Because of this, batch inserts on SQLite were simplified to a transaction/savepoint wrapper around multiple single row inserts. An improvement could be to group rows by the columns that are present, but this would introduce a lot of complexity and mess with the order of the rows. If a better solution is found in the future, this should be improved.
Migrations
As specified, SQLite has way less column types than Postgres, which requires us to store the target column type during migrations for a proper analysis when inspecting the database schema. This is specially important for repair migrations. If the
ColumnDefinitionclass receive new fields, such fields must also be added to the stored schema table.Testing
This PR introduces the
serverpod_test_sqlitepackage, which contains the integration and migrations e2e tests for the SQLite dialect. These tests will run in the CI in parallel with the other tests.Tests were copied from the
serverpod_test_serverpackage "as is" on commit 91006c7 and adapted to the SQLite dialect later on commit 32cb49f so we can track exactly what is supported and how the behavior differs from the Postgres dialect.Pre-launch Checklist
///), and made sure that the documentation follows the same style as other Serverpod documentation. I checked spelling and grammar.If you need help, consider asking for advice on the discussion board.
Breaking changes
None.