#!/usr/bin/perl -Tw
# quick'n'dirty hack of fs-setup to add radius attributes
+# (i'm not sure this even works in the new world of schema changes - everyone
+# uses attributes via groups now)
use strict;
use DBI;
-use FS::UID qw(adminsuidsetup checkeuid getsecrets);
+use FS::UID qw(adminsuidsetup);
use FS::raddb;
-die "Not running uid freeside!" unless checkeuid();
-
my %attrib2db =
map { lc($FS::raddb::attrib{$_}) => $_ } keys %FS::raddb::attrib;
my $user = shift or die &usage;
-getsecrets($user);
-
my $dbh = adminsuidsetup $user;
###
###
foreach my $attribute ( @attributes ) {
+
my $statement =
"ALTER TABLE svc_acct ADD COLUMN rc_$attribute varchar($char_d) NULL";
my $sth = $dbh->prepare( $statement )
or warn "Error preparing $statement: ". $dbh->errstr;
my $rc = $sth->execute
or warn "Error executing $statement: ". $sth->errstr;
+
+ $statement =
+ "ALTER TABLE h_svc_acct ADD COLUMN rc_$attribute varchar($char_d) NULL";
+ $sth = $dbh->prepare( $statement )
+ or warn "Error preparing $statement: ". $dbh->errstr;
+ $rc = $sth->execute
+ or warn "Error executing $statement: ". $sth->errstr;
+
}
$dbh->commit or die $dbh->errstr;