import { MigrationInterface, QueryRunner } from "typeorm";

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

    public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`
            ALTER TABLE freight.payments
            ALTER COLUMN client_action TYPE jsonb
            USING client_action::jsonb;
        `);

        await queryRunner.query(`
            ALTER TABLE freight.payments
            ALTER COLUMN client_action DROP DEFAULT;
        `);
    }

    public async down(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`
            ALTER TABLE freight.payments
            ALTER COLUMN client_action TYPE json
            USING client_action::json;
        `);
    }


}
