Skip to content

Code2WF Table

Overview

Stores the lifecycle and Figma destination for one Code2WF generation. The generated specification remains in S3 and Figma.

Table Definition

Logical Name Physical Name Column Name Data Type Primary Key Relation Unique Nullable Default Value Remarks
Code2WF code2wf id string โ—ฏ backend-generated UUIDv7 (varchar(255)); exposed as code2wfId and sent to the worker as code2wf_id
organization_id number organization:id organization scope
project_id number project:id project scope
page_import_id string page_import:id source Page Import (varchar(255))
figma_file_key string Figma file used for plugin discovery and materialization (varchar(255))
screen_id string generated screen identifier (varchar(255))
placement_target string โ—ฏ optional Figma node used as a placement reference (varchar(255))
status enum '0' wf2des_status; see Type Codes
attempt number 1 generation attempt; fixed at 1 in V1
flag_count number โ—ฏ number of generated spec outcomes with flagged=true
result_url string โ—ฏ immutable result or failure artifact S3 key (varchar(500))
error_message string โ—ฏ safe failure message (text)
materialized_at datetime โ—ฏ time the plugin completed Figma placement
created_at datetime CURRENT_TIMESTAMP shared audit field
updated_at datetime CURRENT_TIMESTAMP shared audit field
deleted_at datetime โ—ฏ shared soft-delete field
created_by string shared audit actor string
updated_by string shared audit actor string
deleted_by string โ—ฏ shared audit actor string

Relations

  • organization_id โ†’ organization.id
  • project_id โ†’ project.id
  • page_import_id โ†’ page_import.id; creation requires a completed Page Import in the same project
  • Audit actor fields store the Cognito subject or backend actor name

Indexes

  • PRIMARY KEY (id)
  • INDEX code2wf_project_id_deleted_at_idx (project_id, deleted_at)
  • INDEX code2wf_project_status_idx (project_id, status)
  • INDEX code2wf_org_project_file_status_idx (organization_id, project_id, figma_file_key, status)
  • INDEX code2wf_page_import_id_idx (page_import_id)

Type Codes

Database enum: wf2des_status. Code2WF uses these values:

Value Meaning
'0' processing
'1' completed
'2' failed

Code2WF does not emit enum values '3' or '4'.

Notes

  • The row stores page_import_id; Page Import manifests and hashes remain in S3.
  • The backend generates id as UUIDv7. Each valid POST creates a new row and dispatches a new job; Code2WF has no request-deduplication index.
  • The backend creates the row before queue dispatch and owns every PostgreSQL write. Workers never receive PostgreSQL credentials.
  • attempt is the generation fence and remains 1 in V1. A failed generation is retried by creating a new Code2WF row, not by mutating the old row.
  • Terminal webhooks store result_url, flag_count or error_message, and update the audit fields.
  • Placement sets materialized_at. PostgreSQL does not store generated Figma node IDs or the generated node tree.