27 January 2016

Magento database clone script

We recently added a new gist to our github account - a Magento 1 command line database syncing tool.  Most store owners will find the need to have at least a staging site for their store, and probably a development site as well.  While it's easy enough to get the staging environment mirroring production in terms of configuration, and the fileset handled by version control, syncing the database contents is less straightforward - but none the less desirable.

In an environment where you want to mirror production as closely as possible both in terms of configuration and data, having database contents lagging far behind production isn't ideal.  Take for instance a situation where you find a bug that is apparent on production but not in any other environment.  In my experience 99% of the time you eventually find issues like this to be down to differences in admin configuration, and therefore the database.  So it's important to have your stores staging environment properly synced to production to give yourself the best chance of finding any bugs before code is deployed to your production environment.

That's exactly what our syncing tool does - it requires n98-magerun and takes an already exported dump of your production database, imports it to your staging site and updates the install specific contents such as base url, cookie domain and secure front/backend settings.

You can find the script here with full usage instructions underneath.  I hope you find it useful!

No comments:

Post a Comment