通过Magento中的安装文件更新SQL表

时间:2015-05-18 10:30:42

标签: php mysql sql database magento

我有一个magento的自定义扩展,其自定义表通过安装/设置自定义扩展文件添加到Magento SQL数据库。作品。

注意:我还使用了升级脚本技术(在其他自定义扩展中)将属性/行等添加到其他自定义扩展数据库表(在其他自定义扩展中)。请参阅下面的更新脚本中使用的代码。

changed config.xml version value to next increment

然后是更新脚本(myextension_setup / upgrade-0.0.1-0.0.2.php)

<?php

$installer = $this;
$connection = $installer->getConnection();

$installer->startSetup();

$installer->getConnection()
->addColumn($installer->getTable('mycustomtable'),
'mycustomtable_new_data',
array(
    'type' => 'text',
    'nullable' => true,
    'default' => null,
    'comment' => 'My Custom Table ID'
)
);

$installer->endSetup(); 

上面的代码可以工作,并将新的sql行添加到表中。

问题是我工作的自定义扩展已经在id(自动增量)行上最大化并导致管理员中的php错误/超时(在apache日志中)等(导致白屏死机),因为有30000 + id,我们假设将etc / module设置为false,管理员备份并运行。

管理信息中心有多个查询和监控的块。使用Mage :: getModel过滤此表格(&#39; myextension / myextension&#39;) - &gt; getCollection()

下面是将字段添加到数据库

的sql 安装脚本
`id` int(11) unsigned NOT NULL auto_increment,
  • BIGINT?

如何使用升级脚本更新此行/字段以增加允许的ID数量?或者也许我完全关闭,问题是在页面加载时不同时间访问大量数据?

0 个答案:

没有答案