I’ve just been dealing with a task to upgrade a Magento 1.4.0.1 site to Magento 1.4.1.1. I was supplied the site files and a database dump. All this installed fine and the updater ran without a hitch. However, upon return to the Magento admin, I received the dreaded “There has been an error processing your request” page. Looking at the error report, I saw:
Base table or view already exists: 1050 Table ‘sales_flat_order’ already exists
After some investigating, it transpired that an upgrade had been previously attempted but failed, so the roll back replaced the files and re-loaded the original, pre-upgrade database but of course any new tables created by the upgrade scripts have remained as the import only dropped and re-created the ones in the sql script.
The lesson here is to drop the database completely, create it again and then re-import the backup to restore the exact original state.
Originally published on magebase.com. Copyright © 2010 Magebase - All Rights Reserved.




Proud members of the 









Wow … that was a nasty trick
Tried to do this, but I’m afraid your description isn’t clear enough for me.
First, backuped homedirectory and database ofcourse.
Then I deleted the database and created a new empty one (same name, no tables).
Tried to do the upgrade, but couldn’t do this (I assume there are some tables needed).
Second try:
Deleted the database, created new on (same name, no tables).
Then started import the backup with phpmyadmin, no problem.
Tried to update, but the same problem (ofcourse: sales_flat_order was also imported).
I assume I have to create a database with tables, but no data?
Then update, then import old backup database?
If so, how do I create such a database?
Thanx
@Jan Timens
The point in my post was that you will need a full backup of your datbase BEFORE any kind of upgrade attempt had been made (in other words, before the upgrade script created the sales_flat_* and other tables). If you tried an upgrade, failed, THEN took a backup, the backup will contain the extra tables created after the unsuccessful upgrade, so the procedure from this article won’t help you – as seems to be the case with your situation.
You always need the full Magento database with tables AND data to perform an upgrade so there is no recipe to create a database with just tables.
Not sure what you can do now. If you don’t have a backup of your database prior to the sales_flat_* tables then you could try to drop them manually by comparing a database from a Magento 1.4.1.1 install with yours (assuming you are upgrading to 1.4.1.1).
If you’re not too far into your project and are just upgrading a fresh install, maybe it’s easier to install M1.4.1.1 and add your theme and extensions, effectively starting from a fresh install.