FR, SQL backend and Foreign keys

Fabien COMBERNOUS fcombernous at kezia.com
Wed Sep 28 12:17:56 CEST 2011


On 28/09/2011 11:52, Fajar A. Nugraha wrote:
> 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).

You are right. It is a mistake from me. We can stick with KEY.
>
>> +  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.
I proposed a patch with only radcheck and radusergroup because i can 
test this here. I'm not a radius specialist, i prefer to make a first 
step before to run.

-- 
*Fabien COMBERNOUS*
/unix system engineer/
www.kezia.com <http://www.kezia.com/>
*Tel: +33(0)9 5279 5202*
Kezia



More information about the Freeradius-Users mailing list