app/code/community/MKleine/LanguageRoutes/sql/languageroutes_setup/mysql4-install-0.1.0.php
<?php
/**
* Copyright (c) 2014 Matthias Kleine
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@mkleine.de so we can send you a copy immediately.
*
* @category MKleine
* @package MKleine_LanguageRoutes
* @copyright Copyright (c) 2014 Matthias Kleine (http://mkleine.de)
* @license http://opensource.org/licenses/MIT MIT
*/
/* @var $installer Mage_Customer_Model_Resource_Setup */
$installer = $this;
$installer->startSetup();
/**
* Create table 'customer/entity'
*/
$table = $installer->getConnection()
->newTable($installer->getTable('mk_languageroutes/languageroute'))
->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
'identity' => true,
'unsigned' => true,
'nullable' => false,
'primary' => true,
), 'Entity Id')
->addColumn('type_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
'unsigned' => true,
'nullable' => false,
), 'Type Id')
->addColumn('value', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
'nullable' => false,
), 'Value')
->addColumn('translation', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
'nullable' => false,
), 'Translation')
->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
'unsigned' => true,
'default' => '0',
), 'Store Id')
->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
'nullable' => false,
), 'Created At')
->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
'nullable' => false,
), 'Updated At')
->addColumn('is_active', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
'unsigned' => true,
'nullable' => false,
'default' => '1',
), 'Is Active')
->addIndex($installer->getIdxName('mk_languageroutes/languageroute', array('store_id')),
array('store_id'))
->addIndex($installer->getIdxName('mk_languageroutes/languageroute', array('store_id', 'type_id', 'value'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE),
array('store_id', 'type_id', 'value'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE))
->addIndex($installer->getIdxName('mk_languageroutes/languageroute', array('store_id', 'type_id', 'translation'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE),
array('store_id', 'type_id', 'translation'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE))
->addForeignKey($installer->getFkName('mk_languageroutes/languageroute', 'store_id', 'core/store', 'store_id'),
'store_id', $installer->getTable('core/store'), 'store_id',
Varien_Db_Ddl_Table::ACTION_SET_NULL, Varien_Db_Ddl_Table::ACTION_CASCADE)
->setComment('Languageroute Entity');
$installer->getConnection()->createTable($table);
$installer->endSetup();