warn "[debug]$me re-using cached dbdef for $file\n" if $DEBUG;
}
$dbdef = $dbdef_cache{$file};
+ FS::Record::fk_methods_init();
}
=item dbdef
grep { ! /^(clientapi|access_user)_session/
&& ! /^h_/
&& ! /^log(_context)?$/
+ && ! /^legacy_cust_history$/
&& ( ! /^queue(_arg|_depend|_stat)?$/ || ! $opt->{'queue-no_history'} )
&& ! $tables_hashref_torrus->{$_}
+ && ! /^cacti_page$/
+ && ! /^template_image$/
}
$dbdef->tables
) {
#void fields
'void_date', @date_type, '', '',
- 'reason', 'varchar', 'NULL', $char_d, '', '',
- 'void_usernum', 'int', 'NULL', '', '', '',
+ 'reason', 'varchar', 'NULL', $char_d, '', '',
+ 'reasonnum', 'int', 'NULL', '', '', '',
+ 'void_usernum', 'int', 'NULL', '', '', '',
],
'primary_key' => 'invnum',
'unique' => [ [ 'custnum', 'agent_invid' ] ], #agentnum? huh
{ columns => [ 'statementnum' ],
table => 'cust_statement', #_void? both?
},
+ { columns => [ 'reasonnum' ],
+ table => 'reason',
+ },
{ columns => [ 'void_usernum' ],
table => 'access_user',
references => [ 'usernum' ],
],
},
- 'cust_statement' => {
+ 'legacy_cust_history' => {
'columns' => [
- 'statementnum', 'serial', '', '', '', '',
- 'custnum', 'int', '', '', '', '',
- '_date', @date_type, '', '',
+ 'legacyhistorynum', 'serial', '', '', '', '',
+ 'custnum', 'int', '', '', '', '',
+ 'history_action', 'varchar', '', $char_d, '', '',
+ 'history_date', @date_type, '', '',
+ 'history_usernum', 'int', 'NULL', '', '', '',
+ 'item', 'varchar', 'NULL', $char_d, '', '',
+ 'description', 'varchar', 'NULL', 2*$char_d, '', '',
+ 'change_data', 'text', 'NULL', '', '', '',
],
- 'primary_key' => 'statementnum',
+ 'primary_key' => 'legacyhistorynum',
'unique' => [],
- 'index' => [ ['custnum'], ['_date'], ],
+ 'index' => [ ['custnum'], ['history_date'], ],
'foreign_keys' => [
{ columns => [ 'custnum' ],
table => 'cust_main',
},
- ],
- },
-
- #old "invoice" events, deprecated
- 'cust_bill_event' => {
- 'columns' => [
- 'eventnum', 'serial', '', '', '', '',
- 'invnum', 'int', '', '', '', '',
- 'eventpart', 'int', '', '', '', '',
- '_date', @date_type, '', '',
- 'status', 'varchar', '', $char_d, '', '',
- 'statustext', 'text', 'NULL', '', '', '',
- ],
- 'primary_key' => 'eventnum',
- #no... there are retries now #'unique' => [ [ 'eventpart', 'invnum' ] ],
- 'unique' => [],
- 'index' => [ ['invnum'], ['status'], ['eventpart'],
- ['statustext'], ['_date'],
- ],
- 'foreign_keys' => [
- { columns => [ 'invnum' ],
- table => 'cust_bill',
- },
- { columns => [ 'eventpart' ],
- table => 'part_bill_event',
+ { columns => [ 'history_usernum' ],
+ table => 'access_user',
+ references => [ 'usernum' ],
},
],
},
- #old "invoice" events, deprecated
- 'part_bill_event' => {
+ 'cust_statement' => {
'columns' => [
- 'eventpart', 'serial', '', '', '', '',
- 'freq', 'varchar', 'NULL', $char_d, '', '',
- 'payby', 'char', '', 4, '', '',
- 'event', 'varchar', '', $char_d, '', '',
- 'eventcode', @perl_type, '', '',
- 'seconds', 'int', 'NULL', '', '', '',
- 'weight', 'int', '', '', '', '',
- 'plan', 'varchar', 'NULL', $char_d, '', '',
- 'plandata', 'text', 'NULL', '', '', '',
- 'reason', 'int', 'NULL', '', '', '',
- 'disabled', 'char', 'NULL', 1, '', '',
+ 'statementnum', 'serial', '', '', '', '',
+ 'custnum', 'int', '', '', '', '',
+ '_date', @date_type, '', '',
],
- 'primary_key' => 'eventpart',
+ 'primary_key' => 'statementnum',
'unique' => [],
- 'index' => [ ['payby'], ['disabled'], ],
+ 'index' => [ ['custnum'], ['_date'], ],
'foreign_keys' => [
- { columns => [ 'reason' ],
- table => 'reason',
- references => [ 'reasonnum' ],
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
},
],
},
{ columns => [ 'eventnum' ],
table => 'cust_event',
},
- { columns => [ 'billpkgnum' ],
- table => 'cust_bill_pkg',
- },
+ #{ columns => [ 'billpkgnum' ],
+ # table => 'cust_bill_pkg',
+ #},
{ columns => [ 'feepart' ],
table => 'part_fee',
},
{ columns => [ 'billpkgnum' ],
table => 'cust_bill_pkg',
},
- { columns => [ 'base_billpkgnum' ],
- table => 'cust_bill_pkg',
- references => [ 'billpkgnum' ],
- },
- { columns => [ 'base_invnum' ],
- table => 'cust_bill',
- references => [ 'invnum' ],
+ ],
+ },
+
+ 'cust_bill_pkg_fee_void' => {
+ 'columns' => [
+ 'billpkgfeenum', 'serial', '', '', '', '',
+ 'billpkgnum', 'int', '', '', '', '',
+ 'base_invnum', 'int', '', '', '', '',
+ 'base_billpkgnum', 'int', 'NULL', '', '', '',
+ 'amount', @money_type, '', '',
+ ],
+ 'primary_key' => 'billpkgfeenum',
+ 'unique' => [],
+ 'index' => [ ['billpkgnum'],
+ ['base_invnum'],
+ ['base_billpkgnum'],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'billpkgnum' ],
+ table => 'cust_bill_pkg_void',
},
],
},
+
'cust_bill_pkg_tax_location' => {
'columns' => [
'billpkgtaxlocationnum', 'serial', '', '', '', '',
{ columns => [ 'locationnum' ],
table => 'cust_location',
},
- { columns => [ 'taxable_billpkgnum' ],
- table => 'cust_bill_pkg',
- references => [ 'billpkgnum' ],
- },
+ #{ columns => [ 'taxable_billpkgnum' ],
+ # table => 'cust_bill_pkg',
+ # references => [ 'billpkgnum' ],
+ #},
],
},
'amount', @money_type, '', '',
'currency', 'char', 'NULL', 3, '', '',
'taxable_billpkgnum', 'int', 'NULL', '', '', '',
+ 'taxclass', 'varchar', 'NULL', 10, '', '',
],
'primary_key' => 'billpkgtaxratelocationnum',
'unique' => [],
{ columns => [ 'taxratelocationnum' ],
table => 'tax_rate_location',
},
- { columns => [ 'taxable_billpkgnum' ],
- table => 'cust_bill_pkg',
- references => [ 'billpkgnum' ],
- },
+ #{ columns => [ 'taxable_billpkgnum' ],
+ # table => 'cust_bill_pkg',
+ # references => [ 'billpkgnum' ],
+ #},
],
},
'unitsetup', @money_typen, '', '',
'unitrecur', @money_typen, '', '',
'hidden', 'char', 'NULL', 1, '', '',
+ 'feepart', 'int', 'NULL', '', '', '',
#void fields
'void_date', @date_type, '', '',
- 'reason', 'varchar', 'NULL', $char_d, '', '',
- 'void_usernum', 'int', 'NULL', '', '', '',
+ 'reason', 'varchar', 'NULL', $char_d, '', '',
+ 'reasonnum', 'int', 'NULL', '', '', '',
+ 'void_usernum', 'int', 'NULL', '', '', '',
],
'primary_key' => 'billpkgnum',
'unique' => [],
{ columns => [ 'invnum' ],
table => 'cust_bill_void',
},
+ { columns => [ 'reasonnum' ],
+ table => 'reason',
+ },
#pkgnum 0 and -1 are used for special things
#{ columns => [ 'pkgnum' ],
# table => 'cust_pkg',
{ columns => [ 'billpkgnum' ],
table => 'cust_bill_pkg_void',
},
- { columns => [ 'pkgnum' ],
- table => 'cust_pkg',
- },
{ columns => [ 'locationnum' ],
table => 'cust_location',
},
- { columns => [ 'taxable_billpkgnum' ],
- table => 'cust_bill_pkg_void',
- references => [ 'billpkgnum' ],
- },
+ #{ columns => [ 'taxable_billpkgnum' ],
+ # table => 'cust_bill_pkg_void',
+ # references => [ 'billpkgnum' ],
+ #},
],
},
#void fields
'void_date', @date_type, '', '',
'void_reason', 'varchar', 'NULL', $char_d, '', '',
+ 'void_reasonnum', 'int', 'NULL', '', '', '',
'void_usernum', 'int', 'NULL', '', '', '',
],
'primary_key' => 'crednum',
table => 'cust_pkg',
references => [ 'pkgnum' ],
},
+ { columns => [ 'void_reasonnum' ],
+ table => 'reason',
+ references => [ 'reasonnum' ],
+ },
{ columns => [ 'void_usernum' ],
table => 'access_user',
references => [ 'usernum' ],
],
},
+ 'cust_credit_source_bill_pkg' => {
+ 'columns' => [
+ 'creditsourcebillpkgnum', 'serial', '', '', '', '',
+ 'crednum', 'int', '', '', '', '',
+ 'billpkgnum', 'int', '', '', '', '',
+ 'amount', @money_type, '', '',
+ 'currency', 'char', 'NULL', 3, '', '',
+ ],
+ 'primary_key' => 'creditsourcebillpkgnum',
+ 'unique' => [],
+ 'index' => [ ['crednum'], ['billpkgnum'] ],
+ 'foreign_keys' => [
+ { columns => ['billpkgnum'],
+ table => 'cust_bill_pkg',
+ },
+ { columns => ['crednum'],
+ table => 'cust_credit',
+ },
+ ],
+ },
+
'cust_main' => {
'columns' => [
'custnum', 'serial', '', '', '', '',
'ship_mobile', 'varchar', 'NULL', 12, '', '',
'currency', 'char', 'NULL', 3, '', '',
- #deprecated, info moved to cust_payby
- 'payby', 'char', 'NULL', 4, '', '',
- 'payinfo', 'varchar', 'NULL', 512, '', '',
- 'paycvv', 'varchar', 'NULL', 512, '', '',
- 'paymask', 'varchar', 'NULL', $char_d, '', '',
- #'paydate', @date_type, '', '',
- 'paydate', 'varchar', 'NULL', 10, '', '',
- 'paystart_month', 'int', 'NULL', '', '', '',
- 'paystart_year', 'int', 'NULL', '', '', '',
- 'payissue', 'varchar', 'NULL', 2, '', '',
- 'payname', 'varchar', 'NULL', 2*$char_d, '', '',
- 'paystate', 'varchar', 'NULL', $char_d, '', '',
- 'paytype', 'varchar', 'NULL', $char_d, '', '',
- 'payip', 'varchar', 'NULL', 15, '', '',
-
'geocode', 'varchar', 'NULL', 20, '', '',
'censustract', 'varchar', 'NULL', 20, '', '', # 7 to save space?
'censusyear', 'char', 'NULL', 4, '', '',
'message_noemail', 'char', 'NULL', 1, '', '',
'bill_locationnum', 'int', 'NULL', '', '', '',
'ship_locationnum', 'int', 'NULL', '', '', '',
- 'taxstatusnum', 'char', 'NULL', 32, '', '',
+ 'taxstatusnum', 'int', 'NULL', '', '', '',
+ 'complimentary', 'char', 'NULL', 1, '', '',
+ 'po_number', 'varchar', 'NULL', $char_d, '', '',
+ 'invoice_attn', 'varchar', 'NULL', $char_d, '', '',
+ 'invoice_ship_address', 'char', 'NULL', 1, '', '',
+ 'postal_invoice', 'char', 'NULL', 1, '', '',
],
'primary_key' => 'custnum',
'unique' => [ [ 'agentnum', 'agent_custid' ] ],
['agentnum'], ['refnum'], ['classnum'], ['usernum'],
[ 'custbatch' ],
[ 'referral_custnum' ],
- [ 'payby' ], [ 'paydate' ],
[ 'archived' ],
[ 'ship_locationnum' ],
[ 'bill_locationnum' ],
'columns' => [
'custpaybynum', 'serial', '', '', '', '',
'custnum', 'int', '', '', '', '',
- 'weight', 'int', '', '', '', '',
+ 'weight', 'int', 'NULL', '', '', '',
'payby', 'char', '', 4, '', '',
'payinfo', 'varchar', 'NULL', 512, '', '',
'cardtype', 'varchar', 'NULL', $char_d, '', '',
'index' => [ ['disabled'] ],
},
+ 'cust_contact' => {
+ 'columns' => [
+ 'custcontactnum', 'serial', '', '', '', '',
+ 'custnum', 'int', '', '', '', '',
+ 'contactnum', 'int', '', '', '', '',
+ 'classnum', 'int', 'NULL', '', '', '',
+ 'comment', 'varchar', 'NULL', 255, '', '',
+ 'selfservice_access', 'char', 'NULL', 1, '', '',
+ 'invoice_dest', 'char', 'NULL', 1, '', '',
+ ],
+ 'primary_key' => 'custcontactnum',
+ 'unique' => [ [ 'custnum', 'contactnum' ], ],
+ 'index' => [ [ 'custnum' ], [ 'contactnum' ], ],
+ 'foreign_keys' => [
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ { columns => [ 'contactnum' ],
+ table => 'contact',
+ },
+ { columns => [ 'classnum' ],
+ table => 'contact_class',
+ },
+ ],
+ },
+
+ 'prospect_contact' => {
+ 'columns' => [
+ 'prospectcontactnum', 'serial', '', '', '', '',
+ 'prospectnum', 'int', '', '', '', '',
+ 'contactnum', 'int', '', '', '', '',
+ 'classnum', 'int', 'NULL', '', '', '',
+ 'comment', 'varchar', 'NULL', 255, '', '',
+ ],
+ 'primary_key' => 'prospectcontactnum',
+ 'unique' => [ [ 'prospectnum', 'contactnum' ], ],
+ 'index' => [ [ 'prospectnum' ], [ 'contactnum' ], ],
+ 'foreign_keys' => [
+ { columns => [ 'prospectnum' ],
+ table => 'prospect_main',
+ },
+ { columns => [ 'contactnum' ],
+ table => 'contact',
+ },
+ { columns => [ 'classnum' ],
+ table => 'contact_class',
+ },
+ ],
+ },
+
'contact' => {
'columns' => [
'contactnum', 'serial', '', '', '', '',
- 'prospectnum', 'int', 'NULL', '', '', '',
- 'custnum', 'int', 'NULL', '', '', '',
+ 'prospectnum', 'int', 'NULL', '', '', '', #deprecated, now prospect_contact table
+ 'custnum', 'int', 'NULL', '', '', '', #deprecated, now cust_contact table
'locationnum', 'int', 'NULL', '', '', '', #not yet
- 'classnum', 'int', 'NULL', '', '', '',
+ 'classnum', 'int', 'NULL', '', '', '', #deprecated, now prospect_contact or cust_contact
# 'titlenum', 'int', 'NULL', '', '', '', #eg Mr. Mrs. Dr. Rev.
'last', 'varchar', '', $char_d, '', '',
# 'middle', 'varchar', 'NULL', $char_d, '', '',
'first', 'varchar', '', $char_d, '', '',
'title', 'varchar', 'NULL', $char_d, '', '', #eg Head Bottle Washer
- 'comment', 'varchar', 'NULL', 255, '', '',
- 'selfservice_access', 'char', 'NULL', 1, '', '',
+ 'comment', 'varchar', 'NULL', 255, '', '', #depredated, now prospect_contact or cust_contact
+ 'selfservice_access', 'char', 'NULL', 1, '', '', #deprecated, now cust_contact
'_password', 'varchar', 'NULL', $char_d, '', '',
'_password_encoding', 'varchar', 'NULL', $char_d, '', '',
'disabled', 'char', 'NULL', 1, '', '',
+ 'invoice_dest', 'char', 'NULL', 1, '', '',
],
'primary_key' => 'contactnum',
'unique' => [],
'disabled', 'char', 'NULL', 1, '', '',
'custnum', 'int', 'NULL', '', '', '',
'refnum', 'int', 'NULL', '', '', '',
+ 'taxstatusnum', 'int', 'NULL', '', '', '',
],
'primary_key' => 'prospectnum',
'unique' => [],
'_date', @date_type, '', '',
'disabled', 'char', 'NULL', 1, '', '',
'usernum', 'int', 'NULL', '', '', '',
+ 'close_date', @date_type, '', '',
+ 'confidence', 'int', 'NULL', '', '', '',
#'total', @money_type, '', '',
#'quotation_term', 'varchar', 'NULL', $char_d, '', '',
],
'contract_end', @date_type, '', '',
'quantity', 'int', 'NULL', '', '', '',
'waive_setup', 'char', 'NULL', 1, '', '',
+ 'unitsetup', @money_typen, '', '',
+ 'unitrecur', @money_typen, '', '',
],
'primary_key' => 'quotationpkgnum',
'unique' => [],
],
},
+ 'quotation_pkg_detail' => {
+ 'columns' => [
+ 'detailnum', 'serial', '', '', '', '',
+ 'quotationpkgnum', 'int', '', '', '', '',
+ 'format', 'char', 'NULL', 1, '', '', # not used for anything
+ 'detail', 'varchar', '', 255, '', '',
+ 'copy_on_order', 'char', 'NULL', 1, '', '', # 'Y' to copy when ordering
+ ],
+ 'primary_key' => 'detailnum',
+ 'unique' => [],
+ 'index' => [ [ 'quotationpkgnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'quotationpkgnum' ],
+ table => 'quotation_pkg',
+ references => [ 'quotationpkgnum' ],
+ },
+ ],
+ },
+
'quotation_pkg_discount' => {
'columns' => [
'quotationpkgdiscountnum', 'serial', '', '', '', '',
'quotationpkgnum', 'int', '', '', '', '',
'discountnum', 'int', '', '', '', '',
+ 'setuprecur', 'varchar', 'NULL', $char_d, '', '',
+ 'amount', @money_typen, '', '',
#'end_date', @date_type, '', '',
],
'primary_key' => 'quotationpkgdiscountnum',
],
},
+ 'quotation_pkg_tax' => {
+ 'columns' => [
+ 'quotationtaxnum', 'serial', '', '', '', '',
+ 'quotationpkgnum', 'int', '', '', '', '',
+ 'itemdesc', 'varchar', '', $char_d, '', '',
+ 'setup_amount', @money_type, '', '',
+ 'recur_amount', @money_type, '', '',
+ ],
+ 'primary_key' => 'quotationtaxnum',
+ 'unique' => [],
+ 'index' => [ [ 'quotationpkgnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'quotationpkgnum' ],
+ table => 'quotation_pkg',
+ },
+ ],
+ },
+
'cust_location' => { #'location' now that its prospects too, but...
'columns' => [
'locationnum', 'serial', '', '', '', '',
'locationname', 'varchar', 'NULL', $char_d, '', '',
'address1', 'varchar', '', $char_d, '', '',
'address2', 'varchar', 'NULL', $char_d, '', '',
- 'city', 'varchar', '', $char_d, '', '',
+ 'city', 'varchar', 'NULL', $char_d, '', '',
'county', 'varchar', 'NULL', $char_d, '', '',
'state', 'varchar', 'NULL', $char_d, '', '',
'zip', 'varchar', 'NULL', 10, '', '',
'cust_main_note' => {
'columns' => [
- 'notenum', 'serial', '', '', '', '',
- 'custnum', 'int', '', '', '', '',
- 'classnum', 'int', 'NULL', '', '', '',
- '_date', @date_type, '', '',
- 'otaker', 'varchar', 'NULL', 32, '', '',
- 'usernum', 'int', 'NULL', '', '', '',
- 'comments', 'text', 'NULL', '', '', '',
+ 'notenum', 'serial', '', '', '', '',
+ 'custnum', 'int', '', '', '', '',
+ 'classnum', 'int', 'NULL', '', '', '',
+ '_date', @date_type, '', '',
+ 'otaker', 'varchar', 'NULL', 32, '', '',
+ 'usernum', 'int', 'NULL', '', '', '',
+ 'comments', 'text', 'NULL', '', '', '',
+ 'sticky', 'int', '', '', 0, '',
],
'primary_key' => 'notenum',
'unique' => [],
'taxname', 'varchar', 'NULL', $char_d, '', '',
'setuptax', 'char', 'NULL', 1, '', '', # Y = setup tax exempt
'recurtax', 'char', 'NULL', 1, '', '', # Y = recur tax exempt
+ 'source', 'varchar', 'NULL', $char_d, '', '',
],
'primary_key' => 'taxnum',
'unique' => [],
'payunique', 'varchar', 'NULL', $char_d, '', '',#separate paybatch "unique" functions from current usage
'closed', 'char', 'NULL', 1, '', '',
'pkgnum', 'int', 'NULL', '', '', '', #desired pkgnum for pkg-balances
+ 'no_auto_apply', 'char', 'NULL', 1, '', '',
# cash/check deposit info fields
'bank', 'varchar', 'NULL', $char_d, '', '',
#void fields
'void_date', @date_type, '', '',
'reason', 'varchar', 'NULL', $char_d, '', '',
+ 'reasonnum', 'int', 'NULL', '', '', '',
'void_usernum', 'int', 'NULL', '', '', '',
],
'primary_key' => 'paynum',
{ columns => [ 'gatewaynum' ],
table => 'payment_gateway',
},
+ { columns => [ 'reasonnum' ],
+ table => 'reason',
+ },
{ columns => [ 'void_usernum' ],
table => 'access_user',
references => [ 'usernum' ],
'download', @date_type, '', '',
'upload', @date_type, '', '',
'title', 'varchar', 'NULL',255, '', '',
+ 'processor_id', 'varchar', 'NULL',255, '', '',
],
'primary_key' => 'batchnum',
'unique' => [],
'first', 'varchar', '', $char_d, '', '',
'address1', 'varchar', '', $char_d, '', '',
'address2', 'varchar', 'NULL', $char_d, '', '',
- 'city', 'varchar', '', $char_d, '', '',
+ 'city', 'varchar', 'NULL', $char_d, '', '',
'state', 'varchar', 'NULL', $char_d, '', '',
'zip', 'varchar', 'NULL', 10, '', '',
'country', 'char', '', 2, '', '',
#'exp', @date_type, '', '',
'exp', 'varchar', 'NULL', 11, '', '',
'payname', 'varchar', 'NULL', $char_d, '', '',
+ 'paytype', 'varchar', 'NULL', $char_d, '', '',
'amount', @money_type, '', '',
'currency', 'char', 'NULL', 3, '', '',
'status', 'varchar', 'NULL', $char_d, '', '',
{ columns => [ 'batchnum' ],
table => 'pay_batch',
},
- { columns => [ 'invnum' ],
- table => 'cust_bill',
- },
+ #{ columns => [ 'invnum' ],
+ # table => 'cust_bill',
+ #},
{ columns => [ 'custnum' ],
table => 'cust_main',
},
'change_custnum', 'int', 'NULL', '', '', '',
'main_pkgnum', 'int', 'NULL', '', '', '',
'pkglinknum', 'int', 'NULL', '', '', '',
- 'manual_flag', 'char', 'NULL', 1, '', '',
'no_auto', 'char', 'NULL', 1, '', '',
'quantity', 'int', 'NULL', '', '', '',
'agent_pkgid', 'varchar', 'NULL', $char_d, '', '',
'recur_show_zero', 'char', 'NULL', 1, '', '',
'setup_show_zero', 'char', 'NULL', 1, '', '',
'change_to_pkgnum', 'int', 'NULL', '', '', '',
+ 'separate_bill', 'char', 'NULL', 1, '', '',
],
'primary_key' => 'pkgnum',
'unique' => [],
'cust_pkg_detail' => {
'columns' => [
- 'pkgdetailnum', 'serial', '', '', '', '',
- 'pkgnum', 'int', '', '', '', '',
- 'detail', 'varchar', '', $char_d, '', '',
- 'detailtype', 'char', '', 1, '', '', # "I"nvoice or "C"omment
- 'weight', 'int', '', '', '', '',
+ 'pkgdetailnum', 'serial', '', '', '', '',
+ 'pkgnum', 'int', '', '', '', '',
+ 'detail', 'varchar', '', 2*$char_d, '', '',
+ 'detailtype', 'char', '', 1, '', '', #"I"nvoice or "C"omment
+ 'weight', 'int', '', '', '', '',
],
'primary_key' => 'pkgdetailnum',
'unique' => [],
],
},
+ 'cust_pkg_reason_fee' => {
+ 'columns' => [
+ 'pkgreasonfeenum', 'serial', '', '', '', '',
+ 'pkgreasonnum', 'int', '', '', '', '',
+ 'billpkgnum', 'int', 'NULL', '', '', '',
+ 'feepart', 'int', '', '', '', '',
+ 'nextbill', 'char', 'NULL', 1, '', '',
+ ],
+ 'primary_key' => 'pkgreasonfeenum',
+ 'unique' => [ [ 'billpkgnum' ], [ 'pkgreasonnum' ] ], # one-to-one link
+ 'index' => [ [ 'feepart' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'pkgreasonnum' ],
+ table => 'cust_pkg_reason',
+ references => [ 'num' ],
+ },
+ { columns => [ 'feepart' ],
+ table => 'part_fee',
+ },
+ # can't link billpkgnum, because of voids
+ ],
+ },
+
'cust_pkg_discount' => {
'columns' => [
'pkgdiscountnum', 'serial', '', '', '', '',
'otaker', 'varchar', 'NULL', 32, '', '',
'usernum', 'int', 'NULL', '', '', '',
'disabled', 'char', 'NULL', 1, '', '',
+ 'setuprecur', 'char', 'NULL', 5, '', '',
],
'primary_key' => 'pkgdiscountnum',
'unique' => [],
'paymask', 'varchar', 'NULL', $char_d, '', '',
'paybatch', 'varchar', 'NULL', $char_d, '', '',
'closed', 'char', 'NULL', 1, '', '',
+ 'source_paynum', 'int', 'NULL', '', '', '', # link to cust_payby, to prevent unapply of gateway-generated refunds
# credit card/EFT fields (formerly in paybatch)
'gatewaynum', 'int', 'NULL', '', '', '', # payment_gateway FK
'processor', 'varchar', 'NULL', $char_d, '', '', # module name
{ columns => [ 'gatewaynum' ],
table => 'payment_gateway',
},
+ { columns => [ 'source_paynum' ],
+ table => 'cust_pay',
+ references => [ 'paynum' ],
+ },
],
},
'delay_start', 'int', 'NULL', '', '', '',
'start_on_hold', 'char', 'NULL', 1, '', '',
'agent_pkgpartid', 'varchar', 'NULL', 20, '', '',
+ 'expire_months', 'int', 'NULL', '', '', '',
+ 'adjourn_months', 'int', 'NULL', '', '', '',
+ 'contract_end_months','int','NULL', '', '', '',
+ 'change_to_pkgpart', 'int', 'NULL', '', '', '',
],
'primary_key' => 'pkgpart',
'unique' => [],
table => 'part_pkg',
references => [ 'pkgpart' ],
},
+ { columns => [ 'change_to_pkgpart' ],
+ table => 'part_pkg',
+ references => [ 'pkgpart' ],
+ },
],
},
'primary_svc', 'char', 'NULL', 1, '', '',
'hidden', 'char', 'NULL', 1, '', '',
'bulk_skip', 'char', 'NULL', 1, '', '',
+ 'provision_hold', 'char', 'NULL', 1, '', '',
],
'primary_key' => 'pkgsvcnum',
'unique' => [ ['pkgpart', 'svcpart'] ],
'columnlabel', 'varchar', 'NULL', $char_d, '', '',
'columnvalue', 'varchar', 'NULL', 512, '', '',
'columnflag', 'char', 'NULL', 1, '', '',
+ 'required', 'char', 'NULL', 1, '', '',
],
'primary_key' => 'columnnum',
'unique' => [ [ 'svcpart', 'columnname' ] ],
'index' => [ ['disabled'] ],
},
+ 'part_svc_link' => {
+ 'columns' => [
+ 'svclinknum', 'serial', '', '', '', '',
+ #'linkname', 'varchar', 'NULL', $char_d, '', '',
+ 'agentnum', 'int', 'NULL', '', '', '',
+ 'src_svcpart', 'int', '', '', '', '',
+ 'dst_svcpart', 'int', '', '', '', '',
+ 'link_type', 'varchar', '', $char_d, '', '',
+ 'disabled', 'char', 'NULL', 1, '', '',
+ ],
+ 'primary_key' => 'svclinknum',
+ 'unique' => [ ['agentnum','src_svcpart','dst_svcpart','link_type'] ],
+ 'index' => [ [ 'src_svcpart' ], [ 'src_svcpart', 'link_type' ], [ 'disabled' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'src_svcpart' ],
+ table => 'part_svc',
+ references => [ 'svcpart' ]
+ },
+ { columns => [ 'dst_svcpart' ],
+ table => 'part_svc',
+ references => [ 'svcpart' ]
+ },
+ ],
+ },
+
#(this should be renamed to part_pop)
'svc_acct_pop' => {
'columns' => [
'custnum', 'int', 'NULL', '', '', '',
'secure', 'char', 'NULL', 1, '', '',
'priority', 'int', 'NULL', '', '', '',
+ 'usernum', 'int', 'NULL', '', '', '',
],
'primary_key' => 'jobnum',
'unique' => [],
{ columns => [ 'custnum' ],
table => 'cust_main',
},
+ { columns => [ 'usernum' ],
+ table => 'access_user',
+ },
],
},
'exporttype', 'varchar', '', $char_d, '', '',
'nodomain', 'char', 'NULL', 1, '', '',
'default_machine','int', 'NULL', '', '', '',
+ 'no_suspend', 'char', 'NULL', 1, '', '',
+ # could also have 'no_insert', 'no_replace', etc.
],
'primary_key' => 'exportnum',
'unique' => [],
#'custnum', 'int', '', '', '', ''
'billpkgnum', 'int', '', '', '', '',
'taxnum', 'int', '', '', '', '',
+ 'taxtype', 'varchar', 'NULL', $char_d, '', '',
'year', 'int', 'NULL', '', '', '',
'month', 'int', 'NULL', '', '', '',
'creditbillpkgnum', 'int', 'NULL', '', '', '',
'unique' => [],
'index' => [ [ 'taxnum', 'year', 'month' ],
[ 'billpkgnum' ],
- [ 'taxnum' ],
+ [ 'taxnum', 'taxtype' ],
[ 'creditbillpkgnum' ],
],
'foreign_keys' => [
{ columns => [ 'billpkgnum' ],
table => 'cust_bill_pkg',
},
- { columns => [ 'taxnum' ],
- table => 'cust_main_county',
- },
{ columns => [ 'creditbillpkgnum' ],
table => 'cust_credit_bill_pkg',
},
#'custnum', 'int', '', '', '', ''
'billpkgnum', 'int', '', '', '', '',
'taxnum', 'int', '', '', '', '',
+ 'taxtype', 'varchar', 'NULL', $char_d, '', '',
'year', 'int', 'NULL', '', '', '',
'month', 'int', 'NULL', '', '', '',
'creditbillpkgnum', 'int', 'NULL', '', '', '',
'unique' => [],
'index' => [ [ 'taxnum', 'year', 'month' ],
[ 'billpkgnum' ],
- [ 'taxnum' ],
+ [ 'taxnum', 'taxtype' ],
[ 'creditbillpkgnum' ],
],
'foreign_keys' => [
'banned_pay' => {
'columns' => [
- 'bannum', 'serial', '', '', '', '',
- 'payby', 'char', '', 4, '', '',
- 'payinfo', 'varchar', '', 128, '', '', #say, a 512-big digest _hex encoded
- #'paymask', 'varchar', 'NULL', $char_d, '', ''
- '_date', @date_type, '', '',
- 'end_date', @date_type, '', '',
- 'otaker', 'varchar', 'NULL', 32, '', '',
- 'usernum', 'int', 'NULL', '', '', '',
- 'bantype', 'varchar', 'NULL', $char_d, '', '',
- 'reason', 'varchar', 'NULL', $char_d, '', '',
+ 'bannum', 'serial', '', '', '', '',
+ 'payby', 'char', '', 4, '', '',
+ 'payinfo', 'varchar', '', 128, '', '', #say, a 512-big digest _hex encoded
+ 'payinfo_hash', 'varchar', 'NULL', 32, '', '',
+ #'paymask', 'varchar', 'NULL', $char_d, '', ''
+ '_date', @date_type, '', '',
+ 'end_date', @date_type, '', '',
+ 'otaker', 'varchar', 'NULL', 32, '', '',
+ 'usernum', 'int', 'NULL', '', '', '',
+ 'bantype', 'varchar', 'NULL', $char_d, '', '',
+ 'reason', 'varchar', 'NULL', $char_d, '', '',
],
'primary_key' => 'bannum',
'unique' => [],
'rated_ratedetailnum', 'int', 'NULL', '', '', '',
'rated_classnum', 'int', 'NULL', '', '', '',
'rated_ratename', 'varchar', 'NULL', $char_d, '', '',
+ 'rated_cost', 'decimal', 'NULL', '10,4', '', '',
'carrierid', 'bigint', 'NULL', '', '', '',
[ 'freesidestatus' ], [ 'freesiderewritestatus' ],
[ 'cdrbatch' ], [ 'cdrbatchnum' ],
[ 'src_ip_addr' ], [ 'dst_ip_addr' ], [ 'dst_term' ],
+ [ 'detailnum' ],
],
#no FKs on cdr table... choosing not to throw errors no matter what's
# thrown in here. better to have the data.
'index' => [],
},
+ 'access_user_log' => {
+ 'columns' => [
+ 'lognum', 'serial', '', '', '', '',
+ 'usernum', 'int', '', '', '', '',
+ 'path', 'varchar', '', 2*$char_d, '', '',
+ '_date', @date_type, '', '',
+ 'render_seconds', 'int', 'NULL', '', '', '',
+ ],
+ 'primary_key' => 'lognum',
+ 'unique' => [],
+ 'index' => [ ['usernum'], ['path'], ['_date'] ],
+ },
+
'sched_item' => {
'columns' => [
'itemnum', 'serial', '', '', '', '',
'pbxsvc', 'int', 'NULL', '', '', '',
'domsvc', 'int', 'NULL', '', '', '',
'locationnum', 'int', 'NULL', '', '', '',
+ 'forward_svcnum', 'int', 'NULL', '', '', '',
'forwarddst', 'varchar', 'NULL', 15, '', '',
'email', 'varchar', 'NULL', 255, '', '',
'lnp_status', 'varchar', 'NULL', $char_d, '', '',
'devicepart', 'serial', '', '', '', '',
'devicename', 'varchar', '', $char_d, '', '',
'inventory_classnum', 'int', 'NULL', '', '', '',
+ 'title', 'varchar', 'NULL', $char_d, '', '',
],
'primary_key' => 'devicepart',
'unique' => [ [ 'devicename' ] ], #?
'unsuspend_pkgpart', 'int', 'NULL', '', '', '',
'unsuspend_hold','char', 'NULL', 1, '', '',
'unused_credit', 'char', 'NULL', 1, '', '',
+ 'feepart', 'int', 'NULL', '', '', '',
+ 'fee_on_unsuspend','char', 'NULL', 1, '', '',
+ 'fee_hold', 'char', 'NULL', 1, '', '',
],
'primary_key' => 'reasonnum',
'unique' => [],
'mime_type', 'varchar', '', $char_d, '', '',
'body', 'blob', 'NULL', '', '', '',
'disabled', 'char', 'NULL', 1, '', '',
+ # migrate these to msg_template_email
'from_addr', 'varchar', 'NULL', 255, '', '',
'bcc_addr', 'varchar', 'NULL', 255, '', '',
+ # change to not null on v5
+ 'msgclass', 'varchar', 'NULL', 16, '', '',
],
'primary_key' => 'msgnum',
'unique' => [ ],
],
},
+ 'msg_template_http' => {
+ 'columns' => [
+ 'num', 'serial', '', '', '', '',
+ 'msgnum', 'int', '', '', '', '',
+ 'prepare_url', 'varchar', 'NULL', 255, '', '',
+ 'send_url', 'varchar', 'NULL', 255, '', '',
+ 'username', 'varchar', 'NULL', $char_d, '', '',
+ 'password', 'varchar', 'NULL', $char_d, '', '',
+ 'content', 'text', 'NULL', '', '', '',
+ ],
+ 'primary_key' => 'num',
+ 'unique' => [ [ 'msgnum' ], ],
+ 'index' => [ ],
+ 'foreign_keys' => [
+ { columns => [ 'msgnum' ],
+ table => 'msg_template',
+ },
+ ],
+ },
+
'template_content' => {
'columns' => [
'contentnum', 'serial', '', '', '', '',
],
},
+ 'template_image' => {
+ 'columns' => [
+ 'imgnum', 'serial', '', '', '', '',
+ 'name', 'varchar', '', $char_d, '', '',
+ 'agentnum', 'int', 'NULL', '', '', '',
+ 'mime_type', 'varchar', '', $char_d, '', '',
+ 'base64', 'text', '', '', '', '',
+ ],
+ 'primary_key' => 'imgnum',
+ 'unique' => [ ],
+ 'index' => [ ['name'], ['agentnum'] ],
+ },
+
'cust_msg' => {
'columns' => [
'custmsgnum', 'serial', '', '', '', '',
'error', 'varchar', 'NULL', 255, '', '',
'status', 'varchar', '',$char_d, '', '',
'msgtype', 'varchar', 'NULL', 16, '', '',
+ 'preview', 'text', 'NULL', '', '', '',
],
'primary_key' => 'custmsgnum',
'unique' => [ ],
],
},
+ 'log_email' => {
+ 'columns' => [
+ 'logemailnum', 'serial', '', '', '', '',
+ 'context', 'varchar', 'NULL', $char_d, '', '',
+ 'min_level', 'int', 'NULL', '', '', '',
+ 'msgnum', 'int', '', '', '', '',
+ 'to_addr', 'varchar', 'NULL', 255, '', '',
+ ],
+ 'primary_key' => 'logemailnum',
+ 'unique' => [],
+ 'index' => [ ['context'], ['min_level'] ],
+ 'foreign_keys' => [
+ { columns => [ 'msgnum' ],
+ table => 'msg_template',
+ references => [ 'msgnum' ],
+ },
+ ],
+ },
+
'svc_alarm' => {
'columns' => [
# name type null length default local
],
},
+ 'svc_fiber' => {
+ 'columns' => [
+ 'svcnum', 'int', '', '', '', '',
+ 'oltnum', 'int', 'NULL', '', '', '',
+ 'shelf', 'int', 'NULL', '', '', '',
+ 'card', 'int', 'NULL', '', '', '',
+ 'olt_port', 'int', 'NULL', '', '', '',
+ 'ont_id', 'int', 'NULL', '', '', '',
+ 'ont_typenum', 'int', 'NULL', '', '', '',
+ 'ont_serial', 'varchar', 'NULL', $char_d, '', '',
+ 'ont_port', 'varchar', 'NULL', 16, '', '',
+ 'circuit_id', 'varchar', 'NULL', $char_d, '', '',
+ 'vlan', 'int', 'NULL', '', '', '',
+ 'signal', 'decimal', 'NULL', '10,2', '', '',
+ 'speed_up', 'int', 'NULL', '', '', '',
+ 'speed_down', 'int', 'NULL', '', '', '',
+ 'ont_install','varchar', 'NULL', $char_d, '', '',
+ ],
+ 'primary_key' => 'svcnum',
+ 'unique' => [ ],
+ 'index' => [ [ 'ont_serial' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ },
+ { columns => [ 'oltnum' ],
+ table => 'fiber_olt',
+ },
+ { columns => [ 'ont_typenum' ],
+ table => 'hardware_type',
+ references => [ 'typenum' ],
+ },
+ ],
+ },
+
+ 'fiber_olt' => {
+ 'columns' => [
+ 'oltnum', 'serial', '', '', '', '',
+ 'oltname', 'varchar', '', $char_d, '', '',
+ 'sitenum', 'int', 'NULL', '', '', '',
+ 'serial', 'varchar', '', $char_d, '', '',
+ 'disabled', 'char', 'NULL', 1, '', '',
+ ],
+ 'primary_key' => 'oltnum',
+ 'unique' => [ ],
+ 'index' => [ ],
+ 'foreign_keys' => [
+ { columns => [ 'sitenum' ],
+ table => 'olt_site',
+ },
+ ],
+ },
+
+ 'olt_site' => {
+ 'columns' => [
+ 'sitenum', 'serial', '', '', '', '',
+ 'market', 'varchar', '', $char_d, '', '',
+ 'site', 'varchar', '', $char_d, '', '',
+ ],
+ 'primary_key' => 'sitenum',
+ 'unique' => [ [ 'market', 'site' ] ],
+ 'index' => [ ],
+ },
+
+
+
+
+
'vend_main' => {
'columns' => [
'vendnum', 'serial', '', '', '', '',
'latexsmallfooter', 'text', 'NULL', '', '', '',
'latexreturnaddress', 'text', 'NULL', '', '', '',
'with_latexcoupon', 'char', 'NULL', '1', '', '',
+ 'htmlwatermark', 'text', 'NULL', '', '', '',
+ 'latexwatermark', 'text', 'NULL', '', '', '',
'lpr', 'varchar', 'NULL', $char_d, '', '',
],
'primary_key' => 'confnum',
'zonenum', 'serial', '', '', '', '',
'description', 'char', 'NULL', $char_d, '', '',
'agentnum', 'int', '', '', '', '',
+ 'censusyear', 'char', 'NULL', 4, '', '',
'dbaname', 'char', 'NULL', $char_d, '', '',
'zonetype', 'char', '', 1, '', '',
'technology', 'int', '', '', '', '',
'blocknum', 'serial', '', '', '', '',
'zonenum', 'int', '', '', '', '',
'censusblock', 'char', '', 15, '', '',
- 'censusyear', 'char', '', 4, '', '',
+ 'censusyear', 'char','NULL', 4, '', '',
],
'primary_key' => 'blocknum',
'unique' => [],
],
},
+ 'cacti_page' => {
+ 'columns' => [
+ 'cacti_pagenum', 'serial', '', '', '', '',
+ 'exportnum', 'int', 'NULL', '', '', '',
+ 'svcnum', 'int', 'NULL', '', '', '',
+ 'graphnum', 'int', 'NULL', '', '', '',
+ 'imported', @date_type, '', '',
+ 'content', 'text', 'NULL', '', '', '',
+ ],
+ 'primary_key' => 'cacti_pagenum',
+ 'unique' => [ ],
+ 'index' => [ ['svcnum'], ['imported'] ],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ references => [ 'svcnum' ],
+ },
+ { columns => [ 'exportnum' ],
+ table => 'part_export',
+ references => [ 'exportnum' ],
+ },
+ ],
+ },
+ 'report_batch' => {
+ 'columns' => [
+ 'reportbatchnum', 'serial', '', '', '', '',
+ 'reportname', 'varchar', '', 255, '', '',
+ 'agentnum', 'int', 'NULL', '', '', '',
+ 'send_date', @date_type, '', '',
+ 'sdate', @date_type, '', '',
+ 'edate', @date_type, '', '',
+ 'usernum', 'int', 'NULL', '', '', '',
+ 'msgnum', 'int', 'NULL', '', '', '',
+ # add report params here as necessary
+ ],
+ 'primary_key' => 'reportbatchnum',
+ 'unique' => [],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ references => [ 'agentnum' ],
+ },
+ { columns => [ 'usernum' ],
+ table => 'access_user',
+ references => [ 'usernum' ],
+ },
+ { columns => [ 'msgnum' ],
+ table => 'msg_template',
+ references => [ 'msgnum' ],
+ },
+ ],
+ },
-
+ 'password_history' => {
+ 'columns' => [
+ 'passwordnum', 'serial', '', '', '', '',
+ '_password', 'varchar', 'NULL', $char_d, '', '',
+ 'encryption_method', 'varchar', 'NULL', $char_d, '', '',
+ 'created', @date_type, '', '',
+ # each table that needs password history gets a column here, and
+ # an entry in foreign_keys.
+ 'svc_acct__svcnum', 'int', 'NULL', '', '', '',
+ 'svc_dsl__svcnum', 'int', 'NULL', '', '', '',
+ 'svc_alarm__svcnum', 'int', 'NULL', '', '', '',
+ 'agent__agentnum', 'int', 'NULL', '', '', '',
+ 'contact__contactnum', 'int', 'NULL', '', '', '',
+ 'access_user__usernum', 'int', 'NULL', '', '', '',
+ ],
+ 'primary_key' => 'passwordnum',
+ 'unique' => [],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'svc_acct__svcnum' ],
+ table => 'svc_acct',
+ references => [ 'svcnum' ],
+ },
+ { columns => [ 'svc_dsl__svcnum' ],
+ table => 'svc_dsl',
+ references => [ 'svcnum' ],
+ },
+ { columns => [ 'svc_alarm__svcnum' ],
+ table => 'svc_alarm',
+ references => [ 'svcnum' ],
+ },
+ { columns => [ 'agent__agentnum' ],
+ table => 'agent',
+ references => [ 'agentnum' ],
+ },
+ { columns => [ 'contact__contactnum' ],
+ table => 'contact',
+ references => [ 'contactnum' ],
+ },
+ { columns => [ 'access_user__usernum' ],
+ table => 'access_user',
+ references => [ 'usernum' ],
+ },
+ ],
+ },
# name type nullability length default local