PBL6-informative-system / backend /src /migrations /1730865796585-AddBranchAndOrderFields.ts
Trần Viết Sơn
feat: export service
766d2fb
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddBranchAndOrderFields1730865796585 implements MigrationInterface {
name = 'AddBranchAndOrderFields1730865796585'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "feeds" ADD "delete_at" TIMESTAMP`);
await queryRunner.query(`ALTER TABLE "menu_items" ADD "delete_at" TIMESTAMP`);
await queryRunner.query(`ALTER TABLE "branches" ADD "delete_at" TIMESTAMP`);
await queryRunner.query(`ALTER TABLE "orders" ADD "note" character varying`);
await queryRunner.query(`ALTER TABLE "orders" ADD "rating" integer`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "orders" DROP COLUMN "rating"`);
await queryRunner.query(`ALTER TABLE "orders" DROP COLUMN "note"`);
await queryRunner.query(`ALTER TABLE "branches" DROP COLUMN "delete_at"`);
await queryRunner.query(`ALTER TABLE "menu_items" DROP COLUMN "delete_at"`);
await queryRunner.query(`ALTER TABLE "feeds" DROP COLUMN "delete_at"`);
}
}