I’ve been through several posts now trying to find out whether this is a good or bad practice.
This discussion states that it would be a violation to the database design, but I don’t know how to prevent this, probably due the lack of knowledge.
The model that I am trying to build is to store laws from my country. All of them bear the same structure with one exception, that would be the paragraph that I must specify whether it is unique or not.
In here another question arouses, that is due the text in the law device. Since I’ll be storing several item texts, should I add it in one table, something similar to a law_device_log, or should I spread it across tables? My concern here is due the size and the performance to search later. The number of log can easily go over millions and I have to search over text later.
My current structure, which was why I was asking about the polymorphism, is incomplete still, but is the image below:
The artigo, paragrafo, inciso, alinea and item are all dispositivos (law devices), they all carry the same information, even the log, rubrica and pena as you can see, linked to the dispositivo atm.
Which approach should I use in here for this kind of scenario? Is the polymorphism the best approach or should I use an intermediate table for all of them?