-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tweak db prepare/migrate/seed for multiple gateways (#234)
Fix a range of issues detected during manual testing with a (soon-to-be) 2.2.beta2 app with multiple DB gateways configured for the app: - `db prepare` was failing, since the ROM/Sequel migrator needs every configured getaway to have its database created before the migrator can run. To fix this, change the order of the nested `db prepare` commands, so that `db create` and `db structure load` are run first for _every_ detected database. After that is done, move onto `db migrate` for each detected database. Finally, run `db seed`. - Given that `db prepare` now runs commands in a mixed order (i.e. no longer a single slice at a time), change the handling of command failures such that they halt and exit the entire command immediately. This should make it easier for the user to identify and address failures, and reduces the chance of unexpected outcomes from latter steps being impacted by earlier failures. - `db seed` should run only once for each slice, but our internal `#databases` method will yield for each database, so when a slice has multiple gateways, we were trying to seed it multiple times. To fix this, track the seeded slices and skip seeding for subsequence detected databases if the slice has already been seeded. - Various errors were raised from the ROM/Sequel migrator if a gateway is configured but does not yet have a real migrations dir (e.g. `config/db/[gateway_name]_migrate/`). This would occur in both `db migrate` as well as `db structure dump` (which uses the migrator to know the applied migrations to include at the bottom of the structure file). To fix these, skip attempting to load the migrator for a gateway database if there is no matching migration dir found. - Update the warnings around empty migration paths to respect the naming of migration dirs for gateways. - Fix bug arising in `db prepare` from us accidentally assigning the `fs` as a DB command's `inflector`.
- Loading branch information
Showing
6 changed files
with
76 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters