-
Notifications
You must be signed in to change notification settings - Fork 511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: experimental database layer #1351
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1351 +/- ##
===========================================
+ Coverage 51.94% 76.64% +24.69%
===========================================
Files 174 70 -104
Lines 12035 7171 -4864
Branches 913 711 -202
===========================================
- Hits 6252 5496 -756
+ Misses 5686 1674 -4012
+ Partials 97 1 -96 β View full report in Codecov by Sentry. |
I'm new to how Nitro/Nuxt works but I have 2 questions:
|
I am thinking of
Once we migrate to DB0, we can support reconnect support. As you mentioned, HMR is the tricky part because any (runtime) logic will be restarted. Another thing we have in plan, is a HTTTP driver this way we can initialize DBs in the builder namespace and expose it via HTTP (or another RPC channel) to the runtime to handle HMR. |
Got it, thanks for the quick reply! |
I don't know what is drizzle-orm, people use sequalize, typeorm, prism and mikro-orm. |
would it be possible to use with other orms, notably prisma |
It is on the track. As long as an ORM allow implementing external providers and compatible with SQLite dialects i don't see any reason we couldn't support any of them (this PR is BTW placeholder actual work is under progress in a currently private repo) |
so basically, instead of using all the code here, i could directly use does useDatabase enable us to use different db servers? postgres for example? and passing args for db server like i've put in the codebase //edit: yikes, seems |
π Linked issue
β Type of change
π Description
This PR adds support for experimental Database support with zero configuration, SQLite and multi-provider support powered by unjs/db0.
It is also possible to integrate this layer with extra ORMS such as drizzle-orm with built-in connectors from db0.
Example usage:*
Enable experimental flag:
For nuxt:
Install
better-sqlite3
:And then, voila!
TODO:
Next steps:
useDB
without the flag once db0 is stableπ Checklist