Our application stack looks something like Java 8 out of Tomcat 7, several distinct Postgres databases, Maven for build and Jenkins for CI. I have fully automated my team's build process using except for one missing subprocess: database (schema and/or data) changes. Once a change is committed to version control, a new build is kicked off in Jenkins and its resulting artifacts deployed in the build environment. I also have some scripts that deploy configuration file changes, should there be any, which is rare but even that case scenario is covered.

However, database schema changes still have to be applied manually. So if a an entity class contains a variable mapped via Hibernate to a column that has not yet been added in the database, the deployment fails until the change is applied manually. Needless to say, I hate it and need to overcome this irksome intervention.

I am wondering if there is any framework that integrates database changes, using convention over configuration. I am currently writing my own script to scan a versioned directory for conventionally formatted files containing schema or data changes (in the form of SQL statements) in Python but I would rather not reinvent the wheel if such a framework exists already because this scenario should be something many before me had to deal with.

  • 1
    Asking for a framework gives your question a high chance of getting closed by the community here, since asking for third party resources or tools is off-topic here on this site (there is a predefined close vote for this!). You might save your question by editing it and ask for an approach instead for a tool. – Doc Brown Jun 8 '17 at 6:09
  • Yeah it just turns into an opportunity for advertising. – RibaldEddie Jun 8 '17 at 18:13
  • while i understand the strict limitations of this particular forum, i find the question legitimate. where else on SE should I ask this same question ? – amphibient Jun 8 '17 at 18:21
  • softwareengineering.meta.stackexchange.com/questions/7253/… - but think about what I wrote, if you ask for an approach instead for a tool, your question can IMHO be made on-topic here. – Doc Brown Jun 9 '17 at 22:51

I don't know if Hibernate can create its own changesets based on the change in the mapping between model and db, but in the Java world I believe the go-to tool is LiquiBase (http://www.liquibase.org). I've had experience with this and it works well enough.

| improve this answer | |
  • 2
    Flyway is another popular choice for schema migrations flywaydb.org – Samuel Jun 8 '17 at 0:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.