List:General Discussion« Previous MessageNext Message »
From:Johan De Meersman Date:November 10 2009 8:38am
Subject:Re: Cross-table constraint
View as plain text  
I think triggers are your only option, here.

On 11/9/09, Sebastiaan van Erk <sebster@stripped> wrote:
> Hi,
>
> I have the following model:
>
> Domain (*)<-(1) Account (*)<-(1) User
>
> That is, each user belongs to exactly 1 account, an account can have
> multiple users; each account belongs to a single domain, and a domain
> can have multiple accounts.
>
> A user has an email address, which must be unique across the domain
> (since it's used to log into that domain: on login you select the domain
> and then enter your email and password).
>
> However, the email address need *not* be unique across different
> domains. Thus, I want the following combination to be unique:
>
> (Domain.id, User.email)
>
> Is there any way I can do this without duplicating the domain id in the
> User table?
>
> Regards,
> Sebastiaan
>
Thread
Cross-table constraintSebastiaan van Erk9 Nov
  • Re: Cross-table constraintJohan De Meersman10 Nov