SeaQL / sea-orm

🐚 An async & dynamic ORM for Rust
https://www.sea-ql.org/SeaORM/
Apache License 2.0
6.56k stars 459 forks source link

feat: Support for lazy database connections #2268

Open spencewenski opened 6 days ago

spencewenski commented 6 days ago

PR Info

New Features

Add support for creating DB connection pools without establishing connections up front. This is already supported by SQLx via the Pool::connect_lazy method.

This was discussed previously here, but it appears support was never added to SEA ORM directly.

Bug Fixes

Breaking Changes

Changes

This PR adds a new connect_lazy option to database::ConnectOptions. If set to true, the SQLx Pool will be created using the Pool::connect_lazy_with method; otherwise, the Pool::connect_with method will be used (e.g., the existing behavior). This "lazy" behavior is implemented for each DB variant (Postgres/MySQL/SQLite).

spencewenski commented 2 days ago

Hey @billy1624 , @tyt2y3 , can you take a look at this when you get a chance? Or assign to someone else to review? Thanks!