This project is archived and is in readonly mode.
rename_column doesn't preserve default value on MySQL
-
Jeremy Kemper
- Milestone set to 2.1.1
- Assigned user set to Jeremy Kemper
- State changed from new to open
Talked about this in #rails-contrib:
- should raise ActiveRecordError instead of RuntimeError, and add a test for rename_column with a column that does not exist
- and test that a column with DEFAULT NULL is preserved also
-
Diego Algorta
Here's a new version of the patch. This one adds a new test for renaming nonexistent columns and raises ActiveRecordError in that case.
I realized the "unless default.nil?" was unnecessary so the extra test for that is unnecessary too. Because DEFAULT NULL is the default anyway. So using :default => nil is the same as not using it.
I squashed the changes into only one commit.
-
Diego Algorta
I mean... I DID add the test for the DEFAULT NULL case... but the current and the new code already passed that. So I thought it was unnecessary.
-
Diego Algorta
same patch, corrected my name and email.
-
Repository
- State changed from open to resolved
(from [2e1b56c93745bf0513e449e95830edd390abfaf2]) MySQL: rename_column preserves default values. [#466 state:resolved]
-
Repository
(from [9855d0b0800d92626aa19606628ed77042491984]) MySQL: rename_column preserves default values. [#466 state:resolved]
-
Rick
- Assigned user cleared.
- Milestone cleared.
- Tag set to 2.1, activerecord, bug, edge, patch, tested
Testing...
