I have tables in which some fields can be changed by a user via a form.
The form is presented as a fact sheet on one person: some fields are read-only, others are editable, others may have a multiple value.
In database, this means that these fields can be:
- a text field in the line of the & # 39; person & # 39; in the table & # 39; person & # 39;
- a foreign key in the line of the & # 39; person & # 39; (a
FULL, or more if the key is composed of several columns)
- a new line in an associative table between & # 39; person & # 39; and another table
I can change the person so that she now has a different status, works in another company, speaks a different language.
This implies knowing for each field what columns or lines I need to edit in the database …
As I want to do that genericallyI have a table listing all the editable fields.
My idea is to put in a table the way to access / modify the value.
I first thought about entering the names of the tables and columns containing the data, but that does not handle the case when the value is in a (new) line (multi-valued property causing the data to appear in the (new) line). use of an associative table).
I do not know how to do this without making the process unnecessarily complex (it can be moved to the application layer as needed, but I would be a little disappointed).
What bothers me most is that rows can have multiple columns as the primary key, so I do not know how to reference them generically.
How can I store the information that tells me, for each field, how to edit them in my database, without being too complex?
I use MySQL 5.7.