PageRenderTime 66ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/magento/app/code/core/Mage/Sendfriend/sql/sendfriend_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php

https://bitbucket.org/jit_bec/shopifine
PHP | 104 lines | 61 code | 9 blank | 34 comment | 0 complexity | c8edba004d11496554d4626df203e63e MD5 | raw file
Possible License(s): LGPL-3.0
  1. <?php
  2. /**
  3. * Magento
  4. *
  5. * NOTICE OF LICENSE
  6. *
  7. * This source file is subject to the Open Software License (OSL 3.0)
  8. * that is bundled with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://opensource.org/licenses/osl-3.0.php
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@magentocommerce.com so we can send you a copy immediately.
  14. *
  15. * DISCLAIMER
  16. *
  17. * Do not edit or add to this file if you wish to upgrade Magento to newer
  18. * versions in the future. If you wish to customize Magento for your
  19. * needs please refer to http://www.magentocommerce.com for more information.
  20. *
  21. * @category Mage
  22. * @package Mage_Sendfriend
  23. * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
  24. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  25. */
  26. /* @var $installer Mage_Sendfriend_Model_Resource_Setup */
  27. $installer = $this;
  28. $installer->startSetup();
  29. /**
  30. * Drop indexes
  31. */
  32. $installer->getConnection()->dropIndex(
  33. $installer->getTable('sendfriend/sendfriend'),
  34. 'IDX_REMOTE_ADDR'
  35. );
  36. $installer->getConnection()->dropIndex(
  37. $installer->getTable('sendfriend/sendfriend'),
  38. 'IDX_LOG_TIME'
  39. );
  40. /**
  41. * Change columns
  42. */
  43. $tables = array(
  44. $installer->getTable('sendfriend/sendfriend') => array(
  45. 'columns' => array(
  46. 'log_id' => array(
  47. 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
  48. 'identity' => true,
  49. 'unsigned' => true,
  50. 'nullable' => false,
  51. 'primary' => true,
  52. 'comment' => 'Log ID'
  53. ),
  54. 'ip' => array(
  55. 'type' => Varien_Db_Ddl_Table::TYPE_BIGINT,
  56. 'length' => 20,
  57. 'unsigned' => true,
  58. 'nullable' => false,
  59. 'default' => '0',
  60. 'comment' => 'Customer IP address'
  61. ),
  62. 'time' => array(
  63. 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
  64. 'unsigned' => true,
  65. 'nullable' => false,
  66. 'default' => '0',
  67. 'comment' => 'Log time'
  68. ),
  69. 'website_id' => array(
  70. 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
  71. 'unsigned' => true,
  72. 'nullable' => false,
  73. 'default' => '0',
  74. 'comment' => 'Website ID'
  75. )
  76. ),
  77. 'comment' => 'Send to friend function log storage table',
  78. 'engine' => 'InnoDB'
  79. )
  80. );
  81. $installer->getConnection()->modifyTables($tables);
  82. /**
  83. * Add indexes
  84. */
  85. $installer->getConnection()->addIndex(
  86. $installer->getTable('sendfriend/sendfriend'),
  87. $installer->getIdxName('sendfriend/sendfriend', array('ip')),
  88. array('ip')
  89. );
  90. $installer->getConnection()->addIndex(
  91. $installer->getTable('sendfriend/sendfriend'),
  92. $installer->getIdxName('sendfriend/sendfriend', array('time')),
  93. array('time')
  94. );
  95. $installer->endSetup();