I want to be able to run a command and determine if there is a pending migration. This is going to be scripted so the best thing would be a command that returns easy to parse output.
The only command I could find for this is info but the output stinks. I want to confirm if there is a way to get parsable output.
For example this command:
flyway -locations="filesystem:schema_migration_files" \
-user="userxyz" \
-password="lsdkfklsdfjld" \
-url=jdbc:postgresql://myserver:5432/mydb \
info
Gives me this atrocious output:
I can parse that mess myself. I would probably just check if string "Pending" is in the output, but I'm not sure how reliable that would be. I just need to determine if there is or isn't a pending migration.
You can use the -outputType=json
command line argument, and then parse the output.