-
Notifications
You must be signed in to change notification settings - Fork 77
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
Improve status
command with missing
migrations
#145
Conversation
those stored on db, and it also looks for migrations which are locally missing but have been applied on db. A missing migration is thus a migration applied by someone else (eg: another developer) and locally missing. Output of `migrate status` will look like ID Applied At Description ================================================================================ 20190620071710 2019-06-20 09:41:51 create changelog 20190620071711 2019-06-20 09:41:51 first migration 20190620074320 ...missing... migration1 20190620085416 2019-06-20 10:54:19 migration2
Hi @ffissore , Thanks for the PR! In the proposed output, though, the 'missing' migration is actually applied to the database, so omitting the timestamp could be confusing in a different way, IMHO. How about reusing the So, there will be a WARNING after the list of migrations. e.g.
Printing the warning is pretty easy. if (changelog != null) {
checkSkippedOrMissing(changelog, migrations, printStream);
} Plus, we don't need to modify class MissingScript extends Change {
MissingScript(BigDecimal id, String appliedTimestamp, String description) {
super(id, appliedTimestamp, description);
}
@Override
public String toString() {
return getId() + " " + getAppliedTimestamp() + " "
+ getDescription() + " <=== MISSING!";
}
} The output would be...
|
version, added MissingScript to mark a Change as missing, added output of `checkSkippedOrMissing` to the bottom of `status` command
Thank you @harawata I've addressed your feedback. Output is now
|
Thank you, @ffissore ! |
Thank you for caring about community contributions, @harawata! |
The status command compares the list of local migrations with those found on db. This may lead to misleading output when two or more developers are working on the same db but from different git branches: a migration which is applied but locally missing won't be shown by the status command.
This PR introduces "missing" migrations. The changelog is merged with the list of local migrations, and changelog entries which are not part of the list of local migrations are shown as "...missing...". Example output
Here someone has applied "migration1" which is missing from our local branch.