0

I have create an extension ,which has a sql Installer,When i am trying to run that extension,the installer show Error

`a:5:{i:0;s:329:"Error in file: "/home/wwww/uat/app/code/local/Amit/Myoptimization/sql/myoptimization_setup/install-1.0.0.php"` - 

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1";i:1;s:925:"#0 /home/seventy/www/uat/app/code/core/Mage/Core/Model/Resource/Setup.php(645): Mage::exception('Mage_Core', 'Error in file: ...')
#1 /home/www/uat/app/code/core/Mage/Core/Model/Resource/Setup.php(421): Mage_Core_Model_Resource_Setup->_modifyResourceDb('install', '', '1.0.0')

Here the details of extension....

Amit>Myoptimization>etc>Config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Amit_Myoptimization>
            <version>1.0.0</version>
        </Amit_Myoptimization>
    </modules>

    <global>
        <resources>
            <myoptimization_setup>
                <setup>
                    <module>Amit_Myoptimization</module>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </myoptimization_setup>
            <myoptimization_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </myoptimization_read>
            <myoptimization_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </myoptimization_write>
        </resources>
    </global>
    <global>
        <models>
            <myoptimization>
                <class>Amit_Myoptimization_Model</class>
            </myoptimization>
        </models>
        <blocks>
            <myoptimization>
                <class>Amit_Myoptimization_Block</class>
            </myoptimization>
        </blocks>
    </global>
    <!-- start of rewrite class -->
    <global>
        <models>
            <catalog>
                <rewrite>
                    <product>Amit_Myoptimization_Model_Catalog_Product</product>
                </rewrite>
            </catalog>
        </models>
    </global>
</config>

SQL Installer: local\Amit\Myoptimization\sql\myoptimization_setup\install-1.0.0.php

<?php
installer=$this;
$installer->startSetup();
$installer->run("ALTER TABLE my_ibanner_banner ADD INDEX  banner_id");
$installer->run("ALTER TABLE colorswatches ADD INDEX option_id");
$installer->run("ALTER TABLE colorswatches ADD INDEX colorswatches_id ");
$installer->run("ALTER TABLE color_relationship_product  ADD INDEX color_relationship_product");
$installer->endSetup();

Module File: XMl File:

app/etc/modules/Amit_Myoptimization.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Amit_Myoptimization>
            <codePool>local</codePool>
            <active>true</active>
        </Amitt_Myoptimization>
    </modules>
</config>

Can any one tell me ,what are the issue??

1
  • Did you actually solve your problem? If so, please add your solution and accept it to mark this question as resolved. Commented Nov 8, 2014 at 2:08

1 Answer 1

1

It looks like your have a typo in your setup script. On the first line your are missing a $. The script should look as follows.

<?php
$installer=$this;
$installer->startSetup();
$installer->run("ALTER TABLE my_ibanner_banner ADD INDEX  banner_id");
$installer->run("ALTER TABLE colorswatches ADD INDEX option_id");
$installer->run("ALTER TABLE colorswatches ADD INDEX colorswatches_id ");
$installer->run("ALTER TABLE color_relationship_product  ADD INDEX color_relationship_product");
$installer->endSetup();
0

Your Answer

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

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