I have a flat table that I would like to add a column to, and upload an image file in the admin. How would I achieve this via installer/upgrade script?
Also as a side note, does it make more sense to create a separate table for this?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
Write something like this in your upgrade script:
$installer = $this; /* @var $installer Mage_Core_Model_Resource_Setup */ $installer->startSetup(); $conn = $installer->getConnection(); $table = $installer->getTable('orderexporter/exportorders'); $conn->addColumn($table, 'exported_at', 'datetime'); $installer->endSetup();
Here orderexporter/exportorders is the factory string for my model, you would need to write one for yours. I am adding field exported_at of type date time. You could add fields of others types like text, int etc.