PBL6-informative-system / backend /src /migrations /1730651201156-modify_payment.ts
Artteiv's picture
fix: update branch admin
9e8f9e3
import { MigrationInterface, QueryRunner } from "typeorm";
export class ModifyPayment1730651201156 implements MigrationInterface {
name = 'ModifyPayment1730651201156'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "value"`);
await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_amount" integer NOT NULL`);
await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_bank_code" character varying`);
await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_bank_tran_no" character varying`);
await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_card_type" integer NOT NULL DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_order_info" character varying`);
await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_paydate" character varying`);
await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_response_code" integer`);
await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_transaction_no" character varying`);
await queryRunner.query(`ALTER TABLE "payments" ADD "vnp_transaction_status" integer`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_transaction_status"`);
await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_transaction_no"`);
await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_response_code"`);
await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_paydate"`);
await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_order_info"`);
await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_card_type"`);
await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_bank_tran_no"`);
await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_bank_code"`);
await queryRunner.query(`ALTER TABLE "payments" DROP COLUMN "vnp_amount"`);
await queryRunner.query(`ALTER TABLE "payments" ADD "value" integer NOT NULL`);
}
}