Home
Ruby on Rails
Cheatsheets
Provides a block that enables you to alter columns on an existing table using various shortcut methods...
change_table :table_name, {options} do |t| t.change :column_name, :new_column_type t.remove :column_name end
Creates a table on the database. Creates a table called :table_name and makes the table object available to a block that can then add columns to it by specifying column_types or utilising shortcut methods such as using belongs_to to specify foreign keys...
create_table :table_name, {table_options} do |t| t.string :name, {column_options} end
{table_options}
|
|
|
if |
|
|
|
if |
|
|
|
if |
|
|
|
overrides the default name of |
|
|
|
pass raw options to your underlying database, e.g. |
Destroys the specified table.
drop_table :table_name
Renames the specified table.
rename_table :old_table_name, :new_table_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