Skip to content

Instantly share code, notes, and snippets.

@amacgregor
Created August 12, 2013 22:42
Show Gist options
  • Save amacgregor/6216028 to your computer and use it in GitHub Desktop.
Save amacgregor/6216028 to your computer and use it in GitHub Desktop.
Create the Item Registry Table
/**
* 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