<p>Using Spring Boot and managing database changes by Liquibase all changes are executed on application start. This is totally fine for fast running changes.</p>
<p>Some changes, e.g. adding DB index, can run for a while. If running application on K8s it happens that liveness/readyness checks trigger an application restart. In this case Liquibase causes an end-less loop.</p>
<p>Is there a pattern how to manage long running scripts with Liquibase? Any examples?
One approach might be splitting the the changes in two groups:</p>
<ul>
<li>Execute before application start.</li>
<li>Or execute while application is already up and running.</li>
</ul>

lunanigra
<p>Defer long running script after application start. Expose DB upgrade invocation via private REST API or similar.</p>
<p>Your code and dev practice have to support n-1 version of DB schema. Eg: hide the feature that needs new column behind feature flag until schema upgrade fully rolled out.</p>
