← Back to Home

How to Model Video Pipeline State in Cloudflare D1

Updated March 5, 2026
d1workflow statevideo pipelinecloudflareschema design

Modeling Pipeline State in D1

Track stage state in normalized tables, not only in workflow memory.

Core Tables

Run Tracking

INSERT OR IGNORE INTO workflow_runs (
  workflow_id, stage, video_id, parent_workflow_id, trigger_source, status, config_json
) VALUES (?, ?, ?, ?, ?, 'queued', ?)

Upsert Edge Case in D1

ON CONFLICT DO UPDATE can return last_row_id=0. Fallback by selecting row ID explicitly:

SELECT id FROM article_versions WHERE article_id = ? AND version = ?

Recommended Status Rules