0

I want to add one more column into an existing table, this is my attempt:

My upgrade-1.0.0-1.1.0.php:

 $installer = $this;
 $installer->startSetup();
 $installer->getConnection();
 $installer->getTable('paketid_booking/result');
     ->addColumn(
        'vendor_airway_bill',
        Varien_Db_Ddl_Table::TYPE_TEXT, 255,
        array(),
        'Vendor Airway Bill'
    )
$installer->endSetup();

Set version :

<modules>
    <PaketId_Booking>
        <!-- The version of our module, starting at 1.0.0 -->
        <version>1.1.0</version>
    </PaketId_Booking>
</modules>
<default>
    <paketid_booking>
        <api>
            <email>test@paket.id</email>
            <key>TEST-API-KEY</key>
            <debug>0</debug>
        </api>
    </paketid_booking>
</default>
<global>
    <blocks>
        <paketid_booking>
            <class>PaketId_Booking_Block</class>
        </paketid_booking>
    </blocks>
    <helpers>
        <paketid_booking>
            <class>PaketId_Booking_Helper</class>
        </paketid_booking>
    </helpers>

My config.xml :

    <models>
        <paketid_booking>
            <class>PaketId_Booking_Model</class>
            <resourceModel>paketid_booking_resource</resourceModel>
        </paketid_booking>        

        <paketid_booking_resource>
            <class>PaketId_Booking_Model_Resource</class>
            <entities>
                <result>
                    <table>paketid_booking_result</table>
                </result>
            </entities>
        </paketid_booking_resource>

    </models>
    <resources>
        <paketid_booking_setup>
            <setup>
                <module>PaketId_Booking</module>
            </setup>
        </paketid_booking_setup>
    </resources>
    <events>
        <checkout_type_onepage_save_order_after>
                <paketid_booking>
                    <type>singleton</type>
                    <class>PaketId_Booking_Model_Observer</class>
                    <method>processOrder</method>
                </paketid_booking>
            </observers>
        </checkout_type_onepage_save_order_after>
    </events>
</global>
<adminhtml>
    <layout>
        <updates>
            <paketid_booking>
                <file>paketid_booking.xml</file>
            </paketid_booking>
        </updates>
    </layout>
    <events>
        <core_block_abstract_to_html_after>
            <observers>
                <paketid_booking>
                    <type>singleton</type>
                    <class>PaketId_Booking_Model_Adminhtml_Observer</class>
                    <method>getSalesOrderBookingInfo</method>
                </paketid_booking>
            </observers>
        </core_block_abstract_to_html_after>
    </events>
</adminhtml>

My sql setup folder :

sql folder

What did I do wrong?

  • could you post the rest of the config.xml? – Yiorgos Moschovitis Sep 14 '16 at 3:23
  • Are you sure that you have ver. 1.0.0 installed? – Yiorgos Moschovitis Sep 14 '16 at 3:24
  • yes, i have added one table for my extension in install-1.0.0.php and now i want to upgrade it to add one column on that table. I edited my question adding the rest of config.xml @YiorgosMoschovitis – may Sep 14 '16 at 3:29
1
  1. Version may already be updated

First of all make sure that the installed version of your module is 1.0.0. Open your SQL and find the table named "core_resource". Search for your module's entry and check "version" and "data_version"

The changes you make in a module take effect the first time you access your site if the cache is disabled, or the first time you refresh your cache if it is enabled.

By the way, be sure to refresh the cache after any change.

  1. config.xml

I would suggest you made the following changes to your config.xml

<resources>
    <paketid_booking_setup>
        <setup>
            <module>PaketId_Booking</module>
        </setup>
        <connection>
           <use>core_setup</use>
        </connection>
    </paketid_booking_setup>
</resources>
  • my data version and resource version both are 1.1.0 is it suppose to be like that? or 1.0.0? – may Sep 14 '16 at 4:53
  • 1
    This is what I'm talking about. Your module version is already 1.1.0. Magento already updated the version of your module so your script will not run even if it is valid. You have to either change the value in your db and retry or change the version to 1.1.1 and the filename to upgrade-1.1.0-1.1.1.php and give it a go – Yiorgos Moschovitis Sep 14 '16 at 4:57

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.