At a new job I started, we have both a Java application that handles most of the heavy lifting in the core business logic, and we also have a Rails application that of course handles the web interface to this server. Both of these access the same database.
Up until now, most of the focus has been on the Java application, and as such, there are no migrations in the Rails project. The sql to update the shared database is managed in a file like changes.sql.
As you can imagine, this makes it somewhat difficult to develop.
My initial thought was to combine the codebases for the Java project and the Rails application, because there is a dependency there, and to manage that SQL file in the source. However, I thought I’d ask here to see if anyone else had tackled this issue with some degree of success.
One approach is to use the rails migration tools, generate the DDL files for the database and use Hibernate to update the Java objects that relate to specific database entities. You don’t really say how you manage database changes on the Java side or whether you use an ORM, but you can certainly synchronize the two with a little work.
Or you can go the other way around and let the Java definitions control changes on the Rails side.
I think the key to doing this successfully is to select one of the two platforms as your ‘primary database modeller’ and develop the process to migrate that model to the other platform. Attempting to allow changes from both will only cause headaches.