when i create a new enum it will set all records to the default, every single one of them. it should just set it as null
adding a new enum sets historical data
Collapse
This topic is closed.
X
X
-
setting historical data a major con, and the fact that it isn't documented is also another con, if your going to make non standard behavior you should at least document it, though the best would be a check box to toggle the behaviorComment
-
It's how databases have been always working. The default value populates existing records if a null is not allowed. The application does not do it, it's the behavior of the database. Calling it a non-standard behavior is a moot point. It's already added to the docs, no need to re-iterate the same.Comment
-
but its not an normal enum its a text field with limited options still very annoying that it automatically sets historical data, if it really was an enum in the db i could see the argument but it isn't so there is no reason to go and set all the historical data and give no option to not set it,
so when you set a text filed does it also set the default in all historical data?Comment
-
The solution was suggested. It's not a hack, it's a logical solution. You can set the field required so that users are not able to save the field with an empty value.
If one added by a mistake and it populated unwanted values, just remove the field and run hard rebuild. The column will be dropped.
---
Example 1.
Options:
- No
- Yes
Default: No
When we create such a field, it sets for the column: Default = 'No'. The DB automatically populates the 'No' value. The records are automatically in a valid state. Null would have been an invalid domain value, as null is not in options.
Example 2.
Options:
- Empty
- No
- Yes
Default: Empty
When we create such a field, the DB sets all existing records to null.
---
> so there is no reason to go and set all the historical data and give no option to not set it
I'll re-iterate. We do not "go and set all historical data". We don't have such a logic. It's the behavior of the database. You should rather argue with the creators of the database systems.
While there might no reasons for you, there can be reasons for some, there where cases where this was a desired behavior. The field is automatically in a valid state for all existing records. I prefer to not to participate in discussions where absolutist argumentation such as "so there is no reason" based on a not strong logic is used.
You can always modify the source code as it's open source and free software.Comment

Comment