When Migrations Go Bad

Learn about the downside of migrations.

Overview

Migrations suffer from one serious problem. The underlying DDL statements that update the database schema are not transactional. This isn’t exclusively a failing in Rails, though, as most databases don’t support the rolling back of create table, alter table, and other DDL statements.

Let’s look at a migration that tries to add two tables to a database:

Get hands-on with 1200+ tech skills courses.