-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Existing instances are not updated if property (True/false) with default true is added to existing documenttype #9649
Comments
Hey @waldvmar please excuse my brevity, I'm in my phone so typing is slooooow. Long story short, this is the expected behaviour. There are other issues here explaining it in better detail, but it's along the lines of the default value belonging to the data type, not to all properties of that type. When the node is rendered in the backoffice, the property will have the default value set from the data type, hence why it's necessary to save and publish to see the property value updated in the database. @nul800sebastiaan might be able to link us to the other discussions, and also expand on my explanation. |
Hej @nathanwoulfe Okay, I see the case. But wouldn't it be nice to extend the true/false datatype with a property where it can be enabled that if a property of that datatype is added to a documenttype that the existing content instances of that documenttype are getting updated? The use case is the following: |
Any datatype that has a default value will never update any content in case you change the default value. This is done for a few reasons, first, this could be a very heavy database operation, depending on the amount of content already using this datatype. We also can't determine if that is what you wanted to happen, maybe your business rule is that from now on the new default value should be used. So changing the behavior now would be a functional breaking change. We do want to change this behavior, but it is not an easy change, we've made a proposal over here: #7859 While this doesn't directly address your feature request here, it is now linked to that issue so this can be taken into consideration as well. In your case, right now, you are left with two options: either go in manually and save & publish all required items again or write a bit of code to set and publish the required values. |
If I add a new property of type True/false with Default value True to an existing documenttype and there are already existing instances of this documenttype, the value of that property on those existing instances is not set to the default value true in the database. So it's required to get all instances of this documenttype, set the value and save and publish it then again.
Umbraco version
I am seeing this issue on Umbraco version: 8
Reproduction
If you're filing a bug, please describe how to reproduce it. Include as much
relevant information as possible, such as:
Bug summary
If I add a new property of type True/false with Default value True to an existing documenttype and there are already existing instances of this documenttype, the value of that property on those existing instances is not set to the default value true in the database. So it's required to get all instances of this documenttype, set the value and save and publish it then again.
Specifics
Steps to reproduce
Expected result
If a property of type True/False with Default-Value True is added to an existing documenttype, all instances of this type should be updated with the new property and the value True.
Actual result
The text was updated successfully, but these errors were encountered: