Restore from Backup

7 posts by 3 authors in: Forums > CMS Builder
Last Post: December 1, 2022   (RSS)

I want to make sure of something before I restore a new install db from backups from old site.

I have tables on my new install that contain fields that didn't exist in the old database tables. The tables are in other ways unchanged.

I wish to make sure that if I "restore" those tables from backups from the old site, my new table fields will not ne deleted, but just the old data imported into their appropriate fields.

Thanks.

By gkornbluth - November 14, 2022 - edited: November 14, 2022

Hi pgplast,

Before you upgrade, make a backup of the entire old database and then the entire old cmsAdmin folder. (make sure you can tell which backups are the latest, because dates get overwritten when files are transferred.) 

That way you always have all files in their original form.

You may have to upload some of the new schema files to see the new fields in the sections, but again, if any issues arise you always have the old backup available.

Remember, its a bit more work, but you can always do a completely new parallel install in a new folder on your server and not delete the old installation until you've squashed any errors and you're happy with the result.

There's some more detailed information in my CMSB Cookbook in the recipes MOVE A CMSB SITE FROM ONE SERVER TO ANOTHER WITHOUT FEAR and IMAGES WON’T SHOW AFTER MIGRATING TO A NEW SERVER - THE FIX IS IN 

Hope that helps,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By Dave - November 14, 2022

Hi pgblast, 

If you restore a backup file on a site with a different table structure it will overwrite all the data and remove any new columns you created, but then when you click on "Section Editors" it will recreate any fields that exist in CMSB but not in the backup files.  But not the data.

It's always a bit tricky when your source and destination backup/restore targets are out of sync.  To be extra careful I'd make sure you have backups of both the old and new sites before making any changes.  

If you can let me know some more specific details on what you're trying to do and I can offer some suggestions if needed.

Dave Edis - Senior Developer
interactivetools.com

Hi Dave:

Any followup thoughts on this issue?

Thanks

pgplast

By Dave - November 17, 2022

Hi pgplast,

I think it will do what you want, but best way to tell is to backup everything on both sides and then give it a try.

CMSB stores the section field "settings" (fieldnames, types, etc) under /data/schema/ and the field "data" in the MySQL backup files.

Here's what will happen if you restore a mismatched backup file and /data/schema/ folder:

  • The backup file will delete any tables it's restoring and recreate them, so any "data" in the tables will be lost
  • The backup file will recreate all the fields and data, whether or not the /schema/ files match it
  • Then, when you go into: Admin > Section Editors...
    • CMSB will check the schema files and automatically "create" any fields that are defined in the /schema/ files but not in the database
    • Any fields in the SQL backup but not in the schema will NOT be deleted, but shown as "Unknown Field" 
    • You can then click "create" beside those unknown fields to specify what type of field they should be shown as in CMSB

We did our best to design the restore system so it's error-resistant and never deletes data when that can be avoided so as to prevent issues.

I think that will cover everything you need.  Let me know any questions and how it goes.

Thanks!

Dave Edis - Senior Developer
interactivetools.com

By pgplast - December 1, 2022

Dave:

I was able to accomplish the move without difficulty.

To make things go more smoothly, I created the new fields for the tables in the old database before backing up and restoring on the new computer.

I suspect that this was unnecessary, but the process went smoothly and my data is successfully transfered.

Thanks for your help.