Handling database migrations during deployment means using a version-controlled migration tool to apply incremental, repeatable schema changes as part of the CI/CD pipeline, rather than running ad-hoc SQL by hand.
A team adds a new nullable column via a Flyway script named V12__add_last_login_column.sql; the pipeline runs flyway migrate before the new app version starts, and Flyway records that version 12 has been applied so it never runs twice.
-- V12__add_last_login_column.sql
ALTER TABLE users ADD COLUMN last_login TIMESTAMP NULL;A concise interview answer is
I use a migration tool like Flyway or Liquibase, checked into the repo, so schema changes are versioned and applied automatically as a pipeline step. I write migrations to be backward-compatible during rolling deploys and keep rollback scripts ready in case something goes wrong.
Last updated: 16 July 2026
Previous question: Describe a situation where you had to automate the deployment process for a microservices architecture.
Next question: Your application requires zero downtime during deployment. What strategies would you use to achieve this?