import { MigrationInterface, QueryRunner } from "typeorm";

export class ExtendPaymentMethodEnum1782000000002 implements MigrationInterface {
    name = "ExtendPaymentMethodEnum1782000000002";

    public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`ALTER TYPE freight.payments_method_enum ADD VALUE IF NOT EXISTS 'waafi';`);
        await queryRunner.query(`ALTER TYPE freight.payments_method_enum ADD VALUE IF NOT EXISTS 'card';`);
        await queryRunner.query(`ALTER TYPE freight.payments_method_enum ADD VALUE IF NOT EXISTS 'dmoney';`);
    }

    public async down(_queryRunner: QueryRunner): Promise<void> {
        // PostgreSQL does not support removing enum values directly.
        // To roll back, recreate the type without the added values and update the column.
    }
}
