Skip to content

Function: withSoftStorageInit()

withSoftStorageInit(store): PostgresStore

Soften PostgresStore.init so a failed migration (e.g. Lakebase must be owner of table … on ALTER) is logged once instead of rethrown on every storage call.

Mastra’s augmentWithInit retries init forever when it throws, so the only way to keep serving against an already-usable schema is to treat migration failure as success and mark the store initialized.

Concurrent first callers share one soft attempt. Non-ownership failures stay fatal so missing schemas/tables are retried or surfaced instead of hidden.

PostgresStore

PostgresStore