[Postfixadmin-devel] Add unique index on table domain_admins?
Brought to you by:
christian_boltz,
gingerdog
From: Zhang H. <zhb...@gm...> - 2011-02-13 19:10:52
|
Hi, developers. I'm using PostfixAdmin-2.3.2, the default structure of table 'domain_admins' in upgrade.php is: CREATE TABLE {IF_NOT_EXISTS} $domain_admins ( `username` varchar(255) NOT NULL default '', `domain` varchar(255) NOT NULL default '', `created` datetime NOT NULL default '0000-00-00 00:00:00', `active` tinyint(1) NOT NULL default '1', KEY username (`username`) ) {MYISAM} COMMENT='Postfix Admin - Domain Admins';"; I was wondering why not add a unique key to avoid duplicate records? for example: PRIMARY KEY (username, domain) Otherwise we can insert duplicate records like below: INSERT INTO domain_admins (username, domain) values ('ad...@do...d', 'domain.ltd'); INSERT INTO domain_admins (username, domain) values ('ad...@do...d', 'domain.ltd'); INSERT INTO domain_admins (username, domain) values ('ad...@do...d', 'domain.ltd'); P.S. i post this in forum on Jan 27, no response yet. http://sourceforge.net/projects/postfixadmin/forums/forum/676076/topic/4072904 -- Zhang Huangbin - Open Source Mail Server Solution for Red Hat(R) Enterprise Linux, CentOS, Debian, Ubuntu, OpenSuSE, FreeBSD: http://www.iredmail.org/ |