Refreshing database from production to development
-
I am in the process of re-working my installation of WordPress to better track changes I make. Previously I was just tracking them in a txt file that I would put the filename, what I changed, and the reason for it. This was ok at first but gets unwieldy very fast.
I decided to implement Subversion to help me out with this and so far it’s been great. The flow will be pretty simple:
– Check out from working base/repository to my development workstation.
– Make changes
– Upload to development site via SFTP for testing purposes.
– Commit changes to repository
– Update development site with latest revision to get development site all in-sync.
– Test changes
– Update production site from repository.Everything is going fine with one exception. Database consistency! I’d really like to refresh the dev database with production before doing major changes like new/updated plugins, upgrading WordPress, etc…
I’ve examined the database and can find three instances where they are significantly (meaning important, not complicated) different. All three simply differ in what is basically the site url. They are:
PROD – https://mysite.com/
DEV – https://dev.mysite.com/– wp_options table has an option of siteurl with these values
– wp_posts has a guid column on each post that contains the url
– wp_users has a user_url column for each user and of course “my” user_url is my blog site, which would differ (this one isn’t much of an issue, but I figure any solution will/should take care of it anyway).So here’s what I view are my two options:
– Create a semi-sophisticated refresh script that exports prod database, backup/drop dev database, import prod data into dev base, and then go through and change all values to their dev equivilent.
– Possibly implement some kind of .htaccess rewrite to rewrite mysite.com to dev.mysite.com in development.
I am leaning towards the .htaccess rewrite option (if it will work) because it will be less to maintain and any performance slowdown will only affect dev which isn’t a big deal. The refresh script is a good backup I think though because it will ensure the configuration of each site is as identical as possible, but it’s more to maintain and prone to getting out of date.
I’m curious if anyone has attempted something like this already. Or if there’s an official “best practice” from WordPress on this process…
Thanks in advance for any and all comments. I’m going to get started on the rewrite method but I hope to get some good and varied points of view!
- The topic ‘Refreshing database from production to development’ is closed to new replies.