preconditions is not working

14 views
Skip to first unread message

Adwin Wijaya

unread,
Jan 1, 2009, 9:21:53 PM1/1/09
to Autobase
HI Robert,

I tried this on my db but it seems the preconditions was ignored thus
it produce exception error while trying to drop/rename column

here is my migrations script (for mysql db)

changeSet(id:'ChangeFoo', author:'R61') {
def tableName = "Foo";
def oldColumnName= "test";
def newColumnName= "no_test";

preConditions(){
columnExists(schemaName:'grailstest', tableName:'Foo',
columnName:'test')
}

dropColumn(tableName: tableName, columnName:newColumnName);
renameColumn(tableName:tableName, oldColumnName:oldColumnName,
newColumnName:newColumnName, columnDataType:"int");

}

error :
[6812] AutobaseGrailsPlugin Error during Autobase migration
liquibase.exception.MigrationFailedException: Migration failed for
change set te
ster-autobase::ChangeFoo::R61:
Reason: liquibase.exception.JDBCException: Error executing SQL
ALTER TABLE
`Foo` CHANGE `test` `no_test` int:
Caused By: Error executing SQL ALTER TABLE `Foo` CHANGE
`test` `no_tes
t` int:
Caused By: Unknown column 'test' in 'foo'
at liquibase.ChangeSet.execute(ChangeSet.java:227)
at liquibase.parser.visitor.UpdateVisitor.visit
(UpdateVisitor.java:26)
at liquibase.parser.ChangeLogIterator.run
(ChangeLogIterator.java:41)
at liquibase.LiquibaseDsl.update(LiquibaseDsl.groovy:93)
at Autobase.migrate(Autobase.groovy:41)
at AutobaseGrailsPlugin$__clinit__closure7.doCall
(AutobaseGrailsPlugin.g
roovy:50)
at AutobaseGrailsPlugin.invokeMethod
(AutobaseGrailsPlugin.groovy)
at AutobaseGrailsPlugin$_closure2.doCall
(AutobaseGrailsPlugin.groovy:82)
.....
===========================================================================================

my domain has no "test" field .. I just want to test wheter the
preconditions working or not.

is there any mistakes on preConditions ?

thanks

regards
adwin

Adwin Wijaya

unread,
Jan 3, 2009, 10:27:49 AM1/3/09
to Autobase
hi,

may i know the solutions for this "preconditions"

thank you ...

regards,

adwin

Robert Fischer

unread,
Jan 3, 2009, 11:41:16 AM1/3/09
to grails-...@googlegroups.com
Hey there. My MacBook Pro died on me (turned out the power management chip was confused), so this
is the first I've seen your message.

I'll tackle this later today and see what's pup.

~~ Robert.
--
~~ Robert Fischer.
Grails Trainining http://www.smokejumperit.com/grails_training.html
Smokejumper Consulting http://smokejumperit.com
Enfranchised Mind Blog http://enfranchisedmind.com/blog

Adwin Wijaya

unread,
Jan 3, 2009, 1:11:06 PM1/3/09
to Autobase
Thanks Robert,

I really confused about the problem here and I am rellying on your
autobase so much :)
thank you very much for helping me with your autobase

regards
adwin

On Jan 3, 11:41 pm, Robert Fischer <robert.fisc...@smokejumperit.com>
wrote:

Adwin Wijaya

unread,
Jan 6, 2009, 2:06:03 AM1/6/09
to Autobase
anything new about this preconditions ?

cjh

unread,
Jan 6, 2009, 2:06:27 PM1/6/09
to Autobase
I have yet to use preconditions, but aren't the () after preConditions
invalid? you should only have the closure.

Robert Fischer

unread,
Jan 6, 2009, 8:31:02 PM1/6/09
to grails-...@googlegroups.com
Either should work out -- in Groovy, the following three are the same:

preConditions { [...] }

preConditions() { [...] }

preConditions({ [...] })

~~ Robert.
--
~~ Robert Fischer.
Grails Trainining http://www.smokejumperit.com/grails_training.html

Robert Fischer

unread,
Jan 7, 2009, 9:12:19 AM1/7/09
to grails-...@googlegroups.com
I can now duplicate your problem. Going to research the issue later today.

~~ Robert.

Adwin Wijaya wrote:

Adwin Wijaya

unread,
Jan 9, 2009, 2:22:18 AM1/9/09
to Autobase
did you find the sympthom robert ?

i am just curious because i tried with grails-liquibase one it works.
i think you got problem with your dsl parser. cmiiw ..

btw, you have done such a great job ... i like to use autobase. it is
very usefull.



On Jan 7, 9:12 pm, Robert Fischer <robert.fisc...@smokejumperit.com>
wrote:

Robert Fischer

unread,
Jan 9, 2009, 8:42:01 AM1/9/09
to grails-...@googlegroups.com
I'm sure it's a parser problem.

I'm sorry this is taking so long -- between finishing my book, my day job, and trying to get a fix
into Liquibase itself to support the body parsing, things are busy. Like I said, though, I've
already been able to duplicate the behavior, and I will take a more careful look at this later today.

~~ Robert.

Robert Fischer

unread,
Jan 13, 2009, 10:35:24 PM1/13/09
to grails-...@googlegroups.com
This specific problem is the one that is fixed in the 0.7 release.

~~ Robert.
--
Reply all
Reply to author
Forward
0 new messages