I think I've just managed to use domain objects in the migration's code. The
trick seems to be really easy. Instead of using groovy.util.Eval for parsing
the migration code I switched to use groovy.lang.GroovyShell for this task.
The latter allows to pass in a custom classloader. If you use
Thread.currentThread().contextClassLoader here, you have access to your domain
classes inside the migration scripts.
Note: I did not dig too far in lbdsl and liquibase code, so I don't know if
this has any unexpected side effects, but it seems to work for me.
Attached there's the tiny patch against
git://github.com/RobertFischer/liquibase-dsl.git. Build lbdsl.jar freshly and
place it into the autobase's lib dir and rebuild&reinstall the Autobase
plugin.
BTW: Wouldn't it be a good idea to place the contents of lbdsl.jar directly in
the Autobase plugin? This might make development a little bit easier.
Regards,
Stefan
If the "insert data" migration is used, you need to know the id of the parent
when inserting a child node. Is this possible using the DSL way?
Using GORM syntax, that's pretty easy to populate:
new Category(name:"root").addToChildren(new Category(name:"sub1")).save()
A real problem is what you described in [1], this make me think, I'm on the
wrong way.
Regards,
Stefan