How to Manually Run SQL install files

Manually Running SQL Scripts

On rare occasions it may be necessary to manually run SQL scripts however there is a bit of code manipulation needed in order for the scripts to run.

You may be faced with a situation whereby you have accidentally deleted an extension table or some sql was partially run during an install of an extension and determined that manually running the sql for the missing tables would be the best step forward to complete your installation or resolve the issue. This guideline outlines how to go about manually running SQL scripts.

Be careful when following the actions below to manually run sql for the extension as this may result in your site crashing if the SQL cannot be run successfully. I recommend you understand what the SQL is doing before you invoke it.

To look at the SQL, locate it in the SQL folder under the extension directory. There will be an install.sql file. The version number used can be found in etc/config.xml in the extension folder. To run the SQL manually you will need to replace variables with real table names.

As an example if you wish to manually run sql to create a table that looks like the illustration below:


You need to remove any PHP syntax as this will halt the SQL scripts from running i.e {$this->getTable('webshopapps_shipmethods_carriers')} should now look like this webshopapps_shipmethods_carriers.

The following image shows an example of how the script should look like after removing the PHP syntax:


Once satisfied that you have correctly formatted your sql, you can then run it against your database.

Please note that no liability can be accepted for misuse of the information above. Please be aware this could cause problems if you do not fully understand what you are doing. If in any doubt we highly recommend you contact WebShopApps to do this for you. There is a consultancy charge for such work as it outside the scope of extension sales.

0 votes

Featuring WPMU Bloglist Widget by YD WordPress Developer