Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Showing a Rails migration bug
Ruby JavaScript CoffeeScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app
config
db
doc
lib
log
public
script
test
vendor
.gitignore
.rvmrc
Gemfile
Gemfile.lock
README.rdoc
Rakefile
config.ru

README.rdoc

Migration bug

This is to demonstrate a bug in Rails migration, which causes newly added columns to not update.

Preparation for database:

  1. rake db:migrate

  2. rake db:seed

  3. rake db:rollback STEP=3

Now we have the item table in an initial state with data.

Step to produce error

  1. rake db:migrate

This would run the 3 migrations which causes the bug. Now you would see that the mode column is not updated

As a comparison, do the following:

  1. rake db:rollback STEP=3

  2. Change just_lookup.rb to be an empty migration OR add Item.reset_column_information at the end of that migration

  3. rake db:migrate

You would now see that the mode column is filled with values.

This shows just_lookup.rb should be related to the bug, and reset_column_information is not called for every migrations.

Something went wrong with that request. Please try again.