Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lulalala/migration-bug

Showing a Rails migration bug
https://github.com/lulalala/migration-bug

Last synced: 9 days ago
JSON representation

Showing a Rails migration bug

Awesome Lists containing this project

README

        

== 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

4. 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:

5. rake db:rollback STEP=3

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

7. 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.