Vapora/migrations/009_workflow_state.surql
Jesús Pérez b9e2cee9f7
Some checks failed
Documentation Lint & Validation / Markdown Linting (push) Has been cancelled
Documentation Lint & Validation / Validate mdBook Configuration (push) Has been cancelled
Documentation Lint & Validation / Content & Structure Validation (push) Has been cancelled
mdBook Build & Deploy / Build mdBook (push) Has been cancelled
Rust CI / Security Audit (push) Has been cancelled
Rust CI / Check + Test + Lint (nightly) (push) Has been cancelled
Rust CI / Check + Test + Lint (stable) (push) Has been cancelled
Documentation Lint & Validation / Lint & Validation Summary (push) Has been cancelled
mdBook Build & Deploy / Documentation Quality Check (push) Has been cancelled
mdBook Build & Deploy / Deploy to GitHub Pages (push) Has been cancelled
mdBook Build & Deploy / Notification (push) Has been cancelled
feat(workflow-engine): add saga, persistence, auth, and NATS-integrated orchestrator hardening
Key changes driving this: new saga.rs, persistence.rs, auth.rs in workflow-engine; SurrealDB migration 009_workflow_state.surql; backend
  services refactored; frontend dist built; ADR-0033 documenting the hardening decision.
2026-02-22 21:44:42 +00:00

22 lines
1.2 KiB
Plaintext

-- Migration 009: Workflow State Persistence
-- Replaces DashMap (in-memory, lost on restart) with durable SurrealDB storage.
-- WorkflowInstance is stored as a JSON document; status is a tagged serde enum.
DEFINE TABLE workflow_instances SCHEMAFULL;
DEFINE FIELD id ON TABLE workflow_instances TYPE record<workflow_instances>;
DEFINE FIELD template_name ON TABLE workflow_instances TYPE string ASSERT $value != NONE;
DEFINE FIELD status ON TABLE workflow_instances FLEXIBLE TYPE any ASSERT $value != NONE;
DEFINE FIELD stages ON TABLE workflow_instances FLEXIBLE TYPE array;
DEFINE FIELD current_stage_idx ON TABLE workflow_instances TYPE int DEFAULT 0;
DEFINE FIELD initial_context ON TABLE workflow_instances FLEXIBLE TYPE object;
DEFINE FIELD accumulated_artifacts ON TABLE workflow_instances FLEXIBLE TYPE object DEFAULT {};
DEFINE FIELD created_at ON TABLE workflow_instances TYPE datetime DEFAULT time::now();
DEFINE FIELD updated_at ON TABLE workflow_instances TYPE datetime DEFAULT time::now() VALUE time::now();
DEFINE INDEX idx_workflow_instances_template
ON TABLE workflow_instances COLUMNS template_name;
DEFINE INDEX idx_workflow_instances_created_at
ON TABLE workflow_instances COLUMNS created_at;