[Vmail-discuss] Separate domain_alias table?

Chris Lightfoot chris at ex-parrot.com
Thu, 10 Jul 2003 20:31:31 +0100


On Thu, Jul 10, 2003 at 08:20:39PM +0100, Paul Makepeace wrote:
> On Thu, Jul 10, 2003 at 08:08:45PM +0100, Chris Lightfoot wrote:
> > On Thu, Jul 10, 2003 at 05:28:41PM +0100, Paul Makepeace wrote:
> > > Cons: can't map one domain to many. Semantically this isn't possible
> > > though, right?
> > 
> > Um. We allow that (one domain having many aliases). This
> > is quite useful when somebody has example.{com,org,net} or
> > whatever.
> 
> I meant in the other direction: one domain can't alias to multiple other
> "real" domains.

Ah, OK. My brain obviously isn't working....

> > I suspect that the correct way to do this would be:
> > 
> >     create table domain (
> >         id integer primary key,
> >         name varchar(255)
> >     );
> > 
> >     create table destination (
> >         domainid integer references domain.id,
> >         localpart varchar(255),
> >         type enum ( forwarder, popbox ),
> >         destination text,
> >         primary key (domainid, localpart)
> >     );
> 
> (Isn't this solving another problem?)

No, I think they're the same problem. E.g.:

    insert into domain (id, name) values (1, 'example.com');
    insert into domain (id, name) values (1, 'example.org');
    insert into domain (id, name) values (1, 'example.net');

    insert into destination (domainid, localpart, type, destination)
        values (1, 'fred', forwarder, 'fred@somewhere.else');

now creates fred as a destination in example.{com,org,net}.

I think this is a bit neater than the existing scheme.

> Paul, who is trying to decide whether to combine forwarder & popbox as
> above or keep them separate. For me, they're just on the edge of being
> sufficently different to keep them separate while yet remaining
> tantalisingly similar... At the moment I've created an "accounts" table
> which is simply localpart + domain_id and then have the other "forwards"
> and "mailboxes" tables reference the accounts. Who knows..

Hmm. From the Exim PoV, it doesn't matter, since you get
to specify different queries for forwarding and delivery.
But there may be other reasons to choose one or two
tables.


-- 
The ship sank, the South lost and the sled got tossed in the fire.
Get over it.