List:General Discussion« Previous MessageNext Message »
From:Sebastiaan van Erk Date:November 9 2009 9:55pm
Subject:Cross-table constraint
View as plain text  
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

Attachment: [application/x-pkcs7-signature] S/MIME Cryptographic Signature smime.p7s
Thread
Cross-table constraintSebastiaan van Erk9 Nov
  • Re: Cross-table constraintJohan De Meersman10 Nov