X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=bin%2Ffs-setup;h=e3dd8b0ead6c007ca94fea4e7f2b68e36bcc37a6;hp=1c720e6985a56e9121803fee9e7ecb74ea29b629;hb=1aa750eba2b9b73b4f09f28b9acd748ee3669bd4;hpb=895e5dd0c472e41875435cc625f1ca0a36bd2524 diff --git a/bin/fs-setup b/bin/fs-setup index 1c720e698..e3dd8b0ea 100755 --- a/bin/fs-setup +++ b/bin/fs-setup @@ -1,13 +1,13 @@ #!/usr/bin/perl -Tw # -# $Id: fs-setup,v 1.52 2001-09-04 11:15:15 ivan Exp $ +# $Id: fs-setup,v 1.71 2002-01-28 06:57:23 ivan Exp $ #to delay loading dbdef until we're ready BEGIN { $FS::Record::setup_hack = 1; } use strict; use DBI; -use DBIx::DBSchema 0.18; +use DBIx::DBSchema 0.19; use DBIx::DBSchema::Table; use DBIx::DBSchema::Column; use DBIx::DBSchema::ColGroup::Unique; @@ -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 { lc($FS::raddb::attrib{$_}) => $_ } keys %FS::raddb::attrib; + my $user = shift or die &usage; getsecrets($user); @@ -26,22 +30,28 @@ my($dbdef_file) = "/usr/local/etc/freeside/dbdef.". datasrc; ### -print "\nEnter the maximum username length: "; -my($username_len)=&getvalue; +#print "\nEnter the maximum username length: "; +#my($username_len)=&getvalue; +my $username_len = 32; #usernamemax config file 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); @@ -284,12 +293,39 @@ sub tables_hash_hack { '_date', @date_type, 'charged', @money_type, 'printed', 'int', '', '', + 'closed', 'char', 'NULL', 1, ], 'primary_key' => 'invnum', 'unique' => [ [] ], 'index' => [ ['custnum'] ], }, + 'cust_bill_event' => { + 'columns' => [ + 'eventnum', 'int', '', '', + 'invnum', 'int', '', '', + 'eventpart', 'int', '', '', + '_date', @date_type, + ], + 'primary_key' => 'eventnum', + 'unique' => [ [ 'eventpart', 'invnum' ] ], + 'index' => [ ['invnum'] ], + }, + + 'part_bill_event' => { + 'columns' => [ + 'eventpart', 'int', '', '', + 'payby', 'int', '', '', + 'event', 'varchar', '', $char_d, + 'eventcode', @perl_type, + 'seconds', 'int', 'NULL', '', + 'disabled', 'char', 'NULL', 1, + ], + 'primary_key' => 'eventpart', + 'unique' => [ [] ], + 'index' => [ ['payby'] ], + }, + 'cust_bill_pkg' => { 'columns' => [ 'pkgnum', 'int', '', '', @@ -311,7 +347,8 @@ sub tables_hash_hack { '_date', @date_type, 'amount', @money_type, 'otaker', 'varchar', '', 8, - 'reason', 'varchar', 'NULL', 255, + 'reason', 'text', 'NULL', '', + 'closed', 'char', 'NULL', 1, ], 'primary_key' => 'crednum', 'unique' => [ [] ], @@ -366,7 +403,7 @@ sub tables_hash_hack { 'ship_night', 'varchar', 'NULL', 20, 'ship_fax', 'varchar', 'NULL', 12, 'payby', 'char', '', 4, - 'payinfo', 'varchar', 'NULL', 16, + 'payinfo', 'varchar', 'NULL', $char_d, #'paydate', @date_type, 'paydate', 'varchar', 'NULL', 10, 'payname', 'varchar', 'NULL', $char_d, @@ -374,7 +411,7 @@ sub tables_hash_hack { 'otaker', 'varchar', '', 8, 'refnum', 'int', '', '', 'referral_custnum', 'int', 'NULL', '', - 'comments', 'varchar', 'NULL', '', + 'comments', 'text', 'NULL', '', ], 'primary_key' => 'custnum', 'unique' => [ [] ], @@ -420,6 +457,7 @@ sub tables_hash_hack { # payment type table. 'payinfo', 'varchar', 'NULL', 16, #see cust_main above 'paybatch', 'varchar', 'NULL', $char_d, #for auditing purposes. + 'closed', 'char', 'NULL', 1, ], 'primary_key' => 'paynum', 'unique' => [ [] ], @@ -442,6 +480,7 @@ sub tables_hash_hack { 'cust_pay_batch' => { #what's this used for again? list of customers #in current CARD batch? (necessarily CARD?) 'columns' => [ + 'paybatchnum', 'int', '', '', 'invnum', 'int', '', '', 'custnum', 'int', '', '', 'last', 'varchar', '', $char_d, @@ -452,14 +491,14 @@ sub tables_hash_hack { 'state', 'varchar', '', $char_d, 'zip', 'varchar', '', 10, 'country', 'char', '', 2, - 'trancode', 'int', '', '', +# 'trancode', 'int', '', '', 'cardnum', 'varchar', '', 16, #'exp', @date_type, 'exp', 'varchar', '', 11, 'payname', 'varchar', 'NULL', $char_d, 'amount', @money_type, ], - 'primary_key' => '', + 'primary_key' => 'paybatchnum', 'unique' => [ [] ], 'index' => [ ['invnum'], ['custnum'] ], }, @@ -475,6 +514,7 @@ sub tables_hash_hack { 'susp', @date_type, 'cancel', @date_type, 'expire', @date_type, + 'manual_flag', 'char', 'NULL', 1, ], 'primary_key' => 'pkgnum', 'unique' => [ [] ], @@ -494,6 +534,7 @@ sub tables_hash_hack { # into payment type table. 'payinfo', 'varchar', 'NULL', 16, #see cust_main above 'paybatch', 'varchar', 'NULL', $char_d, + 'closed', 'char', 'NULL', 1, ], 'primary_key' => 'refundnum', 'unique' => [ [] ], @@ -533,6 +574,11 @@ sub tables_hash_hack { 'setup', @perl_type, 'freq', 'int', '', '', #billing frequency (months) 'recur', @perl_type, + 'setuptax', 'char', 'NULL', 1, + 'recurtax', 'char', 'NULL', 1, + 'plan', 'varchar', 'NULL', $char_d, + 'plandata', 'text', 'NULL', '', + 'disabled', 'char', 'NULL', 1, ], 'primary_key' => 'pkgpart', 'unique' => [ [] ], @@ -575,12 +621,26 @@ sub tables_hash_hack { 'svcpart', 'int', '', '', 'svc', 'varchar', '', $char_d, 'svcdb', 'varchar', '', $char_d, + 'disabled', 'char', 'NULL', 1, ], 'primary_key' => 'svcpart', 'unique' => [ [] ], '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' => [ @@ -593,7 +653,21 @@ sub tables_hash_hack { ], 'primary_key' => 'popnum', 'unique' => [ [] ], - 'index' => [ [] ], + 'index' => [ [ 'state' ] ], + }, + + 'part_pop_local' => { + 'columns' => [ + 'localnum', 'int', '', '', + 'popnum', 'int', '', '', + 'city', 'varchar', 'NULL', $char_d, + 'state', 'char', 'NULL', 2, + 'npa', 'char', '', 3, + 'nxx', 'char', '', 3, + ], + 'primary_key' => 'popnum', + 'unique' => [ [] ], + 'index' => [ [ 'npa', 'nxx' ] ], }, 'svc_acct' => { @@ -750,6 +824,54 @@ sub tables_hash_hack { 'index' => [ [ 'portnum' ] ], }, + 'queue' => { + 'columns' => [ + 'jobnum', 'int', '', '', + 'job', 'text', '', '', + '_date', 'int', '', '', + 'status', 'varchar', '', $char_d, + ], + 'primary_key' => 'jobnum', + 'unique' => [], + 'index' => [], + }, + + 'queue_arg' => { + 'columns' => [ + 'argnum', 'int', '', '', + 'jobnum', 'int', '', '', + 'arg', 'text', 'NULL', '', + ], + 'primary_key' => 'argnum', + 'unique' => [], + 'index' => [ [ 'jobnum' ] ], + }, + + 'part_export' => { + 'columns' => [ + 'exportnum', 'int', '', '', + 'svcpart', 'int', '', '', + 'machine', 'varchar', '', $char_d, + 'exporttype', 'varchar', '', $char_d, + 'nodomain', 'char', 'NULL', 1, + ], + 'primary_key' => 'exportnum', + 'unique' => [], + 'index' => [ [ 'machine' ], [ 'exporttype' ] ], + }, + + 'part_export_option' => { + 'columns' => [ + 'optionnum', 'int', '', '', + 'exportnum', 'int', '', '', + 'option', 'varchar', '', $char_d, + 'optionvalue', 'text', 'NULL', '', + ], + 'primary_key' => 'optionnum', + 'unique' => [], + 'index' => [ [ 'exportnum' ], [ 'option' ] ], + }, + ); %tables;