How to add foreign key from bundle_option to cms_block
/** @var $installer Mage_Catalog_Model_Resource_Setup */ | |
$installer = $this; | |
$installer->startSetup(); | |
$installer->getConnection()->addColumn($installer->getTable('bundle/option'), 'block_id', | |
array( | |
'nullable' => true, | |
'unsigned' => true, | |
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER, | |
'comment' => 'Foreign key to Block' | |
) | |
); | |
$installer->getConnection() | |
->addForeignKey($installer->getFkName('bundle/option', 'block_id', 'cms/block', 'block_id'), $installer->getTable('bundle/option'), | |
'block_id', $installer->getTable('cms/block'), 'block_id', | |
Varien_Db_Ddl_Table::ACTION_SET_NULL, Varien_Db_Ddl_Table::ACTION_CASCADE | |
); | |
$installer->endSetup(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment