Files
medusa-store/packages/modules/workflow-engine-redis/src/migrations/Migration20250128174354.ts
Carlos R. L. Rodrigues c8376a9f15 chore(medusa): clear workflow execution (#11200)
CLOSES: SUP-704
2025-02-03 10:47:32 +00:00

26 lines
698 B
TypeScript

import { Migration } from "@mikro-orm/migrations"
export class Migration20250128174354 extends Migration {
override async up(): Promise<void> {
this.addSql(
`alter table if exists "workflow_execution" add column if not exists "retention_time" integer null;`
)
this.addSql(`
UPDATE workflow_execution
SET retention_time = (
SELECT COALESCE(
(execution->'options'->>'retentionTime')::integer,
0
)
)
WHERE execution->'options' ? 'retentionTime';
`)
}
override async down(): Promise<void> {
this.addSql(
`alter table if exists "workflow_execution" drop column if exists "retention_time";`
)
}
}