This release extends boundary-tenant for schema-per-tenant deployments: a helper to run background-job work once per tenant with the tenant’s search_path pinned, and an idempotent upgrade path that backfills new tenant-scoped tables into already-provisioned tenants. Both are additive and backward compatible.
Added: per-tenant background-job iteration
for-each-tenant-schema is the background-job analogue of the HTTP wrap-tenant-schema middleware. On the request path a tenant’s search_path is pinned to tenant_<slug> for the duration of the request; a job running under the pooled context, by contrast, defaults to search_path = public and only sees the (now empty) public tables. The helper closes that gap:
(for-each-tenant-schema schema-provider db-ctx
(fn [schema-name]
;; runs inside this tenant's pinned connection + search_path
(do-work schema-name)))
For each provisioned tenant_<slug> schema it invokes your function inside that schema’s pinned connection via the provider’s with-tenant-schema. Per-tenant failures are isolated and counted — one tenant’s error is logged and never aborts the rest — and it returns {:processed n :failed n :results […]}.
Added: idempotent tenant-schema sync
provision-tenant! copies the tenant-scoped tables into a schema only at creation time and returns early when the schema already exists. So when the set of tenant-scoped-tables gains entries in a release, previously-provisioned tenants do not get the new tables — and any job or repository that touches them under the tenant search_path fails with a missing relation.
sync-tenant-schemas! is the upgrade path: run it on deploy after extending tenant-scoped-tables. It re-copies every tenant-scoped table structure into every existing tenant schema. Because the generated DDL is CREATE TABLE IF NOT EXISTS, existing tables are left untouched and only missing ones are created — fully idempotent, safe to re-run, and validated against a live PostgreSQL. It is a no-op on non-PostgreSQL databases and returns {:schemas-synced […] :tables […]}.
Version alignment
All libraries bumped to v1.0.1-alpha-35 to maintain lockstep versioning.
Upgrade
Re-run the installer to pick up the latest release:
curl -fsSL https://get.boundary-app.org | bash
No migration required. If a release of your app extends tenant-scoped-tables, call sync-tenant-schemas! once on deploy to backfill existing tenants; otherwise existing deployments behave as before.