Skip to main content
CompanyWorkspaceConnector is a per-row provenance junction table that records the relationship between a Company entity and a WorkspaceConnector instance, discriminated by a direction field (input for data pulled from the connector, output for data pushed to it). It mirrors the document_workspace_connectors pattern and was introduced in W19 to replace a rejected single ManyToOne shape. Tenant scope is inherited indirectly through the referenced Company.workspace and WorkspaceConnector.workspace — there is deliberately no direct workspace_pk column on the junction itself. Multiple rows are permitted per (company, connector, direction) triple; deduplication logic is deferred to a future iteration.
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 — serial primary key, auto-incremented by Postgres on INSERT; never exposed in API responses.
  • created_at — stamped once at INSERT time via MikroORM onCreate: () => new Date(); no caller input accepted.
  • updated_at — stamped at INSERT and refreshed on every UPDATE via MikroORM onUpdate: () => new Date().
  • deleted_at — soft-delete sentinel; set by the connector sync pipeline (not user-initiated); rows with non-null deleted_at are filtered out of active queries.
  • No workspace_pk column by design — tenant scope is inherited through the Company and WorkspaceConnector parent relationships; Hasura RLS traverses these relationships for row-level isolation.
  • No unique constraint on (company_pk, workspace_connector_pk, direction) — duplicate rows are permitted by design; deduplication is deferred to a future iteration (stated explicitly in migration comments).
  • No external_id field — connector-pointer provenance only; external-object identity tracking is iteration 4+ work.
  • Rows are created exclusively by the connector sync orchestrator during entity persistence; there is no user-facing resource PATCH route for this junction.

Example

Source: apps/api/src/database/entities/CompanyWorkspaceConnector.ts · domain: ingestion · tier: Infrastructure