Skip to main content
WorkspaceConnectorSyncTarget is the junction table that maps a single WorkspaceConnector to one or more target Workspace rows, enabling multi-workspace sync: one connector can ingest data into N workspaces, not only its own carrier workspace. Each row asserts β€œthis connector must push synced records into this workspace.” The table is soft-deleted (tombstones preserve audit history and allow re-add), and a partial unique index prevents a connector from targeting the same workspace twice while active. Backfill rows (one per legacy connector) were inserted by the creation migration so existing connectors continue to behave identically without code changes.
Internal object. Not currently exposed on the public REST API. The operations below describe the intended contract.

API operations

Data model

Attributes

Relationships

System-computed

  • pk β€” auto-increment SERIAL primary key assigned by PostgreSQL on INSERT; never exposed as a public UUID. The formatter surfaces String(row.pk) as the JSON:API id field because this junction has no dedicated *_id UUID column by design β€” consumers are expected to reference targets by their (workspace_connector_id, target_workspace_id) tuple.
  • created_at β€” stamped once on INSERT by MikroORM onCreate: () => new Date().
  • updated_at β€” stamped on INSERT and on every subsequent UPDATE by MikroORM onUpdate: () => new Date().
  • deleted_at β€” set to the current timestamp by WorkspaceConnectorSyncTargetService when a target is removed via the PUT set-semantics diff; set to NULL (re-add) when a soft-deleted row is reactivated. Never set by the connector sync pipeline directly.
  • Backfill rows β€” the creation migration (Migration20260527140000) inserts one row per active WorkspaceConnector pointing at its own carrier workspace with created_by_pk = NULL, preserving pre-feature 1:1 behaviour for legacy connectors without any code change.
  • Partial unique index idx_wcst_unique_active β€” enforced by PostgreSQL: UNIQUE (workspace_connector_pk, target_workspace_pk) WHERE deleted_at IS NULL. Guarantees at most one active target per (connector, workspace) pair; soft-deleted tombstones are excluded so a re-add is always safe.

Example

Source: /Users/maximechampoux/platform/apps/api/src/database/entities/WorkspaceConnectorSyncTarget.ts Β· domain: ingestion Β· tier: Infrastructure