Last active
April 7, 2023 20:33
-
-
Save alismx/ac68b4781c7c500bf5c2aa9bd4aaff7c to your computer and use it in GitHub Desktop.
Script to handle some liquibase commands related to checksums and rollbacks
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
#!/bin/bash | |
# Pick and set one of these environmet variables | |
tag="$LIQUIBASE_ROLLBACK_TAG" | |
count="$LIQUIBASE_ROLLBACK_COUNT" | |
clear="$LIQUIBASE_CLEAR_CHECKSUMS" | |
if [ "${clear}" = "true" ]; then | |
echo "Clearing checksums..." | |
gradle liquibaseClearCheckSums | |
else | |
# Only run validations if not clearing checksums | |
echo "Running validations..." | |
gradle liquibaseValidate | |
if [ -n "${tag}" ]; then | |
echo "Rolling back to tag: ${tag}" | |
gradle liquibaseRollback -PliquibaseCommandValue="${tag}" | |
elif [ -n "${count}" ]; then | |
echo "Rolling back by count: ${count}" | |
gradle liquibaseRollbackCount -PliquibaseCommandValue="${count}" | |
else | |
echo "No rollback tag or count provided! Taking no action." | |
exit 0 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment