Drupal Modules: Backup & Migrate

Thursday, June 04, 2009

When I first installed the backup & migrate module I was just looking for a quick and easy way to backup the database of one of my Drupal-based sites and it served that purpose well (even letting me schedule backups), but I didnt realize how useful it would be to my development process. Here's what I mean… My usual development process usually goes something like this:

Create development site on my local machine using MAMP. I usually call it something like local.domain.com or dev.domain.com. (note: making sure you use *.domain.com will make life easier if you use some of Google's tool like Google Maps)

When I'm ready to launch the site for the first time, I use Backup & Migrate to create a backup of my development database and then I import it on my live server. Launching is easy this way. Just dont forget to put your development site in "maintainence mode" before you do the backup. (One of these days I'll write about how I use SVN with Drupal including launching sites.)

After the site has launced I still want to use my development site for ongoing...well, development. So before each new feature or design change or whatever, I grab a quick copy of my live-site database and import it into my development site. Now I'm working with the most up-to-date settings and content.

For those sites that I coninually develop I would love to write a simple script that would run on a cron job to grab the latest backup once a day (or once every few hours) and copy it down to my development site, then import it. If anyone else tries this (a) let me know (b) be careful if you are developing anything that alters the database (like adding a table) as you may loose this information.