Home
Ruby on Rails
Cheatsheets
Creates a new column on the specified table.
add_column :table_name, :column_name, :column_type, {column_options}
{column_options}
|
|
|
if |
|
|
|
set a limit on the size of the field |
|
|
|
set a default value for the column |
|
|
|
Specifies the precision for a |
|
|
|
Specifies the scale for a |
Change the data type of the specified column
change_column :table_name, :column_name, :new_column_type
Renames the specified column.
rename_column :table_name, :old_column_name, :new_column_name
Removes the specified column.
remove_column :table_name, :column_name
A look at the new features and syntax available in migrations on Rails 2.0
More
A brilliant plugin that makes changing your database schema even easier and faster.
More