Let's say I have the following tables:
table_a
id | col_1 | col_2 | col_3
In table_a, id is the primary key
table_b
id | col_1 | col_2 | col_3
In table_b, id is the primary key
table_c
id | col_1 | col_2 | col_3 | entity_id | entity_table
In table_c, id is the primary key, entity_id is the foreign key to either table_a or table_b and entity_table can take either table_a or table_b.
Now let's extrapolate this and say we have 10 different tables which entity_id can have foreign keys to.
What I'm trying to do is have the entity_id link to the specific table based on the entity_table column, which gives the table name.
I've done some research and it seems that we cannot really. have multiple foreign keys on a single column to multiple tables. How can I go about this and what would a good solution look like?