add credit card payment method
deploy to danak / build_and_deploy (push) Has been cancelled

This commit is contained in:
2026-06-07 16:56:55 +03:30
parent caaeb0d34a
commit 89fa1d637e
14 changed files with 155 additions and 9 deletions
+23 -2
View File
@@ -1076,7 +1076,8 @@
"enumItems": [
"Online",
"Cash",
"Wallet"
"Wallet",
"CreditCard"
],
"mappedType": "enum"
},
@@ -1102,6 +1103,16 @@
"length": 255,
"mappedType": "string"
},
"card_number": {
"name": "card_number",
"type": "varchar(255)",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": true,
"length": 255,
"mappedType": "string"
},
"enabled": {
"name": "enabled",
"type": "boolean",
@@ -4523,7 +4534,8 @@
"enumItems": [
"Online",
"Cash",
"Wallet"
"Wallet",
"CreditCard"
],
"mappedType": "enum"
},
@@ -4612,6 +4624,15 @@
"nullable": true,
"length": 255,
"mappedType": "string"
},
"attachments": {
"name": "attachments",
"type": "jsonb",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": true,
"mappedType": "json"
}
},
"name": "payments",
+11 -2
View File
@@ -1077,7 +1077,7 @@
"Online",
"Cash",
"Wallet",
"Cart"
"CreditCard"
],
"mappedType": "enum"
},
@@ -4535,7 +4535,7 @@
"Online",
"Cash",
"Wallet",
"Cart"
"CreditCard"
],
"mappedType": "enum"
},
@@ -4624,6 +4624,15 @@
"nullable": true,
"length": 255,
"mappedType": "string"
},
"attachments": {
"name": "attachments",
"type": "jsonb",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": true,
"mappedType": "json"
}
},
"name": "payments",
@@ -0,0 +1,31 @@
import { Migration } from '@mikro-orm/migrations';
export class Migration20260607131845 extends Migration {
override async up(): Promise<void> {
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<void> {
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'));`);
}
}