Re: one-to-one schema design question and ORM

From: alexander krohn <ak(at)e-dict(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: one-to-one schema design question and ORM
Date: 2007-03-13 14:33:34
Message-ID: 45F6B63E.9010600@e-dict.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi.

Rick Schumeyer wrote:
> [...]
> From a business rules perspective:
> Some users are not employees (like an admin user)
> Some employees are not users
> [...]
from my view users and employees have something in common: they are persons.

why don't create a person-table with the attributes the groups share, like a
login-name, etc.

then your users-table will have a primary-key that is also a foreign-key,
referencing the id in the person-table and the employees-table does the same.

when you want to get all user- and employee-accounts for one person you have to
build up a join on the tables. that's a simple view, don't know what your
favourite or-mapper thinks about it.

i think the above table-design can be considered 'clean' from some academic
point of view ;)

mfg

alexander

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sim Zacks 2007-03-13 14:36:50 Re: insert rule instead oddity
Previous Message Erik Jones 2007-03-13 14:30:10 Re: Tracking disk writes? (again) & bgwriter