On Sep 21, 2007, at 4:32 PM, Rick Widmer wrote:

I think we'll get better domain alias support if you pull column `domain` out of table `Domains` and add it to the table `domain_alias`.

"Domain name" to "domain on the system" is a many to one relationship, so the name should be in a separate table. I'm not sure we need to have a "master" and "alias" -- the names can all be equal with this setup.

I mention it because it reduces lookups to a single query (or at least a simpler query). Instead of needing to check for the domain name in one of two tables, you just check one.

Apologies if this SQL has any MySQL-flavored syntax...

SELECT `user`.`password`, `user`.`flags`
FROM `domain_name`, `domain`, `users`
WHERE `domain_name`.`domain_id` = `domain`.`domain_id`
AND `user`.`domain_id` = `domain`.`domain_id`
AND `domain_name`.`name` = '%s' AND `user`.`name` = '%s'

You might even want to have the limits fields go into a separate table, with one entry in that table declared "default". That way, domains with default entries can all point to that single row in the limits table.

Tom Collins  -  [EMAIL PROTECTED]
Vpopmail - virtual domains for qmail: http://vpopmail.sf.net/
QmailAdmin - web interface for Vpopmail: http://qmailadmin.sf.net/

Reply via email to