"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WidenTransactionAddressColumns1786862214000 = void 0;
const typeorm_1 = require("typeorm");
class WidenTransactionAddressColumns1786862214000 {
    async up(queryRunner) {
        const table = await queryRunner.getTable('transactions');
        if (!table) {
            return;
        }
        const fromColumn = table.findColumnByName('from_address_id');
        const toColumn = table.findColumnByName('to_address_id');
        if (!fromColumn || fromColumn.length !== '36') {
            return;
        }
        await queryRunner.changeColumn('transactions', 'from_address_id', new typeorm_1.TableColumn({
            name: 'from_address_id',
            type: 'varchar',
            length: '255',
            isNullable: true,
        }));
        if (toColumn && toColumn.length === '36') {
            await queryRunner.changeColumn('transactions', 'to_address_id', new typeorm_1.TableColumn({
                name: 'to_address_id',
                type: 'varchar',
                length: '255',
                isNullable: true,
            }));
        }
    }
    async down(queryRunner) {
        const table = await queryRunner.getTable('transactions');
        if (!table) {
            return;
        }
        const fromColumn = table.findColumnByName('from_address_id');
        const toColumn = table.findColumnByName('to_address_id');
        if (!fromColumn || fromColumn.length !== '255') {
            return;
        }
        await queryRunner.changeColumn('transactions', 'from_address_id', new typeorm_1.TableColumn({
            name: 'from_address_id',
            type: 'varchar',
            length: '36',
            isNullable: true,
        }));
        if (toColumn && toColumn.length === '255') {
            await queryRunner.changeColumn('transactions', 'to_address_id', new typeorm_1.TableColumn({
                name: 'to_address_id',
                type: 'varchar',
                length: '36',
                isNullable: true,
            }));
        }
    }
}
exports.WidenTransactionAddressColumns1786862214000 = WidenTransactionAddressColumns1786862214000;
//# sourceMappingURL=1786862214000-WidenTransactionAddressColumns.js.map