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'));`); + } + +}