Magento – create new table column from installer

TO create a new table columnusing magento installer, you can use this method :

$installer = $this;
$connection = $installer->getConnection();
$installer->startSetup();
  if ($connection->tableColumnExists($this->getTable('adin/slider'), 'image_mobile') === false) {
        $installer->run("ALTER TABLE `{$installer->getTable('adin/slider')}` ADD COLUMN  `image_mobile` VARCHAR(255)  NOT NULL DEFAULT '' ;");
    }
$installer->endSetup();

Leave a Reply