rails/rails — pull request #7954 by elthariel (2012-10-15 12:34:10+00:00)
Title: Adds an :unknown column type.

Trying to fix an "issue" where an unnoticed typo in the type parameter
of a migration could lead to data loss.

Using this example :

class PeopleWriteBuggyMigrations < ActiveRecord::Migration
def self.up
add_column "people", "type_typos", :bool
end

def self.down
remove_column "people", "type_typos"
end
end

This migration will run fine and without warning(s), but if you try to
remove this column later, active record would fail :
- SQLite cannot directly drop a column, so a temp table is used.
- AR then tries to create a temp table with the same structure.
- the #simplified_type method of the Column class is called at some point
- since the type doesn't exists it returns nil
- migration fails in a very ugly fashion.
- user has to fix it manually (dangerous and time comsuming) but will
be tempted to fix the faulty migration, drop the db and migrate
again.

This commit add tests for this issue and runs rake test_sqlite3 without error.

This is my first rails pull request, so i hope althought i read the guidelines i didn't make too big mistakes. I would really enjoy getting comments on this PR.

Thanks lovely community.