DBA
Database administration endpoints for on-demand pruning and migration deployment. They complement the automated maintenance schedule: use them for manual cleanup or from CI/CD.
All endpoints require admin access (admin or superadmin role).
Prune on demand
Section titled “Prune on demand”POST /api/dba/pruneRuns HotMesh’s built-in prune operations against the workflow database for one namespace. Every field except app_id is optional, and the defaults are conservative.
Auth: Requires admin access.
Request body
| Field | Type | Default | Description |
|---|---|---|---|
app_id |
string |
Required. Application namespace to prune. | |
expire |
string |
"7 days" |
Retention period. Only records older than this are affected. |
jobs |
boolean |
true |
Hard-delete expired jobs. |
streams |
boolean |
true |
Hard-delete expired streams. |
engineStreams |
boolean |
Prune engine consumer streams. | |
engineStreamsExpire |
string |
Retention for engine stream entries. | |
workerStreams |
boolean |
Prune worker consumer streams. | |
workerStreamsExpire |
string |
Retention for worker stream entries. | |
attributes |
boolean |
false |
Strip execution artifacts (activity inputs and outputs) from jobs. |
entities |
string[] |
Entity allowlist. Only jobs matching these entity names are pruned. | |
pruneTransient |
boolean |
false |
Delete transient jobs (where entity is null). |
keepHmark |
boolean |
false |
Preserve the hmark field during attribute stripping. |
Example request (delete everything older than 30 days)
curl -s https://lt.acme.dev/api/dba/prune \ -X POST \ -H "Authorization: Bearer $LT_TOKEN" \ -H "Content-Type: application/json" \ -d '{"app_id": "longtail", "expire": "30 days", "jobs": true, "streams": true, "pruneTransient": true}'Example request (strip artifacts from review workflows, keep hmark)
curl -s https://lt.acme.dev/api/dba/prune \ -X POST \ -H "Authorization: Bearer $LT_TOKEN" \ -H "Content-Type: application/json" \ -d '{"app_id": "longtail", "expire": "14 days", "attributes": true, "entities": ["reviewContent"], "keepHmark": true}'Response 200
{ "jobs": 42, "streams": 156, "attributes": 0, "transient": 18, "marked": 0}Each field is the count of records that operation affected.
Response 400: { "error": "app_id is required" }
Deploy
Section titled “Deploy”POST /api/dba/deployDeploys the server-side prune function and runs all pending database migrations for a namespace. Both steps are idempotent, so it is safe to call on every startup or from a CI/CD pipeline.
Auth: Requires admin access.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
app_id |
string |
Yes | Application namespace to deploy into. |
The call runs dbaService.deploy(), which:
- Creates or replaces the HotMesh server-side prune function in Postgres.
- Runs
migrate()to apply any pending schema files fromservices/db/schemas/.
Example request
curl -s https://lt.acme.dev/api/dba/deploy \ -X POST \ -H "Authorization: Bearer $LT_TOKEN" \ -H "Content-Type: application/json" \ -d '{"app_id": "longtail"}'Response 200
{ "ok": true }Response 400: { "error": "app_id is required" }
