aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/migration.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-07-05 07:19:20 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-07-05 07:19:20 +0000
commitf1880cac5862172608ff26d1178a31c05b904d77 (patch)
treeaab6bdf693ab0f7495e308a9813432938d95e040 /activerecord/lib/active_record/migration.rb
parent2418a68aa23c96ce20aae6168c71c760cb6e7809 (diff)
downloadrails-f1880cac5862172608ff26d1178a31c05b904d77.tar.gz
rails-f1880cac5862172608ff26d1178a31c05b904d77.tar.bz2
rails-f1880cac5862172608ff26d1178a31c05b904d77.zip
Sugared up migrations with even more bling #1609 [Tobias Luekte]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1697 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/migration.rb')
-rw-r--r--activerecord/lib/active_record/migration.rb17
1 files changed, 14 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb
index cb54d2b967..365f57f366 100644
--- a/activerecord/lib/active_record/migration.rb
+++ b/activerecord/lib/active_record/migration.rb
@@ -51,21 +51,32 @@ module ActiveRecord
#
# == Available transformations
#
- # * <tt>create_table(name, options = "")</tt> Creates a table called +name+ and makes the table object available to a block
- # that can then add columns to it, following the same format as add_column. See example above. The options string is for
+ # * <tt>create_table(name, options)</tt> Creates a table called +name+ and makes the table object available to a block
+ # that can then add columns to it, following the same format as add_column. See example above. The options hash is for
# fragments like "DEFAULT CHARSET=UTF-8" that are appended to the create table definition.
# * <tt>drop_table(name)</tt>: Drops the table called +name+.
- # * <tt>add_column(table_name, column_name, type, options = {})</tt>: Adds a new column to the table called +table_name+
+ # * <tt>add_column(table_name, column_name, type, options)</tt>: Adds a new column to the table called +table_name+
# named +column_name+ specified to be one of the following types:
# :string, :text, :integer, :float, :datetime, :timestamp, :time, :date, :binary, :boolean. A default value can be specified
# by passing an +options+ hash like { :default => 11 }.
+ # * <tt>rename_column(table_name, column_name, new_column_name)</tt>: Renames a column but keeps the type and content.
+ # * <tt>change_column(table_name, column_name, type, options)</tt>: Changes the column to a different type using the same
+ # parameters as add_column.
# * <tt>remove_column(table_name, column_name)</tt>: Removes the column named +column_name+ from the table called +table_name+.
+ # * <tt>add_index(table_name, column_name)</tt>: Add a new index with the name of the column on the column.
+ # * <tt>remove_index(table_name, column_name)</tt>: Remove the index called the same as the column.
#
# == Irreversible transformations
#
# Some transformations are destructive in a manner that cannot be reversed. Migrations of that kind should raise
# an <tt>IrreversibleMigration</tt> exception in their +down+ method.
#
+ # == Running migrations from within Rails
+ #
+ # The Rails package has support for migrations with the <tt>script/generate migration my_new_migration</tt> command and
+ # with the <tt>rake migrate</tt> command that'll run all the pending migrations. It'll even create the needed schema_info
+ # table automatically if it's missing.
+ #
# == Database support
#
# Migrations are currently only supported in MySQL and PostgreSQL.