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.idproject_idโproject.idpage_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
idas 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.
attemptis the generation fence and remains1in V1. A failed generation is retried by creating a new Code2WF row, not by mutating the old row.- Terminal webhooks store
result_url,flag_countorerror_message, and update the audit fields. - Placement sets
materialized_at. PostgreSQL does not store generated Figma node IDs or the generated node tree.