pub struct PoolWithSchema { /* private fields */ }Expand description
Database pool with per-pool schema readiness tracking.
Wraps DbPool and adds an AtomicBool flag to track schema initialization
per pool instance. This eliminates the issue of global state interfering
when multiple pools point to different databases.
Implementations§
Source§impl PoolWithSchema
impl PoolWithSchema
Sourcepub fn with_postgres_migration_timeout(
pool: Arc<DbPool>,
postgres_migration_timeout: Duration,
) -> Self
pub fn with_postgres_migration_timeout( pool: Arc<DbPool>, postgres_migration_timeout: Duration, ) -> Self
Creates a new pool with schema tracking and a PostgreSQL migration timeout.
Sourcepub async fn ensure_schema_ready(&self) -> Result<(), Error>
pub async fn ensure_schema_ready(&self) -> Result<(), Error>
Ensures database schema is ready by running pending migrations.
Checks if migrations have already been applied via one of:
- Per-pool flag (
schema_ready) AGENTIC_API_SCHEMA_READYenvironment variable
If none of the above, runs all pending migrations from the migrations/ directory.
Supervisor-managed PostgreSQL schemas still verify required compatibility upgrades.
§Errors
Returns a sqlx::Error if migrations fail.
Auto Trait Implementations§
impl !Freeze for PoolWithSchema
impl !RefUnwindSafe for PoolWithSchema
impl !UnwindSafe for PoolWithSchema
impl Send for PoolWithSchema
impl Sync for PoolWithSchema
impl Unpin for PoolWithSchema
impl UnsafeUnpin for PoolWithSchema
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more