Prev | Current Page 140 | Next

Kevin Marshall, Chad Pytel, and Jon Yurek

"Pro Active Record: Databases with Ruby and Rails"


Finally, executing a migration will create (or update depending on the project life cycle)
a table in your database called schema_info that contains the number of the latest run migration
file. The schema_info table is used to determine which migration script to start with the
next time you run a migration process as well as what number to prepend to any new migration
scripts.
CHAPTER 3 ?–  SETTING UP YOUR DATABASE 49
?– Note You should always be able to run your migrations back and forth from version zero to wherever you
are at any time. It??™s not mandatory to be able to do that, but it??™s sound migration practice, because it lets you
make sure your database is in a sane state at all times. If you can??™t bring your database from migration zero
to your latest state, then migrations really haven??™t allowed you to automate or simplify the management of
your database schema. Therefore, you should avoid using model class names inside migration files, because
if you remove one of those classes later on, you won??™t be able to do a clean migration from zero forward.


Pages:
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152