import { MigrationInterface, QueryRunner } from 'typeorm';

export class ChangeColumnName1726830293878 implements MigrationInterface {
  name = 'ChangeColumnName1726830293878';

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `ALTER TABLE "transaction_items" RENAME COLUMN "subtotal" TO "total_net_price"`,
    );
    await queryRunner.query(
      `ALTER TABLE "transaction_item_breakdowns" RENAME COLUMN "subtotal" TO "total_net_price"`,
    );
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `ALTER TABLE "transaction_item_breakdowns" RENAME COLUMN "total_net_price" TO "subtotal"`,
    );
    await queryRunner.query(
      `ALTER TABLE "transaction_items" RENAME COLUMN "total_net_price" TO "subtotal"`,
    );
  }
}
