Raw
1 import { Migration } from "@medusajs/framework/mikro-orm/migrations"
2
3 export class Migration20240827133639 extends Migration {
4 async up(): Promise<void> {
5 this.addSql(
6 'alter table if exists "return_item" add column if not exists "damaged_quantity" numeric not null default 0, add column if not exists "raw_damaged_quantity" jsonb;'
7 )
8
9 this.addSql(
10 `UPDATE "return_item" SET raw_damaged_quantity = '{"value": "0", "precision": 20}'::jsonb;`
11 )
12
13 this.addSql(
14 'ALTER TABLE IF EXISTS "return_item" ALTER COLUMN "raw_damaged_quantity" SET NOT NULL;'
15 )
16 }
17
18 async down(): Promise<void> {
19 this.addSql(
20 'alter table if exists "return_item" drop column if exists "damaged_quantity";'
21 )
22 this.addSql(
23 'alter table if exists "return_item" drop column if exists "raw_damaged_quantity";'
24 )
25 }
26 }