0

However when I run an upgrade script to add this column I get this Error:

Error in file: "..................sql/test123_bannerslider_setup/upgrade-0.0.1-0.0.2.php" - SQLSTATE[42000]: Syntax error or access violation: 1142 SELECT command denied to user 'devx'@'localhost' for table 'test123_bannerslider_bannerslider'";i:1;s:1259:"#0 ..................../app/code/core/Mage/Core/Model/Resource/Setup.php(644): Mage::exception('Mage_Core', 'Error in file: ...')

<?php
$table = $this;
$table->startSetup();
$table->getConnection()
    ->addColumn(
        $table->getTable('test123_bannerslider/bannerslider'),
        'topheadline',
        Varien_Db_Ddl_Table::TYPE_VARCHAR,
        255,
        array(
            'nullable' => true
        )
    );
$this->endSetup();

My file structure:

->sql
-->test123_bannerslider_setup
--->install-0.0.1.php
--->upgrade-0.0.1-0.0.2.php

Update:

SOLUTION

Finally I change my code to SQL and now it works:

<?php
$table = $this;
$table->startSetup();

$table->run("
ALTER TABLE test123_bannerslider_bannerslider
  ADD COLUMN `topheadline` VARCHAR(255) NULL;
");

$table->endSetup();

2 Answers 2

0

Check in database what name of table and add getTable('table_name')

$table->getTable('test123_bannerslider/bannerslider'), 

Or Try

    $installer = $this;

    $connection = $installer->getConnection();

    $installer->startSetup();


    // add column to sales_flat_quote_address tabe
    $connection->addColumn($this->getTable('table_name'),   'topheadline', "varchar(255) NULL");
    $installer->endSetup(); 
1
  • I do not why but finally this work: <?php $table = $this; $table->startSetup(); $table->run(" ALTER TABLE test123_bannerslider_bannerslider ADD COLUMN topheadline VARCHAR(255) NULL; "); $table->endSetup();
    – Lehtis
    Aug 25, 2017 at 8:19
0

It seems like your mysql user 'devx' has not sufffient permissioin to alter/modify the tables on current database.

Please assign sufffient permission to mysql user 'devx'.

Or

your database is full.

Thus MySQL cannot add more rows to your log tables.

Check your database size and limit. Please remove some space.

1
  • Thanks but that was not the problem
    – Lehtis
    Aug 25, 2017 at 8:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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