-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(migrations): implement validate
command
#7087
Conversation
@@ -47,4 +55,105 @@ public static String getCurrentVersion(final MigrationConfig config, final Clien | |||
String.format("Could not query %s: %s", migrationTableName, e.getMessage())); | |||
} | |||
} | |||
|
|||
public static String getLatestMigratedVersion( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jzaralim this method will be useful for implementing apply
, in order to get the latest version to start applying commands from.
/** | ||
* @return true if validation passes, else false. | ||
*/ | ||
static boolean validate( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is non-private since we'll want to call it from the apply
command, in order to validate applied migrations prior to submitting any new ones ( cc @jzaralim )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is super helpful!
Description
The
validate
command of the migrations tool:apply
command should always use the latest MIGRATED version as "previous". Currently an error is thrown if this is not the case, but we can revisit when we introduce theabort
command to get out of bad states due to race conditions.NONE_VERSION
, indicating the first migration version has been reached.Once table scans are implemented, we can simplify the algorithm by simply doing a table scan and filtering for status MIGRATED.
Testing done
Lots of unit tests. Integration tests will be added with the
apply
implementation.Reviewer checklist