AnhLedger commited on
Commit
424873f
·
1 Parent(s): e1abcaf

modify payment migration

Browse files
backend/src/migrations/1730650476355-modify_payment.ts DELETED
@@ -1,40 +0,0 @@
1
- import { MigrationInterface, QueryRunner } from "typeorm";
2
-
3
- export class ModifyPayment1730650476355 implements MigrationInterface {
4
- name = 'ModifyPayment1730650476355'
5
-
6
- public async up(queryRunner: QueryRunner): Promise<void> {
7
- await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_securehash"`);
8
- await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "payment_method"`);
9
- await queryRunner.query(`DROP TYPE "public"."payments_payment_method_enum"`);
10
- await queryRunner.query(`ALTER TABLE "payments" ADD "payment_method" integer NOT NULL DEFAULT '0'`);
11
- await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_bank_code" DROP NOT NULL`);
12
- await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_bank_tran_no" DROP NOT NULL`);
13
- await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_card_type"`);
14
- await queryRunner.query(`DROP TYPE "public"."payments_vnp_card_type_enum"`);
15
- await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_card_type" integer NOT NULL DEFAULT '0'`);
16
- await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_order_info" DROP NOT NULL`);
17
- await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_paydate" DROP NOT NULL`);
18
- await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_response_code" DROP NOT NULL`);
19
- await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_transaction_no" DROP NOT NULL`);
20
- await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_transaction_status" DROP NOT NULL`);
21
- }
22
-
23
- public async down(queryRunner: QueryRunner): Promise<void> {
24
- await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_transaction_status" SET NOT NULL`);
25
- await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_transaction_no" SET NOT NULL`);
26
- await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_response_code" SET NOT NULL`);
27
- await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_paydate" SET NOT NULL`);
28
- await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_order_info" SET NOT NULL`);
29
- await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_card_type"`);
30
- await queryRunner.query(`CREATE TYPE "public"."payments_vnp_card_type_enum" AS ENUM('0', '1', '2')`);
31
- await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_card_type" "public"."payments_vnp_card_type_enum" NOT NULL DEFAULT '0'`);
32
- await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_bank_tran_no" SET NOT NULL`);
33
- await queryRunner.query(`ALTER TABLE "payments" ALTER COLUMN "vnp_bank_code" SET NOT NULL`);
34
- await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "payment_method"`);
35
- await queryRunner.query(`CREATE TYPE "public"."payments_payment_method_enum" AS ENUM('0', '1', '2')`);
36
- await queryRunner.query(`ALTER TABLE "payments" ADD "payment_method" "public"."payments_payment_method_enum" NOT NULL DEFAULT '0'`);
37
- await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_securehash" character varying NOT NULL`);
38
- }
39
-
40
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
backend/src/migrations/1730651201156-modify_payment.ts ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class ModifyPayment1730651201156 implements MigrationInterface {
4
+ name = 'ModifyPayment1730651201156'
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "value"`);
8
+ await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_amount" integer NOT NULL`);
9
+ await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_bank_code" character varying`);
10
+ await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_bank_tran_no" character varying`);
11
+ await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_card_type" integer NOT NULL DEFAULT '0'`);
12
+ await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_order_info" character varying`);
13
+ await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_paydate" character varying`);
14
+ await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_response_code" integer`);
15
+ await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_transaction_no" character varying`);
16
+ await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_transaction_status" integer`);
17
+ }
18
+
19
+ public async down(queryRunner: QueryRunner): Promise<void> {
20
+ await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_transaction_status"`);
21
+ await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_transaction_no"`);
22
+ await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_response_code"`);
23
+ await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_paydate"`);
24
+ await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_order_info"`);
25
+ await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_card_type"`);
26
+ await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_bank_tran_no"`);
27
+ await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_bank_code"`);
28
+ await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_amount"`);
29
+ await queryRunner.query(`ALTER TABLE "payments" ADD "value" integer NOT NULL`);
30
+ }
31
+
32
+ }