tlberglund/gradle-liquibase-plugin — pull request #13 by stevesaliman (2013-12-02 00:46:31+00:00)
Title: Updated to Gradle 1.7, Liquibase 3.0.7, the latest of the DSL, bug fixes

I was getting 404 errors on Margo's posted github link, so I had to start from scratch. I'm sorry for the duplication of efforts. The intent is for this pull request to replace that one, since it appears to include more, and has progressed farther than that last one. There is still some work to do, mainly in the area of testing, but I wanted to give people the chance to see the code and help out with testing.

### Changes
I've made several changes to the plugin in this pull request:

1. The plugin was designed to run with the latest Liquibase release (currently 3.0.7), as well as incorporating changes I made to the Groovy DSL to support that release.
2. The ```generateChangelog``` task used to be destructive (issue #2). It now fails the build if the changelog file already exists. This has the happy side effect of side-stepping the Liquibase bug that happens when we append to existing changelog files, and we'd get a tag at the end of our Groovy file.
3. The plugin used to report success even if Liquibase failed (Issue #3). It now fails the build when Liquibase has issues.
4. When Liquibase had a problem, the stack trace was repeated up to 3 times, making it hard to troubleshoot. Now, when Liquibase has an issue, there is only one stack trace, the the cause of the trace now shows up as the failure message at the very bottom. This message is usually exactly what went wrong, such as "invalid value for column X", or some other database related message. I think this makes build issues easier to find.
5. All tasks now have descriptions, as copied from Liquibase's documentation

### Testing Notes
- I've tested dropAll, updateSQL, update, status validate, clearChecksums, and changelogSync.
- I checkout the liquibase-workshop project and ran the ```buildSchema```, and ```generateChangeLog```, tasks sucessfully, though ```update``` went on to fail. It seems that the H2 database is unhappy with the SQL being generated.
- Unit tests in the DSL all work, though they should probably be beefed up to support the different options offered by each type of change set.

### Misc. Notes and Questions
This is where I could use some help/feedback.

- ```generateChangelog``` now fails when the file already exists, but I'm thinking it might be more graceful if it simply appended "-1", or "-generated" or something to the filename and continued on. It makes it easier to see what the generated change sets would look like without having to remove the possibly perfectly good file already in the directory. What do you think?
- I noticed that Liquibase has a change set called ```createProcedure```, while the Groovy DSL has one called ```createStoredProcedure``` instead. I'm not sure if this was a change in Liquibase, or if this was done intentionally. Should we rename it in the DSL to match what Liquibase is doing?
- I added the ```dropAllForeignKeyConstraints``` change set, but have not had a chance to test it yet.
- I need to test the behavior of the ```delete``` and ```update``` change sets. They heed to have a "where" clause, but I couldn't see where it was handled by the DSL.
- I need to test support for the ```sql``` change set's nested ```comment``` tag.
- Liquibase itself added options for the liquibaseSchema and liquibaseCatalog. It appears that they are support putting the liquibase tables in a different schema/catalog from application tables. Liquibase itself doesn't support using it in it's command line utilities, but the Gradle plugin does. I need to test these options.
- the ```executeCommand``` changeset has an "os" attribute that doesn't seem to be addressed in the DSL. I need to play with that change set to see what it does.