SQL Failed to Run Successfully

When you install a WebShopApps extension in most cases it will run SQL as part of this installation.  If your frontend is displaying an error report after install it is likely either this SQL has not run successfully, or you have not copied files across correctly.
Most commonly the reasons for SQL not running are:
  1. Unique Index Too Long
  2. SQL has already been run on this server and is causing a conflict by attempting to run twice (this is very rare and only happens when database has been manually modified)
  3. The frontend was updated during installation, resulting in attempt to run SQL install/upgrade before files were present

You may see errors such as:

SQLSTATE[42S02]: Base Table Or View Not Found: 1146

Before doing anything please check:

  1. You have installed all files correctly (including Common/Logger)
  2. the report in var/report, which will give you a good indication of the problem

If you find that you have an attribute missing, or tables not found you are likely to have issue 3 above, which can be resolved by rewinding the core_resource.

Manually rewind core_resource

Take the following steps to resolve the issue. We assume here you are competent with phpmyadmin, if not then get a developer who is to assist, as doing this wrong can break your magento installation.

  1. Take full db backup
  2. Find the database table ‘core_resource’
  3. Browse the table, looking for the entry causing the issue (e.g. productmatrix_setup)
  4. Remove that entry alone
  5. Ensure cache is switched off
  6. Refresh the frontend
  7. Check to see that install script has now run and created the missing tables and attributes

Script delete/rewind core_resource

Alternatively, we have a script which allows you to delete/rewide the core_resource entry. Please note, you will need the latest WSA Common installed for the script to run successfully. It is recommended that you contact WebShopApps to get the latest version of WSA Common and that you install it onto your site before running this script.

Delete core_resource

This should only be done if its the first time you have installed this extension.

Disclaimer – Do not use this script unless you are confident that you know what you are doing. WebShopApps cannot be held responsible for the outcome.

  1. Take a full db backup
  2. Add the script file (setResource.php) to the base of your Magento install.
  3. Navigate to your base Magento url followed by ‘/setResource.php’ (eg. www.magento.com/setResource.php).
  4. Select your extension from the dropdown. If you cannot see your extension then you can add the core_resource code manually (eg. productmatrix_setup).
  5. Click on the ‘Show Current Resource Version’ button to continue.
  6. Now click on the ‘delete’ button to delete the row in core_resource that corresponds to your extension.
  7. Refresh the frontend.
  8. Ensure that the script has now run correctly – check that the attributes have been created.
  9. Remove the script file after use.

Rewind Resource

​Additionally the setResource contains a rewind script which can be used to roll back to an earlier version and will force Magento to run the upgrade script for the SQL.

Do not use this script unless you are-confident that you know what you are doing. WebShopApps cannot be held responsible for the outcome.

  1. Take a full db backup
  2. ​Add the script file (setResource.php) to the base of your Magento install
  3. ​​Navigate to your base Magento url followed by ‘/setResource.php’ (eg. www.magento.com/setResource.php)
  4. Select your extension from the dropdown. If you cannot see your extension then you can add the core_resource code manually (eg. productmatrix_setup).If you cannot see the extension in the drop down list you need to look in app/code/community/webhopapps/extension name/etc/config.xml. In this file you will want to search for resourceModel and note the first name in the middle and add and append _setup after the name. So for example <resourceModel>shipusa_resource</resourceModel> you would be shipusa_setup. You would then enter this into the other field
  5. Click on the ‘Show Current Resource Version’ button to continue
  6. Note the module version and check to see if it is set to the version before e.g current module version is 1.0.6 you would roll-back to 1.0.5
  7. Click rewind
  8. Refresh the frontend
  9. Ensure that the script has now run correctly – check that the attributes have been created
  10. Remove the script file after use

Further Help

If problems remain:

  1. Identify the actual error. If just a report number is given then go find the report from var/reports directory under you Magento installation filesystem
  2. Disable extension, further information here
  3. Contact WebShopApps Support with your order details, error report and problem seen for us to diagnose the issue

 

0 votes

Leave a Reply

Featuring WPMU Bloglist Widget by YD WordPress Developer