0Pricing
Ruby Academy · Lesson

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.

All lessons in this course

  1. Active Record Basics
  2. Migrations
  3. Associations
  4. Validations and Queries
← Back to Ruby Academy