Replies: 2 comments 3 replies
-
|
https://github.com/yiisoft/yii2/blob/master/framework/UPGRADE.md#upgrade-from-yii-2050 What else needs to be added? Is it in Upgrade.md? |
Beta Was this translation helpful? Give feedback.
3 replies
-
|
I agree that this solution isn't great regarding backwards-compatibility. Thanks for docs pull request. Merged it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
TL;DR: In my opinion, changes to migration logic should be considered breaking changes.
Background/Why this came up
For some background, we ran into a problem where on our intern's system, inserting a record into a table with a JSON column behaved differently than on everyone else's machines. The reason for this is that we created their system after updating to Yii2 2.0.50, which has this little line hiding in the changelog:
By adding this support, migrations that create a column as
SchemaBuilderTrait::json()no longer just create aLONGTEXTcolumn, but instead also add ajson_validconstraint to it; In turn, when parsing the column schema, Yii2 starts treating the column as a JSON column, which changes how it (de-)serializes values (seeyii\db\mysql\ColumnSchema::dbTypecast).The problem/My suggestion
This means that any system created by running
php yii migratebefore the update to 2.0.50, which is most of our development and productive systems, behaves differently to systems created after the update. We now have to go back and change all our migrations where we usedjsonto instead usetextso that a newly created development system actually matches our productive one.To avoid problems like this coming up again, future migration code changes should either be declared breaking changes or use some kind of versioning mechanism (e.g. via optional parameters that default to the old configuration).
Beta Was this translation helpful? Give feedback.
All reactions