X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FSchema.pm;h=400ef06462b291c5d87aa97b9da825ebd5001630;hb=dbb388836b7951a3db49deda05a1ff9ba5125c17;hp=e811856669e23041add702a2c8b6159530e18acf;hpb=2c757d7db4cb6a7b9655de13206fcc84fb7ce61f;p=freeside.git diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index e81185666..400ef0646 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -16,13 +16,6 @@ use FS::UID qw(datasrc); $DEBUG = 0; $me = '[FS::Schema]'; -#ask FS::UID to run this stuff for us later -FS::UID->install_callback( sub { - #$conf = new FS::Conf; - &reload_dbdef("/usr/local/etc/freeside/dbdef.". datasrc) - unless $setup_hack; #$setup_hack needed now? -} ); - =head1 NAME FS::Schema - Freeside database schema @@ -58,7 +51,7 @@ sub reload_dbdef { unless ( exists $dbdef_cache{$file} ) { warn "[debug]$me loading dbdef for $file\n" if $DEBUG; $dbdef_cache{$file} = DBIx::DBSchema->load( $file ) - or die "can't load database schema from $file"; + or die "can't load database schema from $file: $DBIx::DBSchema::errstr\n"; } else { warn "[debug]$me re-using cached dbdef for $file\n" if $DEBUG; } @@ -326,6 +319,7 @@ sub tables_hashref { 'weight', 'int', '', '', '', '', 'plan', 'varchar', 'NULL', $char_d, '', '', 'plandata', 'text', 'NULL', '', '', '', + 'reason', 'int', 'NULL', '', '', '', 'disabled', 'char', 'NULL', 1, '', '', ], 'primary_key' => 'eventpart', @@ -389,15 +383,33 @@ sub tables_hashref { 'index' => [ ['crednum'], ['invnum'] ], }, + 'cust_credit_bill_pkg' => { + 'columns' => [ + 'creditbillpkgnum', 'serial', '', '', '', '', + 'creditbillnum', 'int', '', '', '', '', + 'billpkgnum', 'int', '', '', '', '', + 'amount', @money_type, '', '', + 'setuprecur', 'varchar', '', $char_d, '', '', + 'sdate', @date_type, '', '', + 'edate', @date_type, '', '', + ], + 'primary_key' => 'creditbillpkgnum', + 'unique' => [], + 'index' => [ [ 'creditbillnum' ], [ 'billpkgnum' ], ], + }, + 'cust_main' => { 'columns' => [ 'custnum', 'serial', '', '', '', '', 'agentnum', 'int', '', '', '', '', + 'agent_custid', 'varchar', 'NULL', $char_d, '', '', # 'titlenum', 'int', 'NULL', '', '', '', 'last', 'varchar', '', $char_d, '', '', # 'middle', 'varchar', 'NULL', $char_d, '', '', 'first', 'varchar', '', $char_d, '', '', 'ss', 'varchar', 'NULL', 11, '', '', + 'birthdate' ,@date_type, '', '', + 'signupdate',@date_type, '', '', 'company', 'varchar', 'NULL', $char_d, '', '', 'address1', 'varchar', '', $char_d, '', '', 'address2', 'varchar', 'NULL', $char_d, '', '', @@ -442,7 +454,7 @@ sub tables_hashref { 'spool_cdr','char', 'NULL', 1, '', '', ], 'primary_key' => 'custnum', - 'unique' => [], + 'unique' => [ [ 'agentnum', 'agent_custid' ] ], #'index' => [ ['last'], ['company'] ], 'index' => [ ['last'], [ 'company' ], [ 'referral_custnum' ], [ 'daytime' ], [ 'night' ], [ 'fax' ], [ 'refnum' ], @@ -464,6 +476,19 @@ sub tables_hashref { 'index' => [ ['custnum'], ], }, + 'cust_main_note' => { + 'columns' => [ + 'notenum', 'serial', '', '', '', '', + 'custnum', 'int', '', '', '', '', + '_date', @date_type, '', '', + 'otaker', 'varchar', '', 32, '', '', + 'comments', 'text', 'NULL', '', '', '', + ], + 'primary_key' => 'notenum', + 'unique' => [], + 'index' => [ [ 'custnum' ], [ '_date' ], ], + }, + 'cust_main_county' => { #county+state+country are checked off the #cust_main_county for validation and to provide # a tax rate. @@ -538,10 +563,52 @@ sub tables_hashref { 'index' => [ [ 'paynum' ], [ 'invnum' ] ], }, + 'cust_bill_pay_batch' => { + 'columns' => [ + 'billpaynum', 'serial', '', '', '', '', + 'invnum', 'int', '', '', '', '', + 'paybatchnum', 'int', '', '', '', '', + 'amount', @money_type, '', '', + '_date', @date_type, '', '', + ], + 'primary_key' => 'billpaynum', + 'unique' => [], + 'index' => [ [ 'paybatchnum' ], [ 'invnum' ] ], + }, + + 'cust_bill_pay_pkg' => { + 'columns' => [ + 'billpaypkgnum', 'serial', '', '', '', '', + 'billpaynum', 'int', '', '', '', '', + 'billpkgnum', 'int', '', '', '', '', + 'amount', @money_type, '', '', + 'setuprecur', 'varchar', '', $char_d, '', '', + 'sdate', @date_type, '', '', + 'edate', @date_type, '', '', + ], + 'primary_key' => 'billpaypkgnum', + 'unique' => [], + 'index' => [ [ 'billpaynum' ], [ 'billpkgnum' ], ], + }, + + 'pay_batch' => { #batches of payments to an external processor + 'columns' => [ + 'batchnum', 'serial', '', '', '', '', + 'payby', 'char', '', 4, '', '', # CARD/CHEK + 'status', 'char', 'NULL', 1, '', '', + 'download', @date_type, '', '', + 'upload', @date_type, '', '', + ], + 'primary_key' => 'batchnum', + 'unique' => [], + 'index' => [], + }, + 'cust_pay_batch' => { #what's this used for again? list of customers #in current CARD batch? (necessarily CARD?) 'columns' => [ 'paybatchnum', 'serial', '', '', '', '', + 'batchnum', 'int', '', '', '', '', 'invnum', 'int', '', '', '', '', 'custnum', 'int', '', '', '', '', 'last', 'varchar', '', $char_d, '', '', @@ -553,15 +620,17 @@ sub tables_hashref { 'zip', 'varchar', 'NULL', 10, '', '', 'country', 'char', '', 2, '', '', # 'trancode', 'int', '', '', '', '' - 'cardnum', 'varchar', '', 16, '', '', + 'payby', 'char', '', 4, '', '', # CARD/BILL/COMP, should be + 'payinfo', 'varchar', '', 512, '', '', #'exp', @date_type, '', '' - 'exp', 'varchar', '', 11, '', '', + 'exp', 'varchar', 'NULL', 11, '', '', 'payname', 'varchar', 'NULL', $char_d, '', '', 'amount', @money_type, '', '', + 'status', 'varchar', 'NULL', $char_d, '', '', ], 'primary_key' => 'paybatchnum', 'unique' => [], - 'index' => [ ['invnum'], ['custnum'] ], + 'index' => [ ['batchnum'], ['invnum'], ['custnum'] ], }, 'cust_pkg' => { @@ -583,6 +652,19 @@ sub tables_hashref { 'index' => [ ['custnum'], ['pkgpart'] ], }, + 'cust_pkg_reason' => { + 'columns' => [ + 'num', 'serial', '', '', '', '', + 'pkgnum', 'int', '', '', '', '', + 'reasonnum','int', '', '', '', '', + 'otaker', 'varchar', '', 32, '', '', + 'date', @date_type, '', '', + ], + 'primary_key' => 'num', + 'unique' => [], + 'index' => [], + }, + 'cust_refund' => { 'columns' => [ 'refundnum', 'serial', '', '', '', '', @@ -676,9 +758,10 @@ sub tables_hashref { 'part_referral' => { 'columns' => [ - 'refnum', 'serial', '', '', '', '', - 'referral', 'varchar', '', $char_d, '', '', - 'disabled', 'char', 'NULL', 1, '', '', + 'refnum', 'serial', '', '', '', '', + 'referral', 'varchar', '', $char_d, '', '', + 'disabled', 'char', 'NULL', 1, '', '', + 'agentnum', 'int', 'NULL', '', '', '', ], 'primary_key' => 'refnum', 'unique' => [], @@ -754,6 +837,13 @@ sub tables_hashref { 'quota', 'varchar', 'NULL', $char_d, '', '', 'slipip', 'varchar', 'NULL', 15, '', '', #four TINYINTs, bah. 'seconds', 'int', 'NULL', '', '', '', #uhhhh + 'seconds_threshold', 'int', 'NULL', '', '', '', + 'upbytes', 'int', 'NULL', '', '', '', + 'upbytes_threshold', 'int', 'NULL', '', '', '', + 'downbytes', 'int', 'NULL', '', '', '', + 'downbytes_threshold', 'int', 'NULL', '', '', '', + 'totalbytes','int', 'NULL', '', '', '', + 'totalbytes_threshold', 'int', 'NULL', '', '', '', 'domsvc', 'int', '', '', '', '', ], 'primary_key' => 'svcnum', @@ -840,6 +930,8 @@ sub tables_hashref { 'identifier', 'varchar', '', $char_d, '', '', 'amount', @money_type, '', '', 'seconds', 'int', 'NULL', '', '', '', + 'upbytes', 'int', 'NULL', '', '', '', + 'downbytes', 'int', 'NULL', '', '', '', 'agentnum', 'int', 'NULL', '', '', '', ], 'primary_key' => 'prepaynum', @@ -1284,17 +1376,6 @@ sub tables_hashref { 'index' => [], }, - 'cancel_reason' => { - 'columns' => [ - 'reasonnum', 'serial', '', '', '', '', - 'reason', 'varchar', '', $char_d, '', '', - 'disabled', 'char', 'NULL', 1, '', '', - ], - 'primary_key' => 'reasonnum', - 'unique' => [], - 'index' => [ [ 'disabled' ] ], - }, - 'pkg_class' => { 'columns' => [ 'classnum', 'serial', '', '', '', '', @@ -1464,6 +1545,7 @@ sub tables_hashref { '_password', 'varchar', '', $char_d, '', '', 'last', 'varchar', '', $char_d, '', '', 'first', 'varchar', '', $char_d, '', '', + 'disabled', 'char', 'NULL', 1, '', '', ], 'primary_key' => 'usernum', 'unique' => [ [ 'username' ] ], @@ -1526,7 +1608,42 @@ sub tables_hashref { 'index' => [], }, - }; + 'svc_phone' => { + 'columns' => [ + 'svcnum', 'int', '', '', '', '', + 'countrycode', 'varchar', '', 3, '', '', + 'phonenum', 'varchar', '', 15, '', '', #12 ? + 'pin', 'varchar', 'NULL', $char_d, '', '', + ], + 'primary_key' => 'svcnum', + 'unique' => [], + 'index' => [ [ 'countrycode', 'phonenum' ] ], + }, + + 'reason_type' => { + 'columns' => [ + 'typenum', 'serial', '', '', '', '', + 'class', 'char', '', 1, '', '', + 'type', 'varchar', '', $char_d, '', '', + ], + 'primary_key' => 'typenum', + 'unique' => [], + 'index' => [], + }, + + 'reason' => { + 'columns' => [ + 'reasonnum', 'serial', '', '', '', '', + 'reason_type', 'int', '', '', '', '', + 'reason', 'varchar', '', $char_d, '', '', + 'disabled', 'char', 'NULL', 1, '', '', + ], + 'primary_key' => 'reasonnum', + 'unique' => [], + 'index' => [], + }, + + # name type nullability length default local #'new_table' => { # 'columns' => [ @@ -1537,6 +1654,8 @@ sub tables_hashref { # 'index' => [], #}, + }; + } =back