Files
medusa-store/packages/modules/workflow-engine-redis/src/models/workflow-execution.ts
Adrien de Peretti 0a077d48e1 chore(workflow-engine): Migrate to DML (#10477)
RESOLVES FRMW-2832
RESOLVES FRMW-2833

**What**
Migrate workflow engines to DML. Alos includes and update to the linkable generation which now takes into account id and primary keys to generate the linkable instead of only primary keys
2024-12-06 13:23:07 +00:00

31 lines
755 B
TypeScript

import { TransactionState } from "@medusajs/framework/orchestration"
import { model } from "@medusajs/framework/utils"
export const WorkflowExecution = model
.define("workflow_execution", {
id: model.id({ prefix: "wf_exec" }),
workflow_id: model.text().primaryKey(),
transaction_id: model.text().primaryKey(),
execution: model.json().nullable(),
context: model.json().nullable(),
state: model.enum(TransactionState),
})
.indexes([
{
on: ["id"],
where: "deleted_at IS NULL",
},
{
on: ["workflow_id"],
where: "deleted_at IS NULL",
},
{
on: ["transaction_id"],
where: "deleted_at IS NULL",
},
{
on: ["state"],
where: "deleted_at IS NULL",
},
])