U4-9394 - Change old legacy bool fields that are stored in the DB as 0/1's to DB native bools

Created by Pete Duncanson 16 Jan 2017, 12:30:09 Updated by Pete Duncanson 21 Aug 2018, 13:34:38

This folks is a non-essential item however for the long term it would be a good thing to do. I think some new devs coming to Umbraco might get a bad smell if they the see how it handles bools from the DB so should be a good thing to iron out for perception sake as well as consistency and even some performance gains too.

For legacy reasons (as confirmed by @hartvig) bools are stored as number field and only 0/1 being recognised values. In DB circles this is dirty as it wastes space and CPU cycles when there is a built in bool field in every DB Umbraco is compat with.

Internally to Umbraco it could be possible to replace the fields however it could cause a bunch of headaches if not careful/thought about:

  • Existing code, some folks will already have code that checks if a property is 0 or 1, this should be getting more and more rare though as GetPropertyValue handles the conversion to a bool for us and the bulk of templates should be using that (but some of the older stuff or less deverloper devs might be using the Dynamics and the build in UI fields etc. which don't use this).
  • Packages, pretty sure some packages check for 0's and 1's instead of true/false (well they would have to if they hit the DB directly)
  • Upgrades...I think you would have a hard time.

Give all the above I think this makes it a great case for doing with v8 when "breaking changes" are allowed/expected.

Can anyone else think of any reasons why we shouldn't do this?

Comments

Pete Duncanson 18 Dec 2017, 13:23:38

@zpqrtbnk is this on the cards for V8?


Pete Duncanson 21 Aug 2018, 13:34:38

@zpqrtbnk as above :)


Priority: Normal

Type: Feature (request)

State: Submitted

Assignee:

Difficulty: Normal

Category: Architecture

Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version:

Sprint:

Story Points:

Cycle: