This class is the closure delegate for a ChangeSet. It processes all the refactoring changes for the ChangeSet. it basically creates all the changes that need to belong to the ChangeSet, but it doesn't worry too much about validity of the change because Liquibase itself will deal with that.
To keep the code simple, we don't worry too much about supporting things that we know to be invalid. For example, if you try to use a change like addColumn { column(columnName: 'newcolumn') }, you'll get a wonderfully helpful MissingMethodException because of the missing map in the change. We aren't going to muddy up the code trying to support addColumn changes with no attributes because we know that at least a table name is required. Similarly, it doesn't make sense to have an addColumn change without at least one column, so we don't deal well with the addColumn change without a closure.
| Type | Name and description |
|---|---|
java.lang.Object |
changeSet |
java.lang.Object |
databaseChangeLog |
java.lang.Object |
inRollback |
java.lang.Object |
registry |
java.lang.Object |
resourceAccessor |
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
addColumn(java.util.Map params, groovy.lang.Closure closure)Processes an addColumn change, which takes a closure in addition to a map. |
|
void |
addForeignKeyConstraint(java.util.Map params)process an addForeignKeyConstraint change. |
|
void |
comment(java.lang.String text) |
|
void |
createIndex(java.util.Map params, groovy.lang.Closure closure)Processes a createIndex change, which takes a closure in addition to a map. |
|
void |
createProcedure(java.util.Map params = [:], groovy.lang.Closure closure)Processes a createProcedure change, which takes a closure in addition to an optional parameter map. |
|
void |
createProcedure(java.lang.String storedProc)Processes a createProcedure change. |
|
void |
createTable(java.util.Map params, groovy.lang.Closure closure)Processes a createTable change, which takes a closure in addition to a map. |
|
void |
createView(java.util.Map params, groovy.lang.Closure closure)Processes a createView change, which takes a closure in addition to a map. |
|
void |
customChange(java.util.Map params, groovy.lang.Closure closure = null)Processes a customChange change, which takes a closure in addition to a map. |
|
void |
customChange(groovy.lang.Closure closure)A Groovy-specific extension that allows a closure to be provided, implementing the change. |
|
void |
delete(java.util.Map params, groovy.lang.Closure closure)Processes a delete change, which can take a closure in addition to a map. |
|
void |
dropColumn(java.util.Map params, groovy.lang.Closure closure)Processes a dropColumn change, which takes a closure in addition to a map. |
|
void |
empty()Process an "empty" changes. |
|
void |
executeCommand(java.util.Map params, groovy.lang.Closure closure)Processes an executeCommand change, which can take a closure in addition to a map. |
|
void |
groovyChange(groovy.lang.Closure closure) |
|
void |
insert(java.util.Map params, groovy.lang.Closure closure)Processes an insert change, which takes a closure in addition to a map. |
|
void |
loadData(java.util.Map params, groovy.lang.Closure closure)Processes a loadData change, which takes a closure in addition to a map. |
|
void |
loadUpdateData(java.util.Map params, groovy.lang.Closure closure)Processes a loadUpdateData change, which takes a closure in addition to a map. |
|
java.lang.Object |
methodMissing(java.lang.String name, java.lang.Object args)Groovy calls methodMissing when it can't find a matching method to call. |
|
void |
modifySql(java.util.Map params = [:], groovy.lang.Closure closure) |
|
void |
output(java.util.Map params)Processes an output change. |
|
void |
preConditions(java.util.Map params = [:], groovy.lang.Closure closure) |
|
void |
rollback()Process an empty rollback. |
|
void |
rollback(java.lang.String sql) |
|
void |
rollback(groovy.lang.Closure closure)Process a rollback when the rollback changes are passed in as a closure. |
|
void |
rollback(java.util.Map params)Process a rollback when we're doing an attribute based rollback. |
|
void |
sql(java.util.Map params = [:], groovy.lang.Closure closure)Processes a sql change. |
|
void |
sql(java.lang.String sql)Parse a sql change. |
|
void |
sqlFile(java.util.Map params)Processes a sqlFile change. |
|
void |
stop(java.lang.String message)Parse a stop change. |
|
void |
tagDatabase(java.lang.String tagName)Parse a tagDatabase change. |
|
void |
update(java.util.Map params, groovy.lang.Closure closure)Processes an update change, which takes a closure in addition to a map. |
|
void |
validCheckSum(java.lang.String checksum) |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Processes an addColumn change, which takes a closure in addition to a map.
params - the properties to set on the new changes.closure - the closure to call with the nested columns for the change.process an addForeignKeyConstraint change. This change has a deprecated property for which we need a warning.
params - the properties to set on the new changes.Processes a createIndex change, which takes a closure in addition to a map.
params - the properties to set on the new changes.closure - the closure to call with the nested columns for the change.Processes a createProcedure change, which takes a closure in addition to an optional parameter map.
params - the properties to set on the new changes.closure - the closure to call with the definition of the procedure.Processes a createProcedure change. This version of the method processes a createProcedure change where the text of the procedure is given as a string instead of in a closure.
storedProc - the definition of the procedure to create.Processes a createTable change, which takes a closure in addition to a map.
params - the properties to set on the new changes.closure - the closure to call with the nested columns for the change.Processes a createView change, which takes a closure in addition to a map.
params - the properties to set on the new changes.closure - the closure to call with the nested columns for the change.Processes a customChange change, which takes a closure in addition to a map.
params - the properties to set on the new changes.closure - the closure to call with key value pairs for the change.A Groovy-specific extension that allows a closure to be provided, implementing the change. The closure is passed the instance of Database.
Processes a delete change, which can take a closure in addition to a map.
params - the properties to set on the new changes.closure - the closure to call with the nested columns for the change.Processes a dropColumn change, which takes a closure in addition to a map.
params - the properties to set on the new changes.closure - the closure to call with the nested columns for the change.Process an "empty" changes. It doesn't do anything, but it is allowed by the spec.
Processes an executeCommand change, which can take a closure in addition to a map.
params - the properties to set on the new changes.closure - the closure to call with arguments for the change.Processes an insert change, which takes a closure in addition to a map.
params - the properties to set on the new changes.closure - the closure to call with the nested columns for the change.Processes a loadData change, which takes a closure in addition to a map.
params - the properties to set on the new changes.closure - the closure to call with the nested columns for the change.Processes a loadUpdateData change, which takes a closure in addition to a map.
params - the properties to set on the new changes.closure - the closure to call with the nested columns for the change.Groovy calls methodMissing when it can't find a matching method to call. We use it to create a Liquibase change with the same name as the element. The methodMissing method can only create changes that are present in the Liquibase Registry, have no nested elements, and take maps as attributes.
Changes that allow nested elements need special handling in their own methods to handle the closure delegate needed to process the nested elements. Non-map arguments (like strings) also need special handling.
name - the name of the method Groovy wanted to call. We'll assume
it is a valid Liquibase change name.args - the original arguments to that method. We can only handle
a single map here.Processes an output change. This method only takes a map, but we can't use methodMissing for this change because Liquibase initializes the target to the invalid value of an empty string instead of null.
params - the properties to set on the new changes.Process an empty rollback. This doesn't actually do anything, but empty rollbacks are allowed by the spec.
Process a rollback when the rollback changes are passed in as a closure. The closure can contain nested refactoring changes or raw sql statements. I don't know what the XML parser will do, but if the closure contains both refactorings and ends with SQL, the Groovy DSL parser will append the SQL to list of rollback changes.
closure - the closure to evaluate.Process a rollback when we're doing an attribute based rollback. The Groovy DSL parser builds a little bit on the XML parser. With the XML parser, if some attributes are given as attributes, but not a changeSetId, the parser would just skip attribute processing and look for nested tags. With the Groovy DSL parser, you can't have both a parameter map and a closure, and all supported attributes are meant to find a change set. What This means is that if a map was specified, we need to at least have a valid changeSetId in the map.
Processes a sql change. This version of it takes the SQL as a closure.
params - the properties to set on the new changes.closure - the closure to call with the SQL for the change. Parse a sql change. This version of the method is syntactic sugar that
allows sql 'some query' in stead of the usual parameter based
change.
sql - the SQL for the change.Processes a sqlFile change. We can't use methodMissing here because we have additional validation we need to do.
params - the properties to set on the new changes. Parse a stop change. This version of the method is syntactic sugar that
allows stop 'some message' in stead of the usual parameter based
change.
message - the stop message. Parse a tagDatabase change. This version of the method is syntactic sugar
that allows tagDatabase 'my-tag-name' in stead of the usual
parameter based change.
tagName - the name of the tag to create.Processes an update change, which takes a closure in addition to a map.
params - the properties to set on the new changes.closure - the closure to call with the nested columns for the change.