0

I have a custom module that I need to update adding a couple of columns in one of the tables. The task is very easy but for some reason Magento is adding a prefix on my table name. Let me show you.

My upgrade script is as follows:

$installer = $this;
$installer->startSetup();
$installer->getConnection()->addColumn(
$installer->getTable('invent_feedbanners/imagen'), 'inicia', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
    ), 'Inicia');

$installer->getConnection()->addColumn(
$installer->getTable('invent_feedbanners/imagen'), 'termina', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
    ), 'Termina');
$installer->endSetup();

When the upgrade runs Magento reports an error like this: - SQLSTATE[42S02]: Base table or view not found: 1146 Table '255.invent_feedbanners_imagen' doesn't exist"

The name of the table is invent_feedbanners_imagen. Where does the 255 name comes from??. My installation doesnt have any prefix.

This has been breaking my head for the last 5 hours. I'm stuck on this. If somebody could help me I will appreciate it alot.

Kind Regards!

  • can you paste the config.xml of your module? – Fabian Schmengler Feb 18 '15 at 10:17
  • I think '255' is your magento DB name!!!! – SIBHI S Feb 18 '15 at 11:09
1

I have no clue why you do this, but the method addColumn accepts other parameters:

public function addColumn($tableName, $columnName, $definition, $schemaName = null);

Therefore it should be:

$installer->getConnection()->addColumn(
    $installer->getTable('invent_feedbanners/imagen'),
    'termina',
    array(
        'type' => Varien_Db_Ddl_Table::TYPE_DATETIME,
        'comment' => 'Termina'
    ),
);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.