You are previewing The Rails™ 3 Way, Second Edition.

The Rails™ 3 Way, Second Edition

Cover of The Rails™ 3 Way, Second Edition by Obie Fernandez Published by Addison-Wesley Professional
O'Reilly logo

Chapter 6. Active Record Migrations

Baby step to four o’clock. Baby step to four o’clock.

—Bob Wiley, in the movie What About Bob (Touchstone Pictures, 1991)

It’s a fact of life that the database schema of your application will evolve over the course of development. Tables are added, names of columns are changed, things are dropped—you get the picture. Without strict conventions and process discipline for the application developers to follow, keeping the database schema in proper lock-step with application code is traditionally a very troublesome job.

Migrations are the Rails way of helping you to evolve the database schema of your application (also known as its DDL) without having to drop and re-create the database each time you make a change. ...

The best content for your career. Discover unlimited learning on demand for around $1/day.