Make pgroll pull
and pgroll migrate
command able to handle incompatible migration file formats
#812
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ensure that the
pgroll pull
andpgroll migrate
commands are able to operate safely when either:pgroll
.pgroll
.This ensures that these commands work in the presence of older migration formats, either locally or in the remote schema history.
This is done by adding a new
RawMigration
type to themigrations
package, which does not deserialize theOperations
in the migration but leaves them as ajson.RawMessage
.The following methods in the
roll
andstate
packages are then updated to work with and returnRawMigrations
:SchemaHistory
- used to return the schema history from the target database.MissingMigrations
- used to find remote migrations that don't exist in the local historyUnappliedMigrations
- used to find local migrations that don't exist in the remote.By updating these methods and the
pull
andmigrate
commands that use them, these commands can work safely even with local or remote migrations that can't be deserialized by the current version ofpgroll
.Tests are added for both the
MissingMigrations
andUnappliedMigrations
methods to ensure that they work with un-deserializable migrations.Part of #770