From f1880cac5862172608ff26d1178a31c05b904d77 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 5 Jul 2005 07:19:20 +0000 Subject: 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 --- activerecord/lib/active_record/migration.rb | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'activerecord/lib/active_record/migration.rb') 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 # - # * create_table(name, options = "") 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 + # * create_table(name, options) 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. # * drop_table(name): Drops the table called +name+. - # * add_column(table_name, column_name, type, options = {}): Adds a new column to the table called +table_name+ + # * add_column(table_name, column_name, type, options): 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 }. + # * rename_column(table_name, column_name, new_column_name): Renames a column but keeps the type and content. + # * change_column(table_name, column_name, type, options): Changes the column to a different type using the same + # parameters as add_column. # * remove_column(table_name, column_name): Removes the column named +column_name+ from the table called +table_name+. + # * add_index(table_name, column_name): Add a new index with the name of the column on the column. + # * remove_index(table_name, column_name): 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 IrreversibleMigration exception in their +down+ method. # + # == Running migrations from within Rails + # + # The Rails package has support for migrations with the script/generate migration my_new_migration command and + # with the rake migrate 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. -- cgit v1.2.3