Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamic contact information data/design pattern: Is this in any way feasible?
    primarykey
    data
    text
    <p>I'm currently working on a web business application that has many entities (people,organizations) with lots of contact information ie. multiple postal addresses, email addresses, phone numbers etc. </p> <p>At the moment the database schema is such that persons table has postal address columns, phone number columns as does organizations table. This is not a good way to handle this.</p> <p>I've read the c2 Wiki on this and there's some good discussion regarding <a href="http://c2.com/cgi-bin/wiki?ContactAndAddressModels" rel="nofollow noreferrer">Contact and address models (<a href="http://c2.com/cgi-bin/wiki?ContactAndAddressModels" rel="nofollow noreferrer">http://c2.com/cgi-bin/wiki?ContactAndAddressModels</a>)</a> and wheter or not <a href="http://c2.com/cgi-bin/wiki?ArePhysicalPostalAddressesArchaic" rel="nofollow noreferrer">physical addresses are archaic (<a href="http://c2.com/cgi-bin/wiki?ArePhysicalPostalAddressesArchaic" rel="nofollow noreferrer">http://c2.com/cgi-bin/wiki?ArePhysicalPostalAddressesArchaic</a>)</a>. These two discussions really opened my eyes on the scope of this problem.</p> <p>I'm thinking about separating <b>contact information fields to separate table(s)</b>. But what's the best way to do this. At the moment the application mainly handles Finnish addresses but it's on the horizon that it needs also to handle international addresses. </p> <p>I could define an "addresses" -table, a "phone numbers" -table, an "email addresses" -table and so on and these would be linked to people and organizations. But this just feels too much like the previous solution: it's inevitable that the predefined database schema isn't sufficient.</p> <p>What I'm proposing is to create a contact information schema/program logic that is <b>dynamic</b>:</p> <ul> <li>There are no predefined contact information fields/field sets</li> <li>Users can define new contact information types and required fields at any time like <ul> <li>Finnish postal address</li> <li>Swedish postal address</li> <li>... postal address</li> <li>Phone number</li> <li>Email address</li> <li>ICQ-number</li> </ul> </li> </ul> <p><b>Is this feasible?</b> Has anyone done anything like this? </p> <p>There could be a table that defines contact information types:</p> <h3>contact information types</h3> <ul> <li>Id: Identifier</li> <li>Name: "Finnish postal address"</li> <li>Description: "Use this contact information type for finnish postal addresses"</li> </ul> <p><br/> Then there could be a table that defines what fields are used per contact information type:</p> <h3>contact information type fields</h3> <ul> <li>Id: Identifier</li> <li>Contact_information_type_id: References the previous table</li> <li>Field title: "Address line 1"</li> <li>Field description: "Use this line for postal addresses' first line"</li> <li>Field type: String/Integer/etc.</li> <li>Field format: Regular expression for validating field data</li> <li>Field order: In which order should this field appear when displaying/using this contact information type</li> </ul> <p><br/> Then we'd have a "contact information table" that just is used to map contact information fields together:</p> <h3>contact information</h3> <p><ul> <li>Id: Identifier</li> <li>Contact_information_type_id: References the contact information type table</li> </ul></p> <p><br/> Then we'd have a "contact information of person" -table mapping different contact information to persons:</p> <h3>contact information of person</h3> <ul> <li>Id: Identifier</li> <li>Contact_information_id: References the contact information table</li> <li>Person id: References the person</li> </ul> <p><br/> Then we'd need tables per contact information field type like:</p> <h3>contact information integer fields</h3> <p><li>Id: Identifier</li> <li>Contact_information_id: References the contact information table</li> <li>Value: The value of this field</li> <br/></p> <p>and so on for strings etc...</p> <p>Finally when displaying different contact information of a given person this would happen through <b>person's contact information</b> -table whis looks up what fields are used to form this contact information from <b>contact information type fields</b> -table through <b>contact information</b> -table. After determining what fields are used all the necessary tables would be joined together.</p> <p>I'm having doubts about the feasibility of in SQL. Any thoughts?</p> <p>In Java I probably could program some logic to determine what tables are neede to form a contact information entity and then i could use some sort of dynamic beans to represent this data in Java. But that's a bit foggy to me too. Anyt thoughts on this too?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload