meta-environment icon indicating copy to clipboard operation
meta-environment copied to clipboard

Make database merges easier

Open iandunn opened this issue 8 years ago • 3 comments

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?

iandunn avatar Apr 29 '16 02:04 iandunn

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

atimmer avatar Jun 26 '16 12:06 atimmer

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?

iandunn avatar Jun 27 '16 16:06 iandunn

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.

atimmer avatar Jun 30 '16 18:06 atimmer