From 95c3f4933a365539075f266edd5f44f1c09afa94 Mon Sep 17 00:00:00 2001 From: Stevche Radevski Date: Wed, 25 Jun 2025 11:28:33 +0200 Subject: [PATCH] fix: Add missing migration for payment statuses (#12821) --- .../migrations/.snapshot-medusa-payment.json | 1 + .../src/migrations/Migration20250625084134.ts | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 packages/modules/payment/src/migrations/Migration20250625084134.ts diff --git a/packages/modules/payment/src/migrations/.snapshot-medusa-payment.json b/packages/modules/payment/src/migrations/.snapshot-medusa-payment.json index 7f6942a211..71033760b1 100644 --- a/packages/modules/payment/src/migrations/.snapshot-medusa-payment.json +++ b/packages/modules/payment/src/migrations/.snapshot-medusa-payment.json @@ -211,6 +211,7 @@ "partially_authorized", "canceled", "failed", + "partially_captured", "completed" ], "mappedType": "enum" diff --git a/packages/modules/payment/src/migrations/Migration20250625084134.ts b/packages/modules/payment/src/migrations/Migration20250625084134.ts new file mode 100644 index 0000000000..41939c1189 --- /dev/null +++ b/packages/modules/payment/src/migrations/Migration20250625084134.ts @@ -0,0 +1,17 @@ +import { Migration } from '@mikro-orm/migrations'; + +export class Migration20250625084134 extends Migration { + + override async up(): Promise { + this.addSql(`alter table if exists "payment_collection" drop constraint if exists "payment_collection_status_check";`); + + this.addSql(`alter table if exists "payment_collection" add constraint "payment_collection_status_check" check("status" in ('not_paid', 'awaiting', 'authorized', 'partially_authorized', 'canceled', 'failed', 'partially_captured', 'completed'));`); + } + + override async down(): Promise { + this.addSql(`alter table if exists "payment_collection" drop constraint if exists "payment_collection_status_check";`); + + this.addSql(`alter table if exists "payment_collection" add constraint "payment_collection_status_check" check("status" in ('not_paid', 'awaiting', 'authorized', 'partially_authorized', 'canceled', 'failed', 'completed'));`); + } + +}