X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=bin%2Ffs-setup;h=9534eb23f4ca34a9eb5e347f833b74ba39ea6579;hb=01ea770bbf69f2e31a2e74254ca931917f2ca1ef;hp=1c720e6985a56e9121803fee9e7ecb74ea29b629;hpb=895e5dd0c472e41875435cc625f1ca0a36bd2524;p=freeside.git diff --git a/bin/fs-setup b/bin/fs-setup index 1c720e698..9534eb23f 100755 --- a/bin/fs-setup +++ b/bin/fs-setup @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: fs-setup,v 1.52 2001-09-04 11:15:15 ivan Exp $ +# $Id: fs-setup,v 1.57 2001-09-11 00:07:30 ivan Exp $ #to delay loading dbdef until we're ready BEGIN { $FS::Record::setup_hack = 1; } @@ -15,9 +15,13 @@ use DBIx::DBSchema::ColGroup::Index; use FS::UID qw(adminsuidsetup datasrc checkeuid getsecrets); use FS::Record; use FS::cust_main_county; +use FS::raddb; die "Not running uid freeside!" unless checkeuid(); +my %attrib2db = + map { $FS::raddb::attrib{lc($_)} => $_ } keys %FS::raddb::attrib; + my $user = shift or die &usage; getsecrets($user); @@ -35,13 +39,15 @@ reply attribute Framed-IP-Address for each user. You can specify additional check and reply attributes. First enter any additional RADIUS check attributes you need to track for each user, separated by whitespace. END -my @check_attributes = map { s/\-/_/g; $_; } split(" ",&getvalue); +my @check_attributes = map { $attrib2db{lc($_)} or die "unknown attribute $_"; } + split(" ",&getvalue); print "\n\n", <table('part_svc'); - -#because of svc_acct_pop -#foreach (grep /^svc_/, $dbdef->tables) { -#foreach (qw(svc_acct svc_acct_sm svc_charge svc_domain svc_wo)) { -foreach (qw(svc_acct svc_domain svc_forward svc_www)) { - my($table)=$dbdef->table($_); - my($col); - foreach $col ( $table->columns ) { - next if $col =~ /^svcnum$/; - $part_svc->addcolumn( new DBIx::DBSchema::Column ( - $table->name. '__' . $table->column($col)->name, - 'varchar', #$table->column($col)->type, - 'NULL', - $char_d, #$table->column($col)->length, - )); - $part_svc->addcolumn ( new DBIx::DBSchema::Column ( - $table->name. '__'. $table->column($col)->name . "_flag", - 'char', - 'NULL', - 1, - )); - } -} +##make part_svc table (but now as object) +# +#my($part_svc)=$dbdef->table('part_svc'); +# +##because of svc_acct_pop +##foreach (grep /^svc_/, $dbdef->tables) { +##foreach (qw(svc_acct svc_acct_sm svc_charge svc_domain svc_wo)) { +#foreach (qw(svc_acct svc_domain svc_forward svc_www)) { +# my($table)=$dbdef->table($_); +# my($col); +# foreach $col ( $table->columns ) { +# next if $col =~ /^svcnum$/; +# $part_svc->addcolumn( new DBIx::DBSchema::Column ( +# $table->name. '__' . $table->column($col)->name, +# 'varchar', #$table->column($col)->type, +# 'NULL', +# $char_d, #$table->column($col)->length, +# )); +# $part_svc->addcolumn ( new DBIx::DBSchema::Column ( +# $table->name. '__'. $table->column($col)->name . "_flag", +# 'char', +# 'NULL', +# 1, +# )); +# } +#} #important $dbdef->save($dbdef_file); @@ -581,6 +586,19 @@ sub tables_hash_hack { 'index' => [ [] ], }, + 'part_svc_column' => { + 'columns' => [ + 'columnnum', 'int', '', '', + 'svcpart', 'int', '', '', + 'columnname', 'varchar', '', 64, + 'columnvalue', 'varchar', 'NULL', $char_d, + 'columnflag', 'char', 'NULL', 1, + ], + 'primary_key' => 'columnnum', + 'unique' => [ [ 'svcpart', 'columnname' ] ], + 'index' => [ [ 'svcpart' ] ], + }, + #(this should be renamed to part_pop) 'svc_acct_pop' => { 'columns' => [ @@ -750,6 +768,28 @@ sub tables_hash_hack { 'index' => [ [ 'portnum' ] ], }, + 'queue' => { + 'columns' => [ + 'jobnum', 'int', '', '', + 'job', 'varchar', '', '', + '_date', 'int', '', '', + 'status', 'varchar', '', $char_d, + ], + 'primary_key' => 'jobnum', + 'unique' => [], + 'index' => [], + }, + + 'queue_arg' => { + 'columns' => [ + 'argnum', 'int', '', '', + 'jobnum', 'int', '', '', + 'arg', 'varchar', 'NULL', '', + ], + 'primary_key' => 'argnum', + 'unique' => [], + 'index' => [ [ 'jobnum' ] ], + }, ); %tables;