ORM-05: Add the Config builder #5
Labels
No labels
area:core
area:database
area:migrations
area:model
area:relations
area:schema
area:tests
breaking-change
size:M
size:S
tracking
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
NoctisWolfshadow/tessera-orm#5
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Depends on: #1, #2
Context
Database settings (where it lives, foreign keys, journal mode, busy timeout) need one place. SQLite pragmas are per connection, so they must be applied every time a connection is opened. Foreign keys are off by default in SQLite and relationships depend on them.
Tasks
Config::file(path)andConfig::memory().foreign_keys(bool)(default true),journal_mode(JournalMode)(SQLite's default unless set;Walis opt-in),busy_timeout(Duration)(default 5 s).Config::open() -> Result<Connection>opens and applies the pragmas. Check the journal mode SQLite reports; in-memory databases reportmemory, which is not an error.tempfileas a dev-dependency.Example
Acceptance criteria
Error::Sqlite, not a panic.Databaseconnection management (ambient connection) #6