title: Spring Boot & Liquibase by Example
body: <p>Spring Boot and MySQL here. Trying to get my Spring Boot app to use Liquibase for my DB migrations and see in the docs that Spring Boot <a href="https://docs.spring.io/spring-boot/docs/current/reference/html/howto-database-initialization.html#howto-execute-liquibase-database-migrations-on-startup" rel="noreferrer">has built-in support for Liquibase</a>.</p>
  
  <p>However after reading those docs, I'm left with several related concerns:</p>
  
  <ul>
  <li>What is the fundamental purpose of the <code>db/changelog/db.changelog-master.yaml</code> file? Is it to store Liquibase configurations (that dictate how Liquibase behaves), or is that where I'm supposed to put the actual, sequential SQL changes (the "<em>migrations</em>") themselves?
  
  <ul>
  <li>Ideally I'd like to have a <code>src/main/resources/migrations</code> directory and store my migration changes as individual SQL files, like so:</li>
  <li><code>src/main/resources/migrations/001-schema.sql</code></li>
  <li><code>src/main/resources/migrations/002-init.sql</code></li>
  <li><code>src/main/resources/migrations/003-changing-account-types.sql</code></li>
  <li>...etc. <strong>Is it possible to configure Liquibase to do this via Spring Boot?</strong></li>
  </ul></li>
  <li>When will Spring Boot run these Liquibase migrations? At app startup? What if the Spring Boot app actually runs on a cluster of nodes (say 5 nodes behind a load-balanced URL)? Will Spring Boot run Liquibase run 5 times, once on each node? Or does it somehow sense that one node is the "<em>master migrator</em>", etc.?</li>
  </ul>