rails/rails — pull request #3400 by greinacker (2011-10-21 23:40:53+00:00)
Title: sqlite3 adapter drops :decimal columns precision & scale when migration tries to alter them

After this change, decimal column attributes :precision and :scale will be preserved through migrations. Two tests included, specifically:

1. test that changing a decimal column type keeps the new attributes, and

2. test that if you already have a decimal column with precision/scale, that changing another column in the same table doesn't wipe out the precision and scale

Both tests fail on master, and pass with this patch.

In fairness, the code to fix this I got from https://gist.github.com/971639 - this was pulled from lighthouse (see issue #625), and I'm not entirely sure who wrote it originally. The tests are new.

Ref issues #3399, #625, #3073