1

I have try to add new column in magento database. but its not working using mysql4-upgrade-0.1.0-0.1.1 : C:\xampp\htdocs\Surabhi\app\code\local\Surabhi\Employee\sql\employee_setup\mysql4-install-0.1.0-0.1.1.php

<?php
$installer = $this;
$installer->startSetup();
$installer->getConnection()->addColumn(
    $this->getTable('employee/employee'),//table name 

    'address',      //column name
    'varchar(255) NOT NULL'  //datatype definition
    );

$installer->endSetup();

config.xml : C:\xampp\htdocs\Surabhi\app\code\local\Surabhi\Employee\etc\config.xml

   <?xml version="1.0"?>
<config>
  <modules>
    <Surabhi_Employee>
      <version>0.1.2</version>
    </Surabhi_Employee>
  </modules>
  <global>
    <helpers>
      <employee>
        <class>Surabhi_Employee_Helper</class>
      </employee>
    </helpers>
 <blocks>
   <employee>
  <class>Surabhi_Employee_Block</class>
   </employee>
 </blocks>
 <models>
   <employee>
  <class>Surabhi_Employee_Model</class>
  <resourceModel>employee_mysql4</resourceModel>
   </employee>
   <employee_mysql4>
  <class>Surabhi_Employee_Model_Mysql4</class>
  <entities>    
     <employeedetail>
    <table>employee</table>
     </employeedetail>
        </entities>
   </employee_mysql4>
 </models>
 <resources>
   <employee_setup>
  <setup>
    <module>Surabhi_Employee</module>
  </setup>
  <connection>
    <use>core_setup</use>
  </connection>
   </employee_setup>
   <employee_write>
  <connection>
    <use>core_write</use>
  </connection>
   </employee_write>
   <employee_read>
  <connection>
    <use>core_read</use>
  </connection>
   </employee_read>
 </resources>
  </global>
  <admin>
 <routers>
   <employee>
     <use>admin</use>
  <args>
    <module>Surabhi_Employee</module>
    <frontName>admin_employee</frontName>
  </args>
   </employee>
 </routers>
  </admin>
  <adminhtml>
 <menu>
   <employee module="employee">
  <title>Employee</title>
  <sort_order>100</sort_order>
  <children>
    <employeedetail module="employee">
      <title>Manage Employeedetail</title>
   <sort_order>0</sort_order>
   <action>admin_employee/adminhtml_employeedetail</action>
    </employeedetail>
  </children>
   </employee>
 </menu>
 <acl>
   <resources>
  <all>
    <title>Allow Everything</title>
  </all>
  <admin>
    <children>
   <employee translate="title" module="employee">
     <title>Employee</title>
     <sort_order>1000</sort_order>
     <children>
    <employeedetail translate="title">
   <title>Manage Employeedetail</title>
   <sort_order>0</sort_order>
    </employeedetail>
     </children>
   </employee>
    </children>
  </admin>
   </resources>
 </acl>
 <layout>
   <updates>
  <employee>
    <file>employee.xml</file>
  </employee>
   </updates>
 </layout>
  </adminhtml>
</config>

I have used above code but not working.

1

What is the version value of this module in core_resource table?

Also try to change the version to 0.1.1 in your xml file and try.

  • version value is 0.1.0 in core resource table – Ajay Patel May 5 '16 at 3:51
  • I am already try this with xml – Ajay Patel May 5 '16 at 3:52
  • I am assuming you even tried by renaming the file to 0.1.2 – Shashidhar May 5 '16 at 11:35
1

Add below code in file mysql4-upgrade-0.1.0-0.1.1.php

<?php
$installer=$this;
$installer->startSetup();
$installer->run("
ALTER TABLE { $this->getTable('employee/employee')} ADD address varchar(255) NOT NULL");
$installer->endSetup();
?>
  • not working dude. :( – Ajay Patel May 4 '16 at 12:21
  • It is not working because you have to check core_resources table have your setup version value 0.1.1 change it to 0.1.0 and try it. – Prashant Valanda May 4 '16 at 12:23
  • i have check this solution before but not working. :( – Ajay Patel May 4 '16 at 12:23
  • its redirect like url = about:blank page – Ajay Patel May 4 '16 at 12:24
  • Go to index.php remove comment #int_set('displays_error',1); and then check what error there – Prashant Valanda May 4 '16 at 12:25

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.