Created
August 12, 2013 22:42
-
-
Save amacgregor/6216028 to your computer and use it in GitHub Desktop.
Create the Item Registry Table
This file contains hidden or 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
/** | |
* Create Registry Item Table | |
*/ | |
$tableName = $installer->getTable('mdg_giftregistry/item'); | |
// Check if the table already exists | |
if ($installer->getConnection()->isTableExists($tableName) != true) { | |
$table = $installer->getConnection() | |
->newTable($installer->getTable('mdg_giftregistry/item')) | |
->addColumn('item_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array( | |
'identity' => true, | |
'unsigned' => true, | |
'nullable' => false, | |
'primary' => true, | |
), 'Type Id') | |
->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array( | |
'nullable' => false | |
), 'Type Id') | |
->addColumn('registry_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array( | |
'nullable' => false | |
), 'Type Id') | |
->addColumn('added_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, | |
array( | |
'nullable' => false, | |
), | |
'Added At') | |
->addIndex($installer->getIdxName('mdg_giftregistry/item', array('product_id')), | |
array('product_id')) | |
->addIndex($installer->getIdxName('mdg_giftregistry/item', array('registry_id')), | |
array('registry_id')); | |
$installer->getConnection()->createTable($table); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment