bmc_hub/migrations/1066_workflow_exports.sql

10 lines
570 B
MySQL
Raw Normal View History

-- Workflow-generated drafts get one persistent external export identity.
CREATE TABLE IF NOT EXISTS bmc_workflow_exports (
draft_id INTEGER PRIMARY KEY REFERENCES ordre_drafts(id),
reference TEXT NOT NULL UNIQUE DEFAULT gen_random_uuid()::text,
status TEXT NOT NULL DEFAULT 'pending' CHECK(status IN ('pending','sending','uncertain','done')),
request JSONB NOT NULL DEFAULT '{}',result JSONB,error TEXT,
created_by INTEGER,created_at TIMESTAMPTZ NOT NULL DEFAULT now(),updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
CHECK(status!='done' OR result IS NOT NULL)
);