Liquibase already does 1 using Fastcheck: here and here. That's something relatively new. But the accepted answer is also good!