meta-environment
meta-environment copied to clipboard
Make database merges easier
Database merges are pretty painful right now, but there may be a few things we can do to make them easier.
- [x] Go through all the databases and remove any rows that aren't necessary. There may be a lot of postmeta that didn't get deleted when posts were.
- [ ] Create a script that would delete all transients and other non-essential data that gets generated automatically by WP. It could be run before pushing a PR, so that the database export file only had the changes that were actually part of the PR.
Does anyone have any other ideas?
The way we did this when working on Rails projects was that alongside the migrations we had a separate migration that would generate test data to use for in the database. So first the migrations to set up the database structure would run and then on development machines the migrations for the test data would be run. Maybe we could do something like this where we have some sort of 'migration' system where we can both build up from scratch and build only specific sites.
Another thing that could make it easier to maintain is just splitting the SQL dump. Instead of having one huge SQL dump we could have one dump for every site. For example splitting per site and then having a separate file for wp_site
and wp_blogs
That's a really interesting idea. What do you think that would look like in the context of the Meta Environment? Maybe during provision, we call wp eval-file import-sample-data.php
, and that PHP script calls wp_create_user()
, wp_insert_post()
, etc? Or would it run SQL commands directly?
That sounds like a great angle to explore. We'll have to see if it's fast enough, but this way it might also be possible to split different sites.