Why migrations exist
Editing a live database by hand leaves no record, and the staging copy drifts from production. Migration tools such as Flyway, Liquibase, Rails migrations, Django migrations, Prisma Migrate and Alembic store each change in the repository, record which ones have run, and apply the missing ones on deploy.
Safe habits on live data
- Add before you remove: create the new column, deploy code that writes both, backfill old rows, then drop the old column in a later release.
- Avoid operations that lock a large table for long; some engines offer online alternatives.
- Test the migration on a copy of production-sized data.
- Take a backup first and decide how you would roll back; some changes, such as dropping a column, cannot be undone without a restore.
Related concept
Moving data between systems is a data migration, a different job. A schema migration changes the container, not the contents.
Questions, answered
Many teams do, but risky ones are run as a separate, watched step.
Many tools support a down script, though destructive changes cannot truly be undone.