Migrations

Migrations allow you to modify the data model and database. Details and examples are online. Making a change requires the following steps:

  1. Creating a new migration
  2. Example: rails generate migration MyNewMigration

    Note: Instead of the name MyNewMigration, use a descriptive name to describe your change.

    If you just want to add a new attribute, this command will allow you to skip the next step: rails generate migration add_fieldname_to_tablename fieldname:string. Of course, you will need to substitute in your own fieldname (attribute name), table name and attribute type.

  3. Edit the migration file found in the db/migrate folder. Commands for modifying the database are online.
  4. Enter the rake command: rake db:migrate