import { Migration } from '@mikro-orm/migrations'; export class Migration20260607131845 extends Migration { override async up(): Promise { this.addSql(`update "payment_methods" set "method" = 'CreditCard' where "method" = 'Cart';`); this.addSql(`update "payments" set "method" = 'CreditCard' where "method" = 'Cart';`); this.addSql(`alter table "payment_methods" drop constraint if exists "payment_methods_method_check";`); this.addSql(`alter table "payments" drop constraint if exists "payments_method_check";`); this.addSql(`alter table "payments" add column if not exists "attachments" jsonb null;`); this.addSql(`alter table "payment_methods" add constraint "payment_methods_method_check" check("method" in ('Online', 'Cash', 'Wallet', 'CreditCard'));`); this.addSql(`alter table "payments" add constraint "payments_method_check" check("method" in ('Online', 'Cash', 'Wallet', 'CreditCard'));`); } override async down(): Promise { this.addSql(`alter table "payment_methods" drop constraint if exists "payment_methods_method_check";`); this.addSql(`alter table "payments" drop constraint if exists "payments_method_check";`); this.addSql(`update "payment_methods" set "method" = 'Cart' where "method" = 'CreditCard';`); this.addSql(`update "payments" set "method" = 'Cart' where "method" = 'CreditCard';`); this.addSql(`alter table "payments" drop column if exists "attachments";`); this.addSql(`alter table "payment_methods" add constraint "payment_methods_method_check" check("method" in ('Online', 'Cash', 'Wallet', 'Cart'));`); this.addSql(`alter table "payments" add constraint "payments_method_check" check("method" in ('Online', 'Cash', 'Wallet', 'Cart'));`); } }