We are creating the ability for users to name certain fields on our front end under their account, but what this means is these fields can not be set columns data name is not set and is specific to the customers accounts. Could we use generated columns to do this? or is there a better way that I might be overlooking?
I would explore the path of creating a column of the
JSON type to store the information about the field names and the corresponding values. For example, the value in the column could look like this:
"fieldName" : "age",
"fieldName" : "phoneNumber",
"value" : "555-1212"
Notice that the
phoneNumber field has a value, while
age does not. To free the frontend from knowing how to format and parse that JSON, you could either create an API service that works with the user’s data or rely on the before/after handlers for parsing and formatting this metadata (and data).