docs/database.md
- Source: docs/database.md
Imported Content
Database Persistence
Gateway persistence now relies on PostgreSQL and no longer uses in-memory resource state.
Required environment
DATABASE_URLPGSSLMODE(disablefor local,requirefor managed providers)
Apply migrations
infra/sql/0001_init.sqlinfra/sql/0002_psa_resources.sqlinfra/sql/0003_idempotency.sqlinfra/sql/0004_event_pipeline.sqlinfra/sql/0005_job_queue.sqlinfra/sql/0006_security_hardening.sqlinfra/sql/0007_configuration_plane.sqlinfra/sql/0008_job_metadata.sqlinfra/sql/0009_workflow_execution_metadata.sqlinfra/sql/0010_worker_runtime.sqlinfra/sql/0011_portal_invites.sql
Or use scripts/apply-migrations.sh with DATABASE_URL set.
Optional local sample data can be loaded with scripts/seed-dev-data.sh.
The psa_resources table stores validated JSON documents per resource type with strict workspace partitioning.
Notes
- Core workflow/audit tables (
workflow_executions,audit_credentials) are used by execution routes. - Workflow execution metadata includes
input_ref,output_ref,evidence_ref,duration_ms,retry_count, andfailure_code. - Workflow callback payloads are captured in
workflow_callbacks. - API resource CRUD routes persist to
psa_resources. - Idempotency records are stored in
idempotency_records. - Telemetry batches and routed actions are persisted in
telemetry_ingest_batchesandoutbox_events. - Async import/export and other queued work are tracked in
background_jobswith lifecycle fields (queued_at,started_at,completed_at,retry_count,artifact_url, error metadata). - Runtime worker freshness and status are tracked in
worker_runtime_status. - Portal invite JWT lifecycle and revocation are tracked in
portal_invites. - Webhook replay receipts are tracked in
webhook_receipts. - Runtime control-plane config is stored in
platform_settings,workspace_settings, and encryptedruntime_secrets.