Chapter 10. Managing Databases with Migrations
Migrations might seem strange at first, but over time theyâll become a very ordinary part of your work, whether you generate them automatically or customize them by hand. Railsâ approach to managing data structures is very different from the traditional separation of database design from programming. While Rails still maintains a separate toolkit for defining data structures, that toolkit attempts to improve on the traditional SQL Data Definition Language (DDL) by wrapping DDL in Ruby code.
Migrations are something of a world of their own in the Rails environment, but they are still recognizably Rails, built into the same development process. Migrations are all written in Ruby code, using a fairly small set of conventions. This book has used migrations throughoutâyou can write much of a Rails application without themâbut until the last chapter (and then only once), those migrations were generated using Railsâ inventive scripts. Once you move past those scripts, migrations are a little more difficult, but still not that complicated.
Note
The details of migrations may not be your first priority. You can safely skip this chapter and come back to it if database and data structure management seem like good reading for a really rainy day.
What Migrations Offer You
Migrations are part of Railsâ general effort to separate developers from direct contact with databases. From a Rails perspective, databases are kind of a âgiant hash ...
Get Learning Rails 3 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.