188 migrations run at the start of every CI job, replaced by a dump loaded in nine seconds.
- name: restore the schema
run: |
if ! mysql -h127.0.0.1 app_test < database/schema.sql; then
php artisan migrate --force
fi
- name: the schema dump is current
run: |
php artisan schema:dump --prune
git diff --exit-code database/schema.sql
|| { echo 'run php artisan schema:dump'; exit 1; }
The staleness check is what makes this safe, and without it a migration added without regenerating the dump is silently absent from every test run. Four minutes to nine seconds across eight parallel jobs is the largest single win in the whole parallelisation exercise, and it is the least interesting part of it.