lt.dba
lt.dba runs database administration against the workflow tables in Postgres: on-demand pruning and deployment of the server-side prune function. It complements the scheduled lt.maintenance rules. See Postgres.
const result = await lt.dba.prune({ appId: 'durable', expire: '30 days', jobs: true, streams: true, entities: ['reviewContent'],});Prune expired jobs, stream messages and execution artifacts for one namespace.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
appId |
string |
Yes | Namespace to prune |
expire |
string |
No | Postgres interval; only records older than this are affected |
jobs |
boolean |
No | Hard-delete expired job rows |
streams |
boolean |
No | Hard-delete expired stream messages (engine and worker) |
engineStreams |
boolean |
No | Prune engine stream messages |
engineStreamsExpire |
string |
No | Retention for engine stream messages |
workerStreams |
boolean |
No | Prune worker stream messages |
workerStreamsExpire |
string |
No | Retention for worker stream messages |
attributes |
boolean |
No | Strip execution artifacts from completed jobs (keeps jdata, udata and jmark for export) |
entities |
string[] |
No | Only prune these entity types |
pruneTransient |
boolean |
No | Also delete jobs whose entity is null |
keepHmark |
boolean |
No | Keep hmark rows while stripping |
Returns: LTApiResult<PruneResult>: the count of records affected per operation.
Auth: Not required.
deploy
Section titled “deploy”const result = await lt.dba.deploy('durable');Deploy the server-side prune function and run pending migrations for a namespace. Idempotent; safe to call on every startup or from CI/CD. The app id is passed as a plain string.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
appId |
string |
Yes | Namespace (the first argument) |
Returns: LTApiResult<{ ok: true }>
Auth: Not required.
