diff options
author | Prem Sichanugrist <s@sikac.hu> | 2015-05-04 16:11:15 -0400 |
---|---|---|
committer | Prem Sichanugrist <s@sikac.hu> | 2015-06-26 16:25:13 -0400 |
commit | a4128725f5a2c6cbf3e963e2b78ba9382732728a (patch) | |
tree | 6702300b290791a2dfea1377bf8db6338db3c35b /activerecord/CHANGELOG.md | |
parent | 0bee4100f10dec672b70ad63856149c85d8cbc95 (diff) | |
download | rails-a4128725f5a2c6cbf3e963e2b78ba9382732728a.tar.gz rails-a4128725f5a2c6cbf3e963e2b78ba9382732728a.tar.bz2 rails-a4128725f5a2c6cbf3e963e2b78ba9382732728a.zip |
Add reversible syntax for change_column_default
Passing `:from` and `:to` to `change_column_default` makes this command
reversible as user has defined its previous state.
So, instead of having the migration command as:
change_column_default(:posts, :state, "draft")
They can write it as:
change_column_default(:posts, :state, from: nil, to: "draft")
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r-- | activerecord/CHANGELOG.md | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index d87e609956..794bb779fa 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,15 @@ +* Add alternate syntax to make `change_column_default` reversible. + + User can pass in `:from` and `:to` to make `change_column_default` command + become reversible. + + Example: + + change_column_default :posts, :status, from: nil, to: "draft" + change_column_default :users, authorized, from: true, to: false + + *Prem Sichanugrist* + * Prevent error when using `force_reload: true` on an unassigned polymorphic belongs_to association. |