$DEBUG = 0;
$me = '[FS::Schema]';
-#hardcoded now...
-##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
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;
}
'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', '', '', '', '',
# 'middle', 'varchar', 'NULL', $char_d, '', '',
'first', 'varchar', '', $char_d, '', '',
'ss', 'varchar', 'NULL', 11, '', '',
+ 'birthdate',@date_type, '', '',
'company', 'varchar', 'NULL', $char_d, '', '',
'address1', 'varchar', '', $char_d, '', '',
'address2', 'varchar', 'NULL', $char_d, '', '',
'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.
'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, '', '',