Optional ReadonlytransactionThe portable isolation levels this adapter honours.
Begin a transaction, returning a handle that can open transaction-scoped data sources as well as commit and roll back.
Optionaloptions: TransactionOptions
Optional transaction settings; omitted preserves the backend default
The transaction handle
Opens the underlying connection (pool).
Open a non-transactional data source for the named entity.
Entity name (for example 'User')
A data source bound to that entity
Closes the underlying connection (pool).
OptionalisReports whether the backend answers right now (optional, M95b).
isReady() — the lifecycle member this interface inherits — reports
that connect() once succeeded; it says nothing about the backend now,
and a probe built on it reports up for a database that has been dead
for minutes (X51-1). This member is the liveness read the lifecycle
read was mistaken for. true — the backend answered; false — it was
contacted and refused or failed; a rejection reports as "could not
determine". An adapter that cannot probe honestly OMITS the member: a
probe that was never written is evidence of nothing, and the
DatabaseService reports its absence rather than inventing an answer.
Optional on the fs?/workers?/dns? precedent, so an out-of-repo
adapter without it is unaffected.
An implementation SHOULD answer false once it has been disconnected,
rather than reporting on a connection it no longer holds. The health
indicator gates this probe behind the lifecycle read as well, so a
probe that forgets to is not a readiness defect — but this member is
also read directly through DatabaseService.reachability(), where
nothing else is watching.
true when the backend answered, false when it did not
Reports whether the adapter is connected and usable.
true when ready
Execute a raw query in the backend's own dialect.
Expected row shape
The query text
Optionalparams: unknown[]
Positional parameters
The result rows
The full database backend port: lifecycle plus data access.
This is the seam an application implements to plug a database the framework does not ship an adapter for, and hand it to
DatabasePlugin({ type: 'custom', adapter }). It lives incommonrather than inside the database plugin precisely so a backend can be written in another package —cloudflare-plugin'sD1Adapteris the first.migrate()is deliberately absent: programmatic migration is not honestly implementable across the supported backends, and every one of them owns migrations through its own CLI.Example
Since
0.2.0