1 import { Migration } from "@medusajs/framework/mikro-orm/migrations";
2
3 export class Migration20250115160517 extends Migration {
4
5 async up(): Promise<void> {
6 this.addSql('drop index if exists "IDX_payment_collection_region_id";');
7 this.addSql('alter table if exists "payment_collection" drop column if exists "region_id";');
8
9 this.addSql('alter table if exists "payment" drop column if exists "cart_id";');
10 this.addSql('alter table if exists "payment" drop column if exists "order_id";');
11 this.addSql('alter table if exists "payment" drop column if exists "customer_id";');
12 }
13
14 async down(): Promise<void> {
15 this.addSql('alter table if exists "payment_collection" add column if not exists "region_id" text not null;');
16 this.addSql('CREATE INDEX IF NOT EXISTS "IDX_payment_collection_region_id" ON "payment_collection" (region_id) WHERE deleted_at IS NULL;');
17
18 this.addSql('alter table if exists "payment" add column if not exists "cart_id" text null, add column if not exists "order_id" text null, add column if not exists "customer_id" text null;');
19 }
20
21 }