I saw this pattern in multiple projects I wrote: I create an SQL model for a certain type of entities and at some point, we realize that there's a need to store multiples types of the same entities. Usually I introduce a "status" column to the table, because the type is mutually exclusive. For example, person
can be "dead" or "alive", chat_message
can be "to_send", "sent", "to_edit", "to_delete" and "deleted".
The problem is, when I introduce such a column, I need to re-trace all of the queries I made and consider whether it's still valid for all statuses - otherwise I'd need to specify it in the query. It's very easy to introduce a bug at this point, which makes me wonder: is it a common pattern in software engineering? Which approaches would help me avoid it?
If it wasn't for database normalization, my perfect solution would be to copy the schema of the SQL table for each possible value of the "status" field. For instance, when I need to introduce "status" to "people", I would drop the "people" table and instead create variants for "alive people" and "dead people". I don't think I ever saw this kind of solution though and it feels like tech debt to me. What other options do I have?