Closed davidjgoss closed 1 month ago
Name | Link |
---|---|
Latest commit | 5bbb565e184bdc8c664e99d3a5b8026b5d283a85 |
Latest deploy log | https://app.netlify.com/sites/peppy-sprite-186812/deploys/6716c92e00f36600088b9af8 |
Attention: Patch coverage is 50.00000%
with 1 line
in your changes missing coverage. Please review.
Project coverage is 81.16%. Comparing base (
b7277d7
) to head (5bbb565
). Report is 1 commits behind head on main.
Files with missing lines | Patch % | Lines |
---|---|---|
api/src/main/java/marquez/db/DbMigration.java | 0.00% | 0 Missing and 1 partial :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Problem
There was no Marquez command to run all pending Flyway migrations. This is needed in the context of wanting to run migrations in a short-lived container ahead of the application deployment, so migrations are not coupled to startup. The
db-migrate
command sort of looks like it should do this, but actually only supports running a single specific Java migration which is from ~20 versions ago.Solution
This PR repurposes
db-migrate
to run all pending migrations.The original intent was to leave the existing functionality around the V57 migration in place and support omitting the
version
argument to run all pending migrations. However, this was dependent on the command remaining anEnvironmentCommand
which caused its own problem, because such a command by nature requires the application'srun
method to have been called, which contains the migration-on-startup logic. So the scenario would go:migrateOnStartup: false
in the configmarquez.jar db-migrate my-config.yml
MarquezApp::run
is called by DropwizardmigrateDbOrError
detects pending migrations and throws because they ostensibly aren't about to rundb-migrate
commandSo instead we have reworked the command to be a
ConfiguredCommand
which only requires the resolved configuration and bootstrap object, and can be run without the application'srun
method ever being touched.One-line summary: Repurpose db-migrate to run all pending migrations
Checklist
CHANGELOG.md
(Depending on the change, this may not be necessary)..sql
database schema migration according to Flyway's naming convention (if relevant)