1 import { Migration } from "@medusajs/framework/mikro-orm/migrations"
2
3 export class Migration20250128174331 extends Migration {
4 override async up(): Promise<void> {
5 this.addSql(
6 `alter table if exists "workflow_execution" add column if not exists "retention_time" integer null;`
7 )
8 this.addSql(`
9 UPDATE workflow_execution
10 SET retention_time = (
11 SELECT COALESCE(
12 (execution->'options'->>'retentionTime')::integer,
13 0
14 )
15 )
16 WHERE execution->'options' ? 'retentionTime';
17 `)
18 }
19
20 override async down(): Promise<void> {
21 this.addSql(
22 `alter table if exists "workflow_execution" drop column if exists "retention_time";`
23 )
24 }
25 }