my $tables_hashref_torrus = tables_hashref_torrus();
- #create history tables (false laziness w/create-history-tables)
+ #create history tables
foreach my $table (
- grep { ! /^clientapi_session/
+ grep { ! /^(clientapi|access_user)_session/
&& ! /^h_/
&& ! /^log(_context)?$/
&& ! /^legacy_cust_history$/
&& ( ! /^queue(_arg|_depend|_stat)?$/ || ! $opt->{'queue-no_history'} )
&& ! $tables_hashref_torrus->{$_}
+ && ! /^cacti_page$/
}
$dbdef->tables
) {
],
},
+ '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'],
+ ],
+ },
+
+
'cust_bill_pkg_tax_location' => {
'columns' => [
'billpkgtaxlocationnum', 'serial', '', '', '', '',
'unitsetup', @money_typen, '', '',
'unitrecur', @money_typen, '', '',
'hidden', 'char', 'NULL', 1, '', '',
+ 'feepart', 'int', 'NULL', '', '', '',
#void fields
'void_date', @date_type, '', '',
'reason', 'varchar', 'NULL', $char_d, '', '',
'_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, '', '',
],
'index' => [ ['pkgpart'], ],
},
+ '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', '', '', '', '',
'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, '', '',
'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, '', '',
'depositor', 'varchar', 'NULL', $char_d, '', '',
'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, '', '',
'index' => [ [ 'pkgnum' ], [ 'reasonnum' ], ['action'], [ 'usernum' ], ],
},
+ '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' ] ],
+ },
+
'cust_pkg_discount' => {
'columns' => [
'pkgdiscountnum', 'serial', '', '', '', '',
'refund', @money_type, '', '',
'otaker', 'varchar', 'NULL', 32, '', '',
'usernum', 'int', 'NULL', '', '', '',
- 'reason', 'varchar', '', $char_d, '', '',
+ 'reason', 'varchar', 'NULL', $char_d, '', '',
+ 'reasonnum', 'int', 'NULL', '', '', '',
'payby', 'char', '', 4, '', '', # CARD/BILL/COMP, should
# be index into payby
# table eventually
'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
'quantity', 'int', '', '', '', '',
'primary_svc','char', 'NULL', 1, '', '',
'hidden', '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' ] ],
'custnum', 'int', 'NULL', '', '', '',
'secure', 'char', 'NULL', 1, '', '',
'priority', 'int', 'NULL', '', '', '',
+ 'usernum', 'int', 'NULL', '', '', '',
],
'primary_key' => 'jobnum',
'unique' => [],
'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' => [],
'rated_ratedetailnum', 'int', 'NULL', '', '', '',
'rated_classnum', 'int', 'NULL', '', '', '',
'rated_ratename', 'varchar', 'NULL', $char_d, '', '',
+ 'rated_cost', 'decimal', 'NULL', '10,4', '', '',
'carrierid', 'bigint', 'NULL', '', '', '',
#new
'cdrbatchnum', 'int', 'NULL', '', '', '',
+ # FK to cust_bill_pkg_detail; having a value here absolutely means
+ # that the CDR appears on an invoice
+ 'detailnum', 'bigint', 'NULL', '', '', '',
],
'primary_key' => 'acctid',
'unique' => [],
'index' => [],
},
+ 'access_user_session' => {
+ 'columns' => [
+ 'sessionnum', 'serial', '', '', '', '',
+ 'sessionkey', 'varchar', '', $char_d, '', '',
+ 'usernum', 'int', '', '', '', '',
+ 'start_date', @date_type, '', '',
+ 'last_date', @date_type, '', '',
+ ],
+ 'primary_key' => 'sessionnum',
+ 'unique' => [ [ 'sessionkey' ] ],
+ 'index' => [],
+ },
+
'access_user' => {
'columns' => [
'usernum', 'serial', '', '', '', '',
'index' => [],
},
+ 'access_user_log' => {
+ 'columns' => [
+ 'lognum', 'serial', '', '', '', '',
+ 'usernum', 'int', '', '', '', '',
+ 'path', 'varchar', '', 2*$char_d, '', '',
+ '_date', @date_type, '', '',
+ ],
+ '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' => [],
'unique' => [],
'index' => [ [ 'providernum' ], [ 'typenum' ] ],
},
+
+ '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' ] ],
+ },
+
+ 'fiber_olt' => {
+ 'columns' => [
+ 'oltnum', 'serial', '', '', '', '',
+ 'oltname', 'varchar', '', $char_d, '', '',
+ 'sitenum', 'int', '', '', '', '',
+ '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', '', '', '', '',
+ 'vendname', 'varchar', '', $char_d, '', '',
+ 'classnum', 'int', '', '', '', '',
+ 'disabled', 'char', 'NULL', 1, '', '',
+ ],
+ 'primary_key' => 'vendnum',
+ 'unique' => [ ['vendname', 'disabled'] ],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'classnum' ],
+ table => 'vend_class',
+ },
+ ],
+ },
+
+ 'vend_class' => {
+ 'columns' => [
+ 'classnum', 'serial', '', '', '', '',
+ 'classname', 'varchar', '', $char_d, '', '',
+ 'disabled', 'char', 'NULL', 1, '', '',
+ ],
+ 'primary_key' => 'classnum',
+ 'unique' => [],
+ 'index' => [ ['disabled'] ],
+ },
+
+ 'vend_bill' => {
+ 'columns' => [
+ 'vendbillnum', 'serial', '', '', '', '',
+ 'vendnum', 'int', '', '', '', '',
+ #'_date', @date_type, '', '',
+ '_date', 'int', '', '', '', '',
+ 'charged', @money_type, '', '',
+ ],
+ 'primary_key' => 'vendbillnum',
+ 'unique' => [],
+ 'index' => [ ['vendnum'], ['_date'], ],
+ 'foreign_keys' => [
+ { columns => [ 'vendnum' ],
+ table => 'vend_main',
+ },
+ ],
+ },
+
+ 'vend_pay' => {
+ 'columns' => [
+ 'vendpaynum', 'serial', '', '', '', '',
+ 'vendnum', 'int', '', '', '', '',
+ #'_date', @date_type, '', '',
+ '_date', 'int', '', '', '', '',
+ 'paid', @money_type, '', '',
+ ],
+ 'primary_key' => 'vendpaynum',
+ 'unique' => [],
+ 'index' => [ [ 'vendnum' ], [ '_date' ], ],
+ 'foreign_keys' => [
+ { columns => [ 'vendnum' ],
+ table => 'vend_main',
+ },
+ ],
+ },
+
+ 'vend_bill_pay' => {
+ 'columns' => [
+ 'vendbillpaynum', 'serial', '', '', '', '',
+ 'vendbillnum', 'int', '', '', '', '',
+ 'vendpaynum', 'int', '', '', '', '',
+ 'amount', @money_type, '', '',
+ #? '_date', @date_type, '', '',
+ ],
+ 'primary_key' => 'vendbillpaynum',
+ 'unique' => [],
+ 'index' => [ [ 'vendbillnum' ], [ 'vendpaynum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'vendbillnum' ],
+ table => 'vend_bill',
+ },
+ { columns => [ 'vendpaynum' ],
+ table => 'vend_pay',
+ },
+ ],
+ },
%{ tables_hashref_torrus() },
# tables of ours for doing torrus virtual port combining
'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' => [],
'index' => [ ],
},
+ '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'] ],
+ },
+ '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