Skip to content

Database readiness API

Readiness checks are explicit, read-only startup gates for the official PostgreSQL and MySQL adapters. They verify that migration history is current and that the connected credential matches either the runtime or retention lane. They never migrate, grant privileges, or write action data.

Call the adapter-specific function after creating the application's pool and before accepting work. Stop startup when ready is false and surface issues to operators. Do not silently continue with a migrator credential.

MySQL readiness intentionally requires the direct grants emitted by render_mysql_grants. Assigned roles or additional grants fail the exact posture check, even if they happen to produce similar effective access. This keeps the boot-time result deterministic; qualify a custom role-based profile separately instead of weakening the official one.

readiness

Framework-neutral database startup readiness results.

DatabaseAdapter

Bases: StrEnum

POSTGRESQL class-attribute instance-attribute

POSTGRESQL = 'postgresql'

MYSQL class-attribute instance-attribute

MYSQL = 'mysql'

SQLITE class-attribute instance-attribute

SQLITE = 'sqlite'

DatabaseAccessLane

Bases: StrEnum

RUNTIME class-attribute instance-attribute

RUNTIME = 'runtime'

RETENTION class-attribute instance-attribute

RETENTION = 'retention'

DatabaseReadiness dataclass

DatabaseReadiness(adapter: DatabaseAdapter, lane: DatabaseAccessLane, applied_versions: tuple[int, ...], pending_versions: tuple[int, ...], schema_current: bool, privilege_boundary_valid: bool, issues: tuple[str, ...])

Read-only schema and privilege readiness for one application lane.

adapter instance-attribute

adapter: DatabaseAdapter

lane instance-attribute

applied_versions instance-attribute

applied_versions: tuple[int, ...]

pending_versions instance-attribute

pending_versions: tuple[int, ...]

schema_current instance-attribute

schema_current: bool

privilege_boundary_valid instance-attribute

privilege_boundary_valid: bool

issues instance-attribute

issues: tuple[str, ...]

ready property

ready: bool

Whether this connection is safe to use for the requested lane.