Created
February 20, 2019 01:25
-
-
Save camsaul/32e6faa3f792a12b3d7b923ba7faafd0 to your computer and use it in GitHub Desktop.
Get the SQL for a Liquibase changeset
This file contains hidden or 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
(defn changeset->sql [^Liquibase liquibase, ^String changelog-file, ^String author, ^String id] | |
(let [database (.getDatabase liquibase) | |
sql-generator-factory (liquibase.sqlgenerator.SqlGeneratorFactory/getInstance)] | |
(for [change (-> liquibase | |
.getDatabaseChangeLog | |
(.getChangeSet changelog-file author id) | |
.getChanges) | |
statement (.generateStatements change database) | |
sql (.generateSql sql-generator-factory statement database)] | |
(.toSql sql)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment