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
add_column "people", "type_typos", :bool
remove_column "people", "type_typos"
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
This commit add tests for this issue and runs rake test_sqlite3 without error.