I don’t know how you’re gonna repurpose the existing address. My experience is that this works better on paper than in practice, but it was just a supplementary comment.
What you can do is use immutability. So register an address that will have one id
somehow it can be used by other entities. So far I think it’s ok. When you need to change from one of these entities, the application will not write to the existing line where the data was read, it will create a new line with the changed data.
Then think what happens if you have to change the address and the change has to be applied to everyone who points to this address. How do I fix this? I have no idea. Will you let the user decide? It doesn’t usually work, they always get it wrong. What if it has to change at some points but not at others? Confusing is not?
Then it is likely to start to proliferate new lines where they should not. Of course it may be that you need it. On the other hand, if an address is linked to a service, then it should never be changed. This usually occurs on a bill by law. If by chance the address is wrong you have to use a correction of the address, you can not just go there and change the existing one, it is immutable.
In this case it might be interesting:
- The address is registered for the first time in the applicant;
- the service is created and uses the same address (
id
) that is in the applicant’s register;
- when the requester changes the address, does the immutable scheme I talked about and creates a new address for it (changes the note on the requester’s foreign key), but does not affect others who are using that address;
- the service is prohibited from changing the address. This means that if there is change it needs to be a rectification or the service is actually another (in some case it can be relaxed).
I did not understand the function of the point there. But if it has no relationship with others, it does not matter, I just found it strange to be in the description of the question.
Readings that may help (or complicate :) ):
What is the point? Is there any reason for the service to have an address, not just have the requester? It seems to me that deep down the addresses are not the same, they can be coincidentally the same, which is not enough for the use. How you determine how to take advantage of the same address?
– Maniero
@bigown The reason why the 'Service' has one address and the 'Requester' another, is that the address of the service, will not always be equal to the address of the requester. Point is a place, a piece of street, which is identified by the address. This has no relation to the service or requester.
– Victor Soares
About the use, I haven’t decided yet how to do. I just find it strange to keep several equal records in the address table. I don’t know if I change the modeling to another, or if I create some algorithm to control it.
– Victor Soares