I'm running zenPhoto 1.2.8. I wanted to try out a newer version, so I downloaded the latest version (I know it says that it's not completely supported to do this). I created a backup (in the zenPhoto admin console) of my database.
I updated my installation and ended up having some problems, so I backed out the changes and attempted to restore the database from the .zdb file.
I initially got some errors about failures inserting into the zp_images table because of duplicate ids. I looked in the zdb file and didn't see any duplicates. So, I dropped all of the tables in the database, and let zenPhoto recreate them.
Then I tried the restore again.
This time, there were no errors, but the restore isn't correct. Titles and tags are now associated with incorrect photos. I looked in the zdb file again and see that, for an image with incorrect title and tags, the entry in the zdb file is correct.
There appears to be an error in the restore. Is there a way to "fix" this?
Comments
So, just upgrade your "old" install as described here: `http://www.zenphoto.org/news/installation-and-upgrading#2`
and post any problems you encounter.
For this to work you first have to install 1.2.8 again and use the database backup you made to get the database the way it was.
Then proceed as above.
I think what's happening is as follows:
The zp_images table is defined with id as unique and autoincrement. When the restore first happened, the table was emptied, but the mysql index counter was never reset, so the inserts failed because it thought that those IDs were already in use.
So, I dropped the tables to get around this. Now, I'm wondering how mysql is handling each insert. I'm guessing that it's ignoring the id on the insert and assigning it's own unique id.
What I'm trying now is having zenphoto create the tables, then removing the auto-increment from the zp_images table before doing the restore.
Using ZenPhoto 1.2.8, I created a backup of my database. Everything was in there.
Using ZenPhoto 1.2.3, the database restore didn't work for my backup file for whatever reason. (Titles weren't properly associated with images and tags weren't associated witht he correct images).
I created a utility to parse the backup file and create mysql .sql files to restore the information.
When I did that, my database appears to be back to where it was before I started this whole fiasco. (Titles and tags are fixed).
What I gather from this is I'll never use the zen photo database backup/restore before attempting upgrades. I will use mysql to do that.
For the ZenPhoto developers out there, I have over 18,000 images on my site and over 21,000 entries in my obj_to_tag database.
I'm not sure if those large numbers caused problems for you backup/restore utility or not.
Here's what I did.
1. Running 1.2.8, created a backup.
2. Upgraded to 1.4.2. Encountered a few problems (I'm going to create a test install to see if I can weed these out).
3. Reverted to 1.2.8 and attempted to restore the database backup. That's when I had all of my problems.
1. Backup the database from your old 1.2.8 install
2. Install a new 2nd 1.2.8 in the new place
3. Import the data from the old 1.2.8 to the new 1.2.8
4. Upgrade the new 1.2.8 to 1.4.2.x
If 4. does not work for some reason you should try to upgrade step by step. (Note we consider 1.x.x versions "medium major" releases.)
I dropped all of the tables in the database.
I created an entirely new database.
Each time I ran through the zenphoto setup (1.2.8).
It created the tables, then I selected "Restore" from the next page (rather than set up admin account).