Migrations
Evolving the schema.
What Is a Migration?
A migration is a versioned Ruby file that describes a change to your database schema, such as creating a table or adding a column.
- Migrations are code, so they live in version control.
- Everyone on the team applies the same changes in the same order.
- You never edit the database by hand.
Generating a Migration
Rails generates migration files for you. For example rails generate migration CreateUsers creates a timestamped file in db/migrate/. The timestamp fixes the order in which migrations run.