Added documentation for #1904
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2157 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
3c3d936f4d
commit
9053c4c83e
@ -120,6 +120,21 @@ class IrreversibleMigration < ActiveRecordError#:nodoc:
|
|||||||
# execute "ALTER TABLE `pages_linked_pages` DROP INDEX `page_id_linked_page_id`"
|
# execute "ALTER TABLE `pages_linked_pages` DROP INDEX `page_id_linked_page_id`"
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
|
#
|
||||||
|
# == Using the class after changing table
|
||||||
|
#
|
||||||
|
# Some times you'll want to add a column in a migration and populate it immediately after. In that case, you'll need
|
||||||
|
# to make a call to Base#reset_column_information in order to ensure that the class has the latest column data from
|
||||||
|
# after the new column was added. Example:
|
||||||
|
#
|
||||||
|
# class MakeJoinUnique < ActiveRecord::Migration
|
||||||
|
# def self.up
|
||||||
|
# add_column :people, :salary, :integer
|
||||||
|
# Person.find(:all).each do |p|
|
||||||
|
# p.salary = SalaryCalculator.compute(p)
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
class Migration
|
class Migration
|
||||||
class << self
|
class << self
|
||||||
def up() end
|
def up() end
|
||||||
|
Loading…
Reference in New Issue
Block a user