Correct approach to solve this issue?

I want to change the atribute own_any_ngo_allowed from NGOQuotasForm class in un/modules/registration/forms.py to accept 3 values: Allowed, Inherited and Not Allowed.

At present, that attribute accepts a boolean and uses a switch widget to select between values.
I want to solve this, but I have two approaches and I’m not sure about how to proceed:

  • First approach: Change that column in the database to accept nulls and consider the null value as the inherited. That approach needs to adapt indico.web.forms.widgets.SwitchWidget to accept 3 values.

  • Second approach: Use an enum. This approach can appear simpler, but It has lot of problems on the backend, because the column accepts boolean values and boolean can’t be casted to enum in a migration, so I would need to create a new column, copy the values as enum, and overwrite the previous column.

What would you do and why? Do you think a 3-values-boolean is contraintuitive or that the process to create that new column can create inconsistencies in the database?

I’d say a nullable boolean column is the easiest option, and it uses the way SQL NULLs are meant to be used: to indicate “no value”. So the only part that’s kind of implicit it the interpretation of NULL meaning “inheriting”.