FR, SQL backend and Foreign keys
Fajar A. Nugraha
list at fajar.net
Wed Sep 28 11:52:05 CEST 2011
On Wed, Sep 28, 2011 at 3:50 PM, Fabien COMBERNOUS
<fcombernous at kezia.com> wrote:
> # Table structure for table 'radgroupcheck'
> @@ -117,8 +117,10 @@
> username varchar(64) NOT NULL default '',
> groupname varchar(64) NOT NULL default '',
> priority int(11) NOT NULL default '1',
> - KEY username (username(32))
> -) ;
> + INDEX username (username),
You should stick with either "KEY" or "INDEX" for consistency
(although both are synonyms in mysql).
> + FOREIGN KEY (`username`) REFERENCES radcheck(username)
> + ON DELETE CASCADE ON UPDATE CASCADE
> +) ENGINE=InnoDB;
If you use foreign key for radgroupcheck, is there a reason not to use
it on other tables (e.g. radreply, radgroupreply)?
One exception might be radacct, where you might want to keep
accounting records even for old/deleted accounts.
--
Fajar
More information about the Freeradius-Users
mailing list