EAP flavours need libfreeradius-eap as a prerequisite so they're linked against it
[freeradius.git] / raddb / sql / postgresql / cui.sql
1 CREATE TABLE cui (
2   clientipaddress INET NOT NULL DEFAULT '0.0.0.0',
3   callingstationid varchar(50) NOT NULL DEFAULT '',
4   username varchar(64) NOT NULL DEFAULT '',
5   cui varchar(32) NOT NULL DEFAULT '',
6   creationdate TIMESTAMP with time zone NOT NULL default 'now()',
7   lastaccounting TIMESTAMP with time zone NOT NULL default '-infinity'::timestamp,
8   PRIMARY KEY  (username, clientipaddress, callingstationid)
9 );
10
11 CREATE RULE postauth_query AS ON INSERT TO cui
12         WHERE EXISTS(SELECT 1 FROM cui WHERE (username, clientipaddress, callingstationid)=(NEW.username, NEW.clientipaddress, NEW.callingstationid)) 
13         DO INSTEAD UPDATE cui SET lastaccounting ='-infinity'::timestamp with time zone, cui=NEW.cui WHERE (username, clientipaddress, callingstationid)=(NEW.username, NEW.clientipaddress, NEW.callingstationid);
14