Created
August 29, 2013 11:28
-
-
Save Rokko11/6376918 to your computer and use it in GitHub Desktop.
How to add foreign key from bundle_option to cms_block
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @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