Modify Column in Table

Posted . Visible to the public.

Change Text Length

/** @var Mage_Core_Model_Resource_Setup $installer */
$installer = $this;
$installer->startSetup();
/** @var Varien_Db_Adapter_Pdo_Mysql $connection */
$connection = $installer->getConnection();

$table = $installer->getTable('sales/order_item');
// Using modifyColumn()
$installer->getConnection()->modifyColumn($table, 'product_options', 'MEDIUMTEXT');
// Using changeColumn()
$installer->getConnection()->changeColumn(
    $table,
    'product_options',
    'product_options',
    [
        'type' =>  Varien_Db_Ddl_Table::TYPE_TEXT,
        'length' => '1M',
        'nullable'  => true,
        'default'   => null,
        'comment' => 'Product Options'
    ]
);
$installer->endSetup();
kiatng
Last edit
kiatng
Tags
Posted by kiatng to OpenMage (2020-12-17 08:27)