Magento – mysql PHP scripts can run again

Should it happen, that create an extension of a database table or not there are several, where they should be, you would have to let the script run again, which writes the necessary data.

Often these are in the folder app / code /[community oder local]/[Extensionprogrammierer]/[Extensionname]/sql/[extension]_setup and have such names such as mysql4-install-0.1.0.php oder mysql4-upgrade-0.1.0-0.1.1.php

To run the script again, and so to get tables, kann man conductor re-o.g. Just copy files over or disable the extension and then re-enable. The installation process is not restarted.

To achieve this there is a simple trick: In the database core_resource open the table and look for the corresponding extension. The name of the extension (“x-y-extension_setup”) then there are two numbers. This is the version information. An installation is only carried out, if the version specified here is lower than that in the extension.

There are now three ways so the extension to install the “old” Table(n) bring:

1. The entry of the “x-y-extension_setup” completely erase
2. It is safer to rename the entry e.g.. in “x-y-extension_setup_bak”
3. To set the version number down

The possibility of the extension version in the files to set up I let out deliberately, since then future updates possibly. do not work.

I chose to step 2 and then-after the installation went well and the new record was available (and the table)- Step 1 decided. So renamed first, so you can rename back if in doubt again, and after everything has worked, deleted and renamed the old line.

Used in Magento Version 1.7. Ask, Comments, Proposals? Us directly or as a comment.

Published by Covos

Since 2009 I have been working intensively with Magento. I started with the creation and operation of B2C stores. This was extended through my work in the logistics sector. This resulted first specialized B2E systems. Today I work day-a day with exciting B2C, B2B- and B2E projects and reports in this blog about challenges and give insider tips.

Leave a Reply

Your email address will not be published. Required fields are marked *