Problem/Motivation
To generate database fixtures for testing, Migrate currently relies on core/scripts/migrate-db.sh. This script was created before Symfony's Console component was put into core, and DumpDbApplication was written -- for the same purpose. There should not be two ways to dump a database in Drupal core.
Proposed Resolution
Migrate should use the DumpDbAppliction to generate its database fixtures, and migrate-db.sh should be removed. @neclimdul already started down this path in #2550291: Improve and generalize database dump tools.
Remaining Tasks
- DumpDbApplication must be extended so that it can dump any database defined in settings.php.
- Migrate Drupal's D6 and D7 database fixtures need to be re-generated using the extended DumpDbAppliation.
- Migrate Drupal's base test classes may need to be changed so that their loadDumps() methods create the test database from the generated fixtures.
- migrate-db.sh must be removed.
- This might sound like a lot, but it's really just one patch to review and commit.
API/UI Changes
No API changes or UI changes, but there is a DX change, which is that changes to the D6 and D7 database fixtures must be exported using DumpDbApplication.
Comment | File | Size | Author |
---|---|---|---|
#7 | d6_dump_updates.txt | 68.45 KB | mikeryan |
#4 | 2568203-4.patch | 4.17 MB | phenaproxima |
Comments
Comment #2
webchickThis is postponed on #2550291: Improve and generalize database dump tools and major for the same reason.
Comment #3
phenaproximaComment #4
phenaproximaThis patch:
All Drupal 6 tests passed on my localhost before uploading this, so I'm crossing my fingers. I really do not want to re-roll this.
Comment #5
mikeryanThe code looks good to me - I'd like to try actually using it to extract the dump, modify it, and redump though. Not sure if I'll have time today.
Comment #6
phenaproximaBlocked by #2579399: db-tools.php import does not work.
Comment #7
mikeryanThat issue doesn't really block this one - this patch does exactly what it should do, given a D6 db out there. To manually test it I did (with the import fix in place):
php core/scripts/db-tools.php import --database-url mysql://root@127.0.0.1:33067/d6_dump core/modules/migrate_drupal/tests/fixtures/drupal6.php
php core/scripts/db-tools.php dump --database-url mysql://root@127.0.0.1:33067/d6_dump >core/modules/migrate_drupal/tests/fixtures/drupal6.php
git diff >~/tmp/d6_dump_updates.txt
Attached is a patch file to update our D6 fixture to reflect current releases of D6 core and CCK. The process works as intended (and better than the old process - for one thing, now the cache tables have proper longblobs).
It'll be good to follow this up with #2578483: [meta] Keep dumps up-to-date and improve DX...
Comment #8
webchickThanks a lot for the extensive manual testing, Mike! I think this step makes sense to commit on its own, esp. given the pain in the ass factor to re-roll it.
However, we might need to roll back this whole DB Tools circus if we end up in danger of regressing from beta16 in rc1. Fortunately, we still have a little bit of time to clean this up before then.
Committed and pushed to 8.0.x. Thanks!
Comment #11
webchickPIFT you're bringing me down.