Batch Table
Overview
Stores one project-scoped batch of up to 500 requests. Supported operations are Page Import, Code2Des, and Page Discovery (one homepage per batch).
Table Definition
| Logical Name | Physical Name | Column Name | Data Type | Primary Key | Relation | Unique | Nullable | Default Value | Remarks |
|---|---|---|---|---|---|---|---|---|---|
| Batch | batch | id | string | โฏ | Client UUID / ใฏใฉใคใขใณใ UUID (varchar(255)) |
||||
| organization_id | number | organization:id | Organization scope / ็ต็น | ||||||
| project_id | number | project:id | Project scope / ใใญใธใงใฏใ | ||||||
| type | string | page_import, code2des, or page_discovery (varchar(32)) |
|||||||
| request_hash | string | SHA-256 of normalized input or retry source batch / ๅ
ฅๅใพใใฏๅ่ฉฆ่กๅ
ใใใใฎ SHA-256 (varchar(64)) |
|||||||
| created_at | datetime | CURRENT_TIMESTAMP | Shared audit field / ๅ ฑ้็ฃๆป้ ็ฎ | ||||||
| updated_at | datetime | CURRENT_TIMESTAMP | Shared audit field / ๅ ฑ้็ฃๆป้ ็ฎ | ||||||
| deleted_at | datetime | โฏ | Soft delete / ่ซ็ๅ้คๆฅๆ | ||||||
| created_by | string | Cognito subject (varchar(50)) |
|||||||
| updated_by | string | Cognito subject (varchar(50)) |
|||||||
| deleted_by | string | โฏ | Cognito subject (varchar(50)) |
Relations
organization_idโorganization.id(delete cascade)project_idโproject.id(delete cascade)batch_item.batch_idโbatch.id(delete cascade)
Indexes
- PRIMARY KEY (
id) - INDEX
batch_org_project_idx(organization_id,project_id)
Notes
batchandbatch_itemare shared across operations. Adding an operation requires request validation and a registered job handler, not new batch tables.services/batch-operations.tsregisters job preparation, status lookup, retry validation, and dead-letter handling. Feature job tables remain the source of processing status and results.- The existing
/page-batchesAPI and internal dispatcher path remain unchanged for the plugin and schedule. - Aggregate status is derived from child jobs and dispatch metadata; counters are not stored separately.
- Dispatch claims expire after 90 seconds. Row locks prevent concurrent claims. Queue delivery is attempted up to three times using the same child ID and message.
- Workers do not connect to PostgreSQL. Existing webhooks update Page Import and Code2Des completion. Page Discovery publishes status and URL previews to S3; its registered handler reads those results without an additional job table.