You are here: Home Solidarrow Ruby on Rails Solidarrow Cheatsheets

* Rails Migrations Cheatsheet

Up and down methods, rake tasks, column mapping, loading fixtures, example migration file, all packed onto one A4 page for an easy at-a-glance reference. Updated for Rails 2.1

Indexes

add_index

Creates an index for the specified column.

    add_index :table_name, :column_name, :unique => true

remove_index

Remove an index from the specified column.

    remove_index :table_name, :column_name



 

 

> RELATED ARTICLE

* New in Rails 2.0: Sexy Migrations

A look at the new features and syntax available in migrations on Rails 2.0 > More

 

> RELATED ARTICLE

* Auto migrations

A brilliant plugin that makes changing your database schema even easier and faster. > More