"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AddExplorerAndRemoveNetworkRpc1722470000000 = void 0;
const typeorm_1 = require("typeorm");
class AddExplorerAndRemoveNetworkRpc1722470000000 {
    async up(queryRunner) {
        const table = await queryRunner.getTable('networks');
        if (!table) {
            return;
        }
        if (table.findColumnByName('rpc')) {
            await queryRunner.dropColumn('networks', 'rpc');
        }
        if (table.findColumnByName('api_keys')) {
            await queryRunner.dropColumn('networks', 'api_keys');
        }
        if (!table.findColumnByName('explorer')) {
            await queryRunner.addColumn('networks', new typeorm_1.TableColumn({
                name: 'explorer',
                type: 'varchar',
                length: '512',
                isNullable: false,
                default: "''",
            }));
        }
    }
    async down(queryRunner) {
        const table = await queryRunner.getTable('networks');
        if (!table) {
            return;
        }
        if (table.findColumnByName('explorer')) {
            await queryRunner.dropColumn('networks', 'explorer');
        }
        if (!table.findColumnByName('rpc')) {
            await queryRunner.addColumn('networks', new typeorm_1.TableColumn({ name: 'rpc', type: 'varchar', length: '255' }));
        }
        if (!table.findColumnByName('api_keys')) {
            await queryRunner.addColumn('networks', new typeorm_1.TableColumn({ name: 'api_keys', type: 'json', isNullable: true }));
        }
    }
}
exports.AddExplorerAndRemoveNetworkRpc1722470000000 = AddExplorerAndRemoveNetworkRpc1722470000000;
//# sourceMappingURL=1722470000000-AddExplorerAndRemoveNetworkRpc.js.map