Cool! Thanks! I hadn't had much success, yet, searching for the
Javadoc. (Not that I had put that much effort into it.)
I did find enough, somewhere, to get the feeling that CustomTaskChange
was for me. I have to create new rows of data, based on rows from
another table, and supply proper object Id's from a 3rd table. ::whew::
I'm just glad that Liquibase has the hook. Otherwise, my upgrade would
have been somewhat hellish.
Thanks for all the info, guys!
Voxland, Nathan wrote:
> The correct javadoc link is
http://www.liquibase.org/api/index.html> (
http://www.liquibase.org/api/liquibase/change/custom/CustomTaskChange.h> tml for the class directly) which has some info in it.
>
> If what you are trying to do is not a simple SQL statement,
> CustomTaskChange is the way to go.
>
> Nathan
>
>
> -----Original Message-----
> From: David C. Hicks [mailto:
dhicks@...]
> Sent: Tuesday, June 23, 2009 5:10 PM
> To:
liquibase-user@...
> Subject: Re: [Liquibase-user] CustomSqlChange/CustomTaskChange exmples?
>
> Mostly, I was curious about what I should (or shouldn't) do with all the
> extra methods that the interface gives me. I'm actually working on a
> CustomTaskChange. I need to do some very specific data manipulation for
> one of my updates. I figured this would be easier than trying to write a
> bunch of SQL. So, it's old-school JDBC.
>
>
>
> Voxland, Nathan wrote:
>
>> Thanks for pointing that out. Here is an example CustomSqlChange
>> class, is there anything in particular you are wondering?:
>>
>> public class ExampleCustomSqlChange implements CustomSqlChange,
>> CustomSqlRollback {
>>
>> private String tableName;
>> private String columnName;
>> private String newValue;
>>
>> @SuppressWarnings({"UnusedDeclaration", "FieldCanBeLocal"})
>> private ResourceAccessor resourceAccessor;
>>
>>
>> public String getTableName() {
>> return tableName;
>> }
>>
>> public void setTableName(String tableName) {
>> this.tableName = tableName;
>> }
>>
>> public String getColumnName() {
>> return columnName;
>> }
>>
>> public void setColumnName(String columnName) {
>> this.columnName = columnName;
>> }
>>
>> public String getNewValue() {
>> return newValue;
>> }
>>
>> public void setNewValue(String newValue) {
>> this.newValue = newValue;
>> }
>>
>> public SqlStatement[] generateStatements(Database database) {
>> return new SqlStatement[]{
>> new RawSqlStatement("update "+tableName+" set
>> "+columnName+" = "+newValue)
>> };
>> }
>>
>> public SqlStatement[] generateRollbackStatements(Database
>>
> database)
>
>> throws UnsupportedChangeException, RollbackImpossibleException {
>> return new SqlStatement[]{
>> new RawSqlStatement("update "+tableName+" set
>> "+columnName+" = null")
>> };
>> }
>>
>> public String getConfirmationMessage() {
>> return "Custom class updated "+tableName+"."+columnName;
>> }
>>
>> public void setUp() throws SetupException {
>> }
>>
>> public void setFileOpener(ResourceAccessor resourceAccessor) {
>> this.resourceAccessor = resourceAccessor;
>> }
>>
>> public ValidationErrors validate(Database database) {
>> return new ValidationErrors();
>> }
>>
>> }
>>
>> -----Original Message-----
>> From: David C. Hicks [mailto:
dhicks@...]
>> Sent: Tuesday, June 23, 2009 2:54 PM
>> To: Liquibase Users
>> Subject: [Liquibase-user] CustomSqlChange/CustomTaskChange exmples?
>>
>> The online docs have links, but they go to blank pages. Can anyone
>> point me to an example of a custom change class of any kind?
>> Thanks!
>> Dave
>>
>>
>>
>>
> ------------------------------------------------------------------------
>
>> ------
>> _______________________________________________
>> Liquibase-user mailing list
>>
Liquibase-user@...
>>
https://lists.sourceforge.net/lists/listinfo/liquibase-user>>
>>
>>
> ------------------------------------------------------------------------
> ------
>
>> _______________________________________________
>> Liquibase-user mailing list
>>
Liquibase-user@...
>>
https://lists.sourceforge.net/lists/listinfo/liquibase-user>>
>>
>
> ------------------------------------------------------------------------
> ------
> _______________________________________________
> Liquibase-user mailing list
>
Liquibase-user@...
>
https://lists.sourceforge.net/lists/listinfo/liquibase-user>
> ------------------------------------------------------------------------------
> _______________________________________________
> Liquibase-user mailing list
>
Liquibase-user@...
>
https://lists.sourceforge.net/lists/listinfo/liquibase-user>
------------------------------------------------------------------------------
_______________________________________________
Liquibase-user mailing list
Liquibase-user@...
https://lists.sourceforge.net/lists/listinfo/liquibase-user