2
I have a table cad_address
with the registration of the address of my users. I also have another order table mov_order
that has a key Foreign address_id
to the address table, responsible for the relationship.
The problem is that when the guy updates the address, he also updates the order address (because of the relationship). Because of this, we are creating a "snapshot" of the address in the order table, with all the address data, now also in the order (a replica).
Now in the order status we will no longer search the customer’s address by relationship, and yes, directly in the order table, having then the address that was registered at the time of purchase. We take advantage of Foreign key address_id
, to migrate customer address data to the order table.
However, we feel now that the order table has become a little dirty. The fact is, we have a column address_id
, setting up a relationship that’s not being used for anything. And this relationship can confuse developers, not to mention, that can open a gap for someone to do a little 'shit', call a relationship that is no longer being used...
The question is: Is it right to remove this column? Or should it be maintained?
Is the problem after all with Laravel? If it’s not, I’m going to take the tags off, to make it easier to relate the issues. It seems to me to be more a simple database issue, I think even PHP should not be as tag.
– Wallace Maxters
The Laravel is related to the fact that I am using the Laravel Migrations system to make the migrations, and their resources are somewhat limited. That’s why I attacked the tags
– Felipe Mathais
The system uses Migrations, but the question says nothing about Laravel’s Migration. You use tags only to highlight the subject of the question, not what you use in development. I also confuse this point.
– Wallace Maxters
Got it! Thanks for the guidance, and sorry for anything.
– Felipe Mathais
It’s all right, I confuse that too.
– Wallace Maxters