title: How to handle database migrations in Spring Boot with Hibernate?
body: <p>My database background comes from the Django framework (python). In Django, getting started with database migrations was easy: <a href="https://docs.djangoproject.com/en/1.11/topics/migrations/" rel="noreferrer">Django migrations</a>. The Django framework provided tool for creating the migrations based on your models, and also a tool to apply the migrations on your database. I think this way of doing worked in both development and in production. You did not have to write migrations by yourself, the framework created them for you.</p>
  
  <p>Now I have started a project with Spring Boot and Hibernate. I configure my application to use hibernate with JPA. With these settings, I now would need to know how does my framework handle database migrations? I mean if I change a column, either it's type, or even might remove it, then how do I migrate the database to the change? I know that spring boot will automatically detect column changes on startup, and create columns that do not exist based on the models (Entity's). I guess it has something to do with variable </p>
  
  <blockquote>
    <p>spring.jpa.hibernate.ddl-auto</p>
  </blockquote>
  
  <p>But how does it handle the existing database objects? Does it add the column to them too, and with what value? The default value I set? What if I change the column type? Can it then handle the change? These settings and spring-boot automated database management probably are not enough in the long run?</p>
  
  <p><strong>What I want to know is, that what are the best practices on how to handle database migrations with Spring Boot and hibernate combination?</strong> I believe there is a standard how most of the people with this combination handle the migrations? I hope it is as easy as with Django... I know about flyway, but don't know if I really need it, or if it is used much with this combination of mine (including spring boot and hibernate).</p>