I’m thinking about an idea.
It arose when I decided to move to postgresql.
I had problems with my enum values. Postresql does not have such a data type.
Then I gooogled a bit and one reason was that “enumerated data types are common for bad database design”. What!?
Ok. Nevermind, in fact MySQL has to have it stored somewhere in some table.
So I created one “generic” table for constants that contains constant’s name, description, localized stuff. And one inherited table for each enumerated type I need. Then I replaced enumerated attributes with foreign keys to those inherited special tables.
The result is superb, functional, but something is missing.
In LER only valid values can be used for enumerated data types. And maybe in some future release TDM could convert valid values into ENUM fields in MySQL. ANd fot other types it supports CHECK constraints already. And a third option could be automated eneration of such tables. What for ? Creating status data fields is a part of database design. Check constraints are good, but impossible to manage/alter from application perspective once the design is set.
In Valid values tab (data type, domain) there could be a combo box with list of “constants tables” similar to categories. These tables could be managed similar to domains, categories from “model” application menu.
And for each constants table there could be defined a master table. Ofcourse it douesn’t have to be called tables there in LER. More like “constants domains” and “constants master domains”.
To further improve it, we could make out them “constant settings/schemes”.
Then the scheme would include options if we want to generate ENUM data type (in MYSQL only), or CHECK constraint (everything except mysql), or constant’s table inherited or not inherited from master constant’s table. The choice would be similar to entity inheritance in LER.
I’m creatin web applications with lots of status data types. Those types are common to be changed in the future. I don’t use groups/users/categories, but this could come in handy.