Code based migration for server deployments

Hi,
When I upgrade my production, I want to automate some data migrations.
For example, I added country entity and I want to fill its values when deploying. I know I can do it via SQL, but I have more complex use cases, such as writing files to disk and it gets complex.

Is there any deployment tool that knows to run managed JAVA code migration?
Thanks

Hi,

The framework supports custom Groovy scripts for complex database migrations. There you can use Groovy SQL to work with the database:

Sql sql = new Sql(ds)
sql.execute """ alter table MY_COLOR add DESCRIPTION varchar(100); """

Isnt there any entrypoint that I can run each deployment? … in java

public void up(){
   MyEntity entity = dataManager.create(....);
   entity.setName("test");
   dataManage.commit(entity);
   MyUtils.writeFileToDisk(entity);
   MyUtils.renameOnDisk(entity);
   MyUtils.whatever();
   //bla bla bla
}

Can you think of something that I can implement fast to acheive that? I have already written API and services… I want to use them in the migration… it would be a mess to now write them in ruby,

Thanks

There is postUpdate section mentioned in manual. You can call your existing services and beans of the middleware there.