Skip to main content
WorkspaceConnectorSyncLog is an append-style audit record that captures the lifecycle of a single connector sync run for a workspace. It is created when a sync begins (SCHEDULED or IN_PROGRESS), updated by the sync orchestrator as the run progresses, and finalised with SUCCESS or ERROR once the connector returns or fails. Every log row belongs to exactly one WorkspaceConnector and one Workspace, providing a per-connector execution history that the platform uses for observability, retry logic, and connector-status dashboards.

API operations

Data model

Attributes

Relationships

System-computed

  • workspace_connector_sync_log_id is generated by gen_random_uuid() at INSERT (PostgreSQL DEFAULT); the column carries a UNIQUE constraint.
  • created_at is set once by MikroORM onCreate: () => new Date() and never mutated.
  • updated_at is set by both onCreate and onUpdate hooks, advancing on every PATCH by the sync orchestrator.
  • deleted_at follows the platform-wide soft-delete convention; active rows have deleted_at = NULL; all repository and data-view queries must include this filter.
  • duration_ms is computed at finalisation time by the repository helpers (markSuccess / markError) as completed_at.getTime() - started_at.getTime(). It is null when started_at is null.
  • The workspace FK is denormalized from WorkspaceConnector.workspace at row creation time, enabling workspace-scoped index queries (idx_workspace_connector_sync_logs_workspace) without a join.
  • Three indexes support the common access patterns: composite (workspace_connector_pk, created_at DESC) for per-connector history paging; (workspace_pk) for workspace-scoped listing; (status) for filtering by sync state. None carry a WHERE predicate — they are plain B-tree indexes, not partial indexes.
  • The workspace_connector_service_id column that was present in the original migration was dropped in Migration20260407100000 and is absent from the current entity — do not reference it.
  • cloud_task_id was narrowed from TEXT to VARCHAR(255) in Migration20260407100000.

Example

Source: apps/api/src/database/entities/WorkspaceConnectorSyncLog.ts · domain: ingestion · tier: Platform