[freeside-commits] branch master updated. 9c2f7147ea99459d69c7264a7a7c7a80f6f3d5a0
Ivan
ivan at 420.am
Sun Nov 3 21:15:02 PST 2013
The branch, master has been updated
via 9c2f7147ea99459d69c7264a7a7c7a80f6f3d5a0 (commit)
from cf4e690746ef76895e50d057b9e3f0e660f8e21e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 9c2f7147ea99459d69c7264a7a7c7a80f6f3d5a0
Author: Ivan Kohler <ivan at freeside.biz>
Date: Sun Nov 3 21:14:56 2013 -0800
foreign keys, performance improvement, RT#13971
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index 71eddc1..8ab96cf 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -1,22 +1,18 @@
package FS::Record;
+use base qw( Exporter );
use strict;
-use vars qw( $AUTOLOAD @ISA @EXPORT_OK $DEBUG
+use vars qw( $AUTOLOAD
%virtual_fields_cache
- $conf $conf_encryption $money_char $lat_lower $lon_upper
- $me
- $nowarn_identical $nowarn_classload
- $no_update_diff $no_check_foreign
- @encrypt_payby
+ $money_char $lat_lower $lon_upper
);
-use Exporter;
use Carp qw(carp cluck croak confess);
use Scalar::Util qw( blessed );
use File::Slurp qw( slurp );
use File::CounterFile;
use Text::CSV_XS;
use DBI qw(:sql_types);
-use DBIx::DBSchema 0.38;
+use DBIx::DBSchema 0.42; #for foreign keys
use Locale::Country;
use Locale::Currency;
use NetAddr::IP; # for validation
@@ -31,32 +27,31 @@ use FS::part_virtual_field;
use Tie::IxHash;
- at ISA = qw(Exporter);
-
- at encrypt_payby = qw( CARD DCRD CHEK DCHK );
+our @encrypt_payby = qw( CARD DCRD CHEK DCHK );
#export dbdef for now... everything else expects to find it here
- at EXPORT_OK = qw(
+our @EXPORT_OK = qw(
dbh fields hfields qsearch qsearchs dbdef jsearch
str2time_sql str2time_sql_closing regexp_sql not_regexp_sql concat_sql
midnight_sql
);
-$DEBUG = 0;
-$me = '[FS::Record]';
+our $DEBUG = 0;
+our $me = '[FS::Record]';
+
+our $nowarn_identical = 0;
+our $nowarn_classload = 0;
+our $no_update_diff = 0;
-$nowarn_identical = 0;
-$nowarn_classload = 0;
-$no_update_diff = 0;
-$no_check_foreign = 0;
+our $no_check_foreign = 1; #well, not inefficiently in perl by default anymore
my $rsa_module;
my $rsa_loaded;
my $rsa_encrypt;
my $rsa_decrypt;
-$conf = '';
-$conf_encryption = '';
+our $conf = '';
+our $conf_encryption = '';
FS::UID->install_callback( sub {
eval "use FS::Conf;";
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 59c2abe..4e5a587 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -3,10 +3,11 @@ package FS::Schema;
use vars qw(@ISA @EXPORT_OK $DEBUG $setup_hack %dbdef_cache);
use subs qw(reload_dbdef);
use Exporter;
-use DBIx::DBSchema 0.40; #0.40 for mysql upgrade fixes
+use DBIx::DBSchema 0.42; #0.42 for foreign keys
use DBIx::DBSchema::Table;
use DBIx::DBSchema::Column;
use DBIx::DBSchema::Index;
+use DBIx::DBSchema::ForeignKey;
#can't use this yet, dependency bs #use FS::Conf;
@ISA = qw(Exporter);
@@ -149,12 +150,17 @@ sub dbdef_dist {
}
@index;
+ my @foreign_keys =
+ map DBIx::DBSchema::ForeignKey->new($_),
+ @{ $tables_hashref->{$tablename}{'foreign_keys'} || [] };
+
DBIx::DBSchema::Table->new({
- 'name' => $tablename,
- 'primary_key' => $tables_hashref->{$tablename}{'primary_key'},
- 'columns' => \@columns,
- 'indices' => \@indices,
- 'local_options' => $local_options,
+ name => $tablename,
+ primary_key => $tables_hashref->{$tablename}{'primary_key'},
+ columns => \@columns,
+ indices => \@indices,
+ foreign_keys => \@foreign_keys,
+ local_options => $local_options,
});
} keys %$tables_hashref;
@@ -487,12 +493,28 @@ sub tables_hashref {
'freq', 'int', 'NULL', '', '', '', #deprecated (never used)
'prog', @perl_type, '', '', #deprecated (never used)
],
- 'primary_key' => 'agentnum',
+ 'primary_key' => 'agentnum',
#'unique' => [ [ 'agent_custnum' ] ], #one agent per customer?
#insert is giving it a value, tho..
#'index' => [ ['typenum'], ['disabled'] ],
- 'unique' => [],
- 'index' => [ ['typenum'], ['disabled'], ['agent_custnum'] ],
+ 'unique' => [],
+ 'index' => [ ['typenum'], ['disabled'], ['agent_custnum'] ],
+ 'foreign_keys' => [
+ { columns => [ 'typenum' ],
+ table => 'agent_type',
+ },
+ # 1. RT tables aren't part of our data structure, so
+ # we can't make sure Queue is created already
+ # 2. Future ability to plug in other ticketing systems
+ #{ columns => [ 'ticketing_queueid' ],
+ # table => 'Queue',
+ # references => [ 'id' ],
+ #},
+ { columns => [ 'agent_custnum' ],
+ table => 'cust_main',
+ references => [ 'custnum' ],
+ },
+ ],
},
'agent_pkg_class' => {
@@ -502,9 +524,17 @@ sub tables_hashref {
'classnum', 'int', 'NULL', '', '', '',
'commission_percent', 'decimal', '', '7,4', '', '',
],
- 'primary_key' => 'agentpkgclassnum',
- 'unique' => [ [ 'agentnum', 'classnum' ], ],
- 'index' => [],
+ 'primary_key' => 'agentpkgclassnum',
+ 'unique' => [ [ 'agentnum', 'classnum' ], ],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ },
+ { columns => [ 'classnum' ],
+ table => 'pkg_class',
+ },
+ ],
},
'agent_type' => {
@@ -523,9 +553,17 @@ sub tables_hashref {
'typenum', 'int', '', '', '', '',
'pkgpart', 'int', '', '', '', '',
],
- 'primary_key' => 'typepkgnum',
- 'unique' => [ ['typenum', 'pkgpart'] ],
- 'index' => [ ['typenum'] ],
+ 'primary_key' => 'typepkgnum',
+ 'unique' => [ ['typenum', 'pkgpart'] ],
+ 'index' => [ ['typenum'] ],
+ 'foreign_keys' => [
+ { columns => [ 'typenum' ],
+ table => 'agent_type',
+ },
+ { columns => [ 'pkgpart' ],
+ table => 'part_pkg',
+ },
+ ],
},
'agent_currency' => {
@@ -534,9 +572,14 @@ sub tables_hashref {
'agentnum', 'int', '', '', '', '',
'currency', 'char', '', 3, '', '',
],
- 'primary_key' => 'agentcurrencynum',
- 'unique' => [],
- 'index' => [ ['agentnum'] ],
+ 'primary_key' => 'agentcurrencynum',
+ 'unique' => [],
+ 'index' => [ ['agentnum'] ],
+ 'foreign_keys' => [
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ },
+ ],
},
'sales' => {
@@ -547,9 +590,18 @@ sub tables_hashref {
'sales_custnum', 'int', 'NULL', '', '', '',
'disabled', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'salesnum',
- 'unique' => [],
- 'index' => [ ['salesnum'], ['disabled'] ],
+ 'primary_key' => 'salesnum',
+ 'unique' => [],
+ 'index' => [ ['salesnum'], ['disabled'] ],
+ 'foreign_keys' => [
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ },
+ { columns => [ 'sales_custnum' ],
+ table => 'cust_main',
+ references => [ 'custnum' ],
+ },
+ ],
},
'sales_pkg_class' => {
@@ -560,9 +612,17 @@ sub tables_hashref {
'commission_percent', 'decimal', '', '7,4', '', '',
'commission_duration', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'salespkgclassnum',
- 'unique' => [ [ 'salesnum', 'classnum' ], ],
- 'index' => [],
+ 'primary_key' => 'salespkgclassnum',
+ 'unique' => [ [ 'salesnum', 'classnum' ], ],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'salesnum' ],
+ table => 'sales',
+ },
+ { columns => [ 'classnum' ],
+ table => 'pkg_class',
+ },
+ ],
},
'cust_attachment' => {
@@ -578,10 +638,18 @@ sub tables_hashref {
'body', 'blob', 'NULL', '', '', '',
'disabled', @date_type, '', '',
],
- 'primary_key' => 'attachnum',
- 'unique' => [],
- 'index' => [ ['custnum'], ['usernum'], ],
- },
+ 'primary_key' => 'attachnum',
+ 'unique' => [],
+ 'index' => [ ['custnum'], ['usernum'], ],
+ 'foreign_keys' => [
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ { columns => [ 'usernum' ],
+ table => 'access_user',
+ },
+ ],
+ },
'cust_bill' => {
'columns' => [
@@ -606,9 +674,19 @@ sub tables_hashref {
'agent_invid', 'int', 'NULL', '', '', '', #(varchar?) importing legacy
'promised_date', @date_type, '', '',
],
- 'primary_key' => 'invnum',
- 'unique' => [ [ 'custnum', 'agent_invid' ] ], #agentnum? huh
- 'index' => [ ['custnum'], ['_date'], ['statementnum'], ['agent_invid'] ],
+ 'primary_key' => 'invnum',
+ 'unique' => [ [ 'custnum', 'agent_invid' ] ], #agentnum? huh
+ 'index' => [ ['custnum'], ['_date'], ['statementnum'],
+ ['agent_invid'],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ { columns => [ 'statementnum' ],
+ table => 'cust_statement',
+ },
+ ],
},
'cust_bill_void' => {
@@ -636,9 +714,23 @@ sub tables_hashref {
'reason', 'varchar', 'NULL', $char_d, '', '',
'void_usernum', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'invnum',
- 'unique' => [ [ 'custnum', 'agent_invid' ] ], #agentnum? huh
- 'index' => [ ['custnum'], ['_date'], ['statementnum'], ['agent_invid'], [ 'void_usernum' ] ],
+ 'primary_key' => 'invnum',
+ 'unique' => [ [ 'custnum', 'agent_invid' ] ], #agentnum? huh
+ 'index' => [ ['custnum'], ['_date'], ['statementnum'],
+ ['agent_invid'], [ 'void_usernum' ],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ { columns => [ 'statementnum' ],
+ table => 'cust_statement', #_void? both?
+ },
+ { columns => [ 'void_usernum' ],
+ table => 'access_user',
+ references => [ 'usernum' ],
+ },
+ ],
},
#for importing invoices from a legacy system for display purposes only
@@ -655,9 +747,14 @@ sub tables_hashref {
'content_html', 'text', 'NULL', '', '', '',
'locale', 'varchar', 'NULL', 16, '', '',
],
- 'primary_key' => 'legacyinvnum',
- 'unique' => [],
- 'index' => [ ['legacyid', 'custnum', 'locale' ], ],
+ 'primary_key' => 'legacyinvnum',
+ 'unique' => [],
+ 'index' => [ ['legacyid', 'custnum', 'locale' ], ],
+ 'foreign_keys' => [
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ ],
},
'cust_statement' => {
@@ -666,11 +763,17 @@ sub tables_hashref {
'custnum', 'int', '', '', '', '',
'_date', @date_type, '', '',
],
- 'primary_key' => 'statementnum',
- 'unique' => [],
- 'index' => [ ['custnum'], ['_date'], ],
+ 'primary_key' => 'statementnum',
+ 'unique' => [],
+ 'index' => [ ['custnum'], ['_date'], ],
+ 'foreign_keys' => [
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ ],
},
+ #old "invoice" events, deprecated
'cust_bill_event' => {
'columns' => [
'eventnum', 'serial', '', '', '', '',
@@ -680,14 +783,23 @@ sub tables_hashref {
'status', 'varchar', '', $char_d, '', '',
'statustext', 'text', 'NULL', '', '', '',
],
- 'primary_key' => 'eventnum',
+ 'primary_key' => 'eventnum',
#no... there are retries now #'unique' => [ [ 'eventpart', 'invnum' ] ],
- 'unique' => [],
- 'index' => [ ['invnum'], ['status'], ['eventpart'],
- ['statustext'], ['_date'],
- ],
+ 'unique' => [],
+ 'index' => [ ['invnum'], ['status'], ['eventpart'],
+ ['statustext'], ['_date'],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'invnum' ],
+ table => 'cust_bill',
+ },
+ { columns => [ 'eventpart' ],
+ table => 'part_bill_event',
+ },
+ ],
},
+ #old "invoice" events, deprecated
'part_bill_event' => {
'columns' => [
'eventpart', 'serial', '', '', '', '',
@@ -702,9 +814,15 @@ sub tables_hashref {
'reason', 'int', 'NULL', '', '', '',
'disabled', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'eventpart',
- 'unique' => [],
- 'index' => [ ['payby'], ['disabled'], ],
+ 'primary_key' => 'eventpart',
+ 'unique' => [],
+ 'index' => [ ['payby'], ['disabled'], ],
+ 'foreign_keys' => [
+ { columns => [ 'reason' ],
+ table => 'reason',
+ references => [ 'reasonnum' ],
+ },
+ ],
},
'part_event' => {
@@ -718,9 +836,16 @@ sub tables_hashref {
'action', 'varchar', '', $char_d, '', '',
'disabled', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'eventpart',
- 'unique' => [],
- 'index' => [ ['agentnum'], ['eventtable'], ['check_freq'], ['disabled'], ],
+ 'primary_key' => 'eventpart',
+ 'unique' => [],
+ 'index' => [ ['agentnum'], ['eventtable'], ['check_freq'],
+ ['disabled'],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ },
+ ],
},
'part_event_option' => {
@@ -730,9 +855,14 @@ sub tables_hashref {
'optionname', 'varchar', '', $char_d, '', '',
'optionvalue', 'text', 'NULL', '', '', '',
],
- 'primary_key' => 'optionnum',
- 'unique' => [],
- 'index' => [ [ 'eventpart' ], [ 'optionname' ] ],
+ 'primary_key' => 'optionnum',
+ 'unique' => [],
+ 'index' => [ [ 'eventpart' ], [ 'optionname' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'eventpart' ],
+ table => 'part_event',
+ },
+ ],
},
'part_event_condition' => {
@@ -741,9 +871,14 @@ sub tables_hashref {
'eventpart', 'int', '', '', '', '',
'conditionname', 'varchar', '', $char_d, '', '',
],
- 'primary_key' => 'eventconditionnum',
- 'unique' => [],
- 'index' => [ [ 'eventpart' ], [ 'conditionname' ] ],
+ 'primary_key' => 'eventconditionnum',
+ 'unique' => [],
+ 'index' => [ [ 'eventpart' ], [ 'conditionname' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'eventpart' ],
+ table => 'part_event',
+ },
+ ],
},
'part_event_condition_option' => {
@@ -753,9 +888,14 @@ sub tables_hashref {
'optionname', 'varchar', '', $char_d, '', '',
'optionvalue', 'text', 'NULL', '', '', '',
],
- 'primary_key' => 'optionnum',
- 'unique' => [],
- 'index' => [ [ 'eventconditionnum' ], [ 'optionname' ] ],
+ 'primary_key' => 'optionnum',
+ 'unique' => [],
+ 'index' => [ [ 'eventconditionnum' ], [ 'optionname' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'eventconditionnum' ],
+ table => 'part_event_condition',
+ },
+ ],
},
'part_event_condition_option_option' => {
@@ -765,9 +905,14 @@ sub tables_hashref {
'optionname', 'varchar', '', $char_d, '', '',
'optionvalue', 'text', 'NULL', '', '', '',
],
- 'primary_key' => 'optionoptionnum',
- 'unique' => [],
- 'index' => [ [ 'optionnum' ], [ 'optionname' ] ],
+ 'primary_key' => 'optionoptionnum',
+ 'unique' => [],
+ 'index' => [ [ 'optionnum' ], [ 'optionname' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'optionnum' ],
+ table => 'part_event_condition_option',
+ },
+ ],
},
'cust_event' => {
@@ -779,12 +924,17 @@ sub tables_hashref {
'status', 'varchar', '', $char_d, '', '',
'statustext', 'text', 'NULL', '', '', '',
],
- 'primary_key' => 'eventnum',
+ 'primary_key' => 'eventnum',
#no... there are retries now #'unique' => [ [ 'eventpart', 'invnum' ] ],
- 'unique' => [],
- 'index' => [ ['eventpart'], ['tablenum'], ['status'],
- ['statustext'], ['_date'],
- ],
+ 'unique' => [],
+ 'index' => [ ['eventpart'], ['tablenum'], ['status'],
+ ['statustext'], ['_date'],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'eventpart' ],
+ table => 'part_event',
+ },
+ ],
},
'cust_bill_pkg' => {
@@ -810,9 +960,22 @@ sub tables_hashref {
'quantity', 'int', 'NULL', '', '', '',
'hidden', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'billpkgnum',
- 'unique' => [],
- 'index' => [ ['invnum'], [ 'pkgnum' ], [ 'itemdesc' ], ],
+ 'primary_key' => 'billpkgnum',
+ 'unique' => [],
+ 'index' => [ ['invnum'], [ 'pkgnum' ], [ 'itemdesc' ], ],
+ 'foreign_keys' => [
+ { columns => [ 'invnum' ],
+ table => 'cust_bill',
+ },
+ #pkgnum 0 and -1 are used for special things
+ #{ columns => [ 'pkgnum' ],
+ # table => 'cust_pkg',
+ #},
+ { columns => [ 'pkgpart_override' ],
+ table => 'part_pkg',
+ references => [ 'pkgpart' ],
+ },
+ ],
},
'cust_bill_pkg_detail' => {
@@ -831,9 +994,25 @@ sub tables_hashref {
'regionname', 'varchar', 'NULL', $char_d, '', '',
'detail', 'varchar', '', 255, '', '',
],
- 'primary_key' => 'detailnum',
- 'unique' => [],
- 'index' => [ [ 'billpkgnum' ], [ 'classnum' ], [ 'pkgnum', 'invnum' ] ],
+ 'primary_key' => 'detailnum',
+ 'unique' => [],
+ 'index' => [ [ 'billpkgnum' ], [ 'classnum' ],
+ [ 'pkgnum', 'invnum' ],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'billpkgnum' ],
+ table => 'cust_bill_pkg',
+ },
+ { columns => [ 'pkgnum' ],
+ table => 'cust_pkg',
+ },
+ { columns => [ 'invnum' ],
+ table => 'cust_bill',
+ },
+ { columns => [ 'classnum' ],
+ table => 'usage_class',
+ },
+ ],
},
'cust_bill_pkg_display' => {
@@ -847,9 +1026,14 @@ sub tables_hashref {
'type', 'char', 'NULL', 1, '', '',
'summary', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'billpkgdisplaynum',
- 'unique' => [],
- 'index' => [ ['billpkgnum'], ],
+ 'primary_key' => 'billpkgdisplaynum',
+ 'unique' => [],
+ 'index' => [ ['billpkgnum'], ],
+ 'foreign_keys' => [
+ { columns => [ 'billpkgnum' ],
+ table => 'cust_bill_pkg',
+ },
+ ],
},
'cust_bill_pkg_tax_location' => {
@@ -864,14 +1048,29 @@ sub tables_hashref {
'currency', 'char', 'NULL', 3, '', '',
'taxable_billpkgnum', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'billpkgtaxlocationnum',
- 'unique' => [],
- 'index' => [ [ 'billpkgnum' ],
- [ 'taxnum' ],
- [ 'pkgnum' ],
- [ 'locationnum' ],
- [ 'taxable_billpkgnum' ],
- ],
+ 'primary_key' => 'billpkgtaxlocationnum',
+ 'unique' => [],
+ 'index' => [ [ 'billpkgnum' ],
+ [ 'taxnum' ],
+ [ 'pkgnum' ],
+ [ 'locationnum' ],
+ [ 'taxable_billpkgnum' ],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'billpkgnum' ],
+ table => 'cust_bill_pkg',
+ },
+ { columns => [ 'pkgnum' ],
+ table => 'cust_pkg',
+ },
+ { columns => [ 'locationnum' ],
+ table => 'cust_location',
+ },
+ { columns => [ 'taxable_billpkgnum' ],
+ table => 'cust_bill_pkg',
+ references => [ 'billpkgnum' ],
+ },
+ ],
},
'cust_bill_pkg_tax_rate_location' => {
@@ -886,10 +1085,23 @@ sub tables_hashref {
'currency', 'char', 'NULL', 3, '', '',
'taxable_billpkgnum', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'billpkgtaxratelocationnum',
- 'unique' => [],
- 'index' => [ [ 'billpkgnum' ], [ 'taxnum' ], [ 'taxratelocationnum' ],
- [ 'taxable_billpkgnum' ], ],
+ 'primary_key' => 'billpkgtaxratelocationnum',
+ 'unique' => [],
+ 'index' => [ ['billpkgnum'], ['taxnum'], ['taxratelocationnum'],
+ ['taxable_billpkgnum'],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'billpkgnum' ],
+ table => 'cust_bill_pkg',
+ },
+ { columns => [ 'taxratelocationnum' ],
+ table => 'tax_rate_location',
+ },
+ { columns => [ 'taxable_billpkgnum' ],
+ table => 'cust_bill_pkg',
+ references => [ 'billpkgnum' ],
+ },
+ ],
},
'cust_bill_pkg_void' => {
@@ -917,9 +1129,27 @@ sub tables_hashref {
'reason', 'varchar', 'NULL', $char_d, '', '',
'void_usernum', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'billpkgnum',
- 'unique' => [],
- 'index' => [ ['invnum'], [ 'pkgnum' ], [ 'itemdesc' ], [ 'void_usernum' ], ],
+ 'primary_key' => 'billpkgnum',
+ 'unique' => [],
+ 'index' => [ ['invnum'], ['pkgnum'], ['itemdesc'],
+ ['void_usernum'],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'invnum' ],
+ table => 'cust_bill_void',
+ },
+ { columns => [ 'pkgnum' ],
+ table => 'cust_pkg',
+ },
+ { columns => [ 'pkgpart_override' ],
+ table => 'part_pkg',
+ references => [ 'pkgpart' ],
+ },
+ { columns => [ 'void_usernum' ],
+ table => 'access_user',
+ references => [ 'usernum' ],
+ },
+ ],
},
'cust_bill_pkg_detail_void' => {
@@ -938,9 +1168,23 @@ sub tables_hashref {
'regionname', 'varchar', 'NULL', $char_d, '', '',
'detail', 'varchar', '', 255, '', '',
],
- 'primary_key' => 'detailnum',
- 'unique' => [],
- 'index' => [ [ 'billpkgnum' ], [ 'classnum' ], [ 'pkgnum', 'invnum' ] ],
+ 'primary_key' => 'detailnum',
+ 'unique' => [],
+ 'index' => [ ['billpkgnum'], ['classnum'], ['pkgnum', 'invnum'] ],
+ 'foreign_keys' => [
+ { columns => [ 'billpkgnum' ],
+ table => 'cust_bill_pkg_void',
+ },
+ { columns => [ 'pkgnum' ],
+ table => 'cust_pkg',
+ },
+ { columns => [ 'invnum' ],
+ table => 'cust_bill',
+ },
+ { columns => [ 'classnum' ],
+ table => 'usage_class',
+ },
+ ],
},
'cust_bill_pkg_display_void' => {
@@ -954,9 +1198,14 @@ sub tables_hashref {
'type', 'char', 'NULL', 1, '', '',
'summary', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'billpkgdisplaynum',
- 'unique' => [],
- 'index' => [ ['billpkgnum'], ],
+ 'primary_key' => 'billpkgdisplaynum',
+ 'unique' => [],
+ 'index' => [ ['billpkgnum'], ],
+ 'foreign_keys' => [
+ { columns => [ 'billpkgnum' ],
+ table => 'cust_bill_pkg_void',
+ },
+ ],
},
'cust_bill_pkg_tax_location_void' => {
@@ -971,9 +1220,26 @@ sub tables_hashref {
'currency', 'char', 'NULL', 3, '', '',
'taxable_billpkgnum', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'billpkgtaxlocationnum',
- 'unique' => [],
- 'index' => [ [ 'billpkgnum' ], [ 'taxnum' ], [ 'pkgnum' ], [ 'locationnum' ] ],
+ 'primary_key' => 'billpkgtaxlocationnum',
+ 'unique' => [],
+ 'index' => [ ['billpkgnum'], ['taxnum'], ['pkgnum'],
+ ['locationnum'],
+ ],
+ 'foreign_keys' => [
+ { 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' ],
+ },
+ ],
},
'cust_bill_pkg_tax_rate_location_void' => {
@@ -987,9 +1253,17 @@ sub tables_hashref {
'amount', @money_type, '', '',
'currency', 'char', 'NULL', 3, '', '',
],
- 'primary_key' => 'billpkgtaxratelocationnum',
- 'unique' => [],
- 'index' => [ [ 'billpkgnum' ], [ 'taxnum' ], [ 'taxratelocationnum' ] ],
+ 'primary_key' => 'billpkgtaxratelocationnum',
+ 'unique' => [],
+ 'index' => [ ['billpkgnum'], ['taxnum'], ['taxratelocationnum'] ],
+ 'foreign_keys' => [
+ { columns => [ 'billpkgnum' ],
+ table => 'cust_bill_pkg_void',
+ },
+ { columns => [ 'taxratelocationnum' ],
+ table => 'tax_rate_location',
+ },
+ ],
},
'cust_credit' => {
@@ -1011,11 +1285,40 @@ sub tables_hashref {
'commission_salesnum', 'int', 'NULL', '', '', '', #
'commission_pkgnum', 'int', 'NULL', '', '', '', #
],
- 'primary_key' => 'crednum',
- 'unique' => [],
- 'index' => [ ['custnum'], ['_date'], ['usernum'], ['eventnum'],
- [ 'commission_salesnum' ],
- ],
+ 'primary_key' => 'crednum',
+ 'unique' => [],
+ 'index' => [ ['custnum'], ['_date'], ['usernum'], ['eventnum'],
+ ['commission_salesnum'],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ { columns => [ 'usernum' ],
+ table => 'access_user',
+ },
+ { columns => [ 'reasonnum' ],
+ table => 'reason',
+ },
+ { columns => [ 'pkgnum' ],
+ table => 'cust_pkg',
+ },
+ { columns => [ 'eventnum' ],
+ table => 'cust_event',
+ },
+ { columns => [ 'commission_agentnum' ],
+ table => 'agent',
+ references => [ 'agentnum' ],
+ },
+ { columns => [ 'commission_salesnum' ],
+ table => 'sales',
+ references => [ 'salesnum' ],
+ },
+ { columns => [ 'commission_pkgnum' ],
+ table => 'cust_pkg',
+ references => [ 'pkgnum' ],
+ },
+ ],
},
'cust_credit_void' => {
@@ -1041,11 +1344,44 @@ sub tables_hashref {
'void_reason', 'varchar', 'NULL', $char_d, '', '',
'void_usernum', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'crednum',
- 'unique' => [],
- 'index' => [ ['custnum'], ['_date'], ['usernum'], ['eventnum'],
- [ 'commission_salesnum' ],
- ],
+ 'primary_key' => 'crednum',
+ 'unique' => [],
+ 'index' => [ ['custnum'], ['_date'], ['usernum'], ['eventnum'],
+ ['commission_salesnum'],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ { columns => [ 'usernum' ],
+ table => 'access_user',
+ },
+ { columns => [ 'reasonnum' ],
+ table => 'reason',
+ },
+ { columns => [ 'pkgnum' ],
+ table => 'cust_pkg',
+ },
+ { columns => [ 'eventnum' ],
+ table => 'cust_event',
+ },
+ { columns => [ 'commission_agentnum' ],
+ table => 'agent',
+ references => [ 'agentnum' ],
+ },
+ { columns => [ 'commission_salesnum' ],
+ table => 'sales',
+ references => [ 'salesnum' ],
+ },
+ { columns => [ 'commission_pkgnum' ],
+ table => 'cust_pkg',
+ references => [ 'pkgnum' ],
+ },
+ { columns => [ 'void_usernum' ],
+ table => 'access_user',
+ references => [ 'usernum' ],
+ },
+ ],
},
@@ -1058,9 +1394,20 @@ sub tables_hashref {
'amount', @money_type, '', '',
'pkgnum', 'int', 'NULL', '', '', '', #desired pkgnum for pkg-balances
],
- 'primary_key' => 'creditbillnum',
- 'unique' => [],
- 'index' => [ ['crednum'], ['invnum'] ],
+ 'primary_key' => 'creditbillnum',
+ 'unique' => [],
+ 'index' => [ ['crednum'], ['invnum'] ],
+ 'foreign_keys' => [
+ { columns => [ 'crednum' ],
+ table => 'cust_credit',
+ },
+ { columns => [ 'invnum' ],
+ table => 'cust_bill',
+ },
+ { columns => [ 'pkgnum' ],
+ table => 'cust_pkg',
+ },
+ ],
},
'cust_credit_bill_pkg' => {
@@ -1075,13 +1422,27 @@ sub tables_hashref {
'sdate', @date_type, '', '',
'edate', @date_type, '', '',
],
- 'primary_key' => 'creditbillpkgnum',
- 'unique' => [],
- 'index' => [ [ 'creditbillnum' ],
- [ 'billpkgnum' ],
- [ 'billpkgtaxlocationnum' ],
- [ 'billpkgtaxratelocationnum' ],
- ],
+ 'primary_key' => 'creditbillpkgnum',
+ 'unique' => [],
+ 'index' => [ [ 'creditbillnum' ],
+ [ 'billpkgnum' ],
+ [ 'billpkgtaxlocationnum' ],
+ [ 'billpkgtaxratelocationnum' ],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'creditbillnum' ],
+ table => 'cust_credit_bill',
+ },
+ { columns => [ 'billpkgnum' ],
+ table => 'cust_bill_pkg',
+ },
+ { columns => [ 'billpkgtaxlocationnum' ],
+ table => 'cust_bill_pkg_tax_location',
+ },
+ { columns => [ 'billpkgtaxratelocationnum' ],
+ table => 'cust_bill_pkg_tax_rate_location',
+ },
+ ],
},
'cust_main' => {
@@ -1186,16 +1547,45 @@ sub tables_hashref {
'bill_locationnum', 'int', 'NULL', '', '', '',
'ship_locationnum', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'custnum',
- 'unique' => [ [ 'agentnum', 'agent_custid' ] ],
- #'index' => [ ['last'], ['company'] ],
- 'index' => [
- [ 'agentnum' ], [ 'refnum' ], [ 'classnum' ], [ 'usernum' ],
- [ 'custbatch' ],
- [ 'referral_custnum' ],
- [ 'payby' ], [ 'paydate' ],
- [ 'archived' ],
- ],
+ 'primary_key' => 'custnum',
+ 'unique' => [ [ 'agentnum', 'agent_custid' ] ],
+ #'index' => [ ['last'], ['company'] ],
+ 'index' => [
+ ['agentnum'], ['refnum'], ['classnum'], ['usernum'],
+ [ 'custbatch' ],
+ [ 'referral_custnum' ],
+ [ 'payby' ], [ 'paydate' ],
+ [ 'archived' ],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ },
+ { columns => [ 'salesnum' ],
+ table => 'sales',
+ },
+ { columns => [ 'refnum' ],
+ table => 'part_referral',
+ },
+ { columns => [ 'classnum' ],
+ table => 'cust_class',
+ },
+ { columns => [ 'usernum' ],
+ table => 'access_user',
+ },
+ { columns => [ 'referral_custnum' ],
+ table => 'cust_main',
+ references => [ 'custnum' ],
+ },
+ { columns => [ 'bill_locationnum' ],
+ table => 'cust_location',
+ references => [ 'locationnum' ],
+ },
+ { columns => [ 'ship_locationnum' ],
+ table => 'cust_location',
+ references => [ 'locationnum' ],
+ },
+ ],
},
'cust_payby' => {
@@ -1218,9 +1608,17 @@ sub tables_hashref {
'payip', 'varchar', 'NULL', 15, '', '',
'locationnum', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'custpaybynum',
- 'unique' => [],
- 'index' => [ [ 'custnum' ] ],
+ 'primary_key' => 'custpaybynum',
+ 'unique' => [],
+ 'index' => [ [ 'custnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ { columns => [ 'locationnum' ],
+ table => 'cust_location',
+ },
+ ],
},
'cust_recon' => { # (some sort of not-well understood thing for OnPac)
@@ -1275,11 +1673,25 @@ sub tables_hashref {
'comment', 'varchar', 'NULL', 255, '', '',
'disabled', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'contactnum',
- 'unique' => [],
- 'index' => [ [ 'prospectnum' ], [ 'custnum' ], [ 'locationnum' ],
- [ 'last' ], [ 'first' ],
- ],
+ 'primary_key' => 'contactnum',
+ 'unique' => [],
+ 'index' => [ [ 'prospectnum' ], [ 'custnum' ], [ 'locationnum' ],
+ [ 'last' ], [ 'first' ],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'prospectnum' ],
+ table => 'prospect_main',
+ },
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ { columns => [ 'locationnum' ],
+ table => 'cust_location',
+ },
+ { columns => [ 'classnum' ],
+ table => 'contact_class',
+ },
+ ],
},
'contact_phone' => {
@@ -1292,9 +1704,17 @@ sub tables_hashref {
'extension', 'varchar', 'NULL', 7, '', '',
#?#'comment', 'varchar', '', $char_d, '', '',
],
- 'primary_key' => 'contactphonenum',
- 'unique' => [],
- 'index' => [],
+ 'primary_key' => 'contactphonenum',
+ 'unique' => [],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'contactnum' ],
+ table => 'contact',
+ },
+ { columns => [ 'phonetypenum' ],
+ table => 'phone_type',
+ },
+ ],
},
'phone_type' => {
@@ -1314,9 +1734,14 @@ sub tables_hashref {
'contactnum', 'int', '', '', '', '',
'emailaddress', 'varchar', '', $char_d, '', '',
],
- 'primary_key' => 'contactemailnum',
- 'unique' => [ [ 'contactnum', 'emailaddress' ], ],
- 'index' => [],
+ 'primary_key' => 'contactemailnum',
+ 'unique' => [ [ 'contactnum', 'emailaddress' ], ],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'contactnum' ],
+ table => 'contact',
+ },
+ ],
},
'prospect_main' => {
@@ -1328,9 +1753,17 @@ sub tables_hashref {
'disabled', 'char', 'NULL', 1, '', '',
'custnum', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'prospectnum',
- 'unique' => [],
- 'index' => [ [ 'company' ], [ 'agentnum' ], [ 'disabled' ] ],
+ 'primary_key' => 'prospectnum',
+ 'unique' => [],
+ 'index' => [ [ 'company' ], [ 'agentnum' ], [ 'disabled' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ },
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ ],
},
'quotation' => {
@@ -1345,9 +1778,20 @@ sub tables_hashref {
#'total', @money_type, '', '',
#'quotation_term', 'varchar', 'NULL', $char_d, '', '',
],
- 'primary_key' => 'quotationnum',
- 'unique' => [],
- 'index' => [ [ 'prospectnum' ], ['custnum'], ],
+ 'primary_key' => 'quotationnum',
+ 'unique' => [],
+ 'index' => [ [ 'prospectnum' ], ['custnum'], ],
+ 'foreign_keys' => [
+ { columns => [ 'prospectnum' ],
+ table => 'prospect_main',
+ },
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ { columns => [ 'usernum' ],
+ table => 'access_user',
+ },
+ ],
},
'quotation_pkg' => {
@@ -1362,9 +1806,20 @@ sub tables_hashref {
'quantity', 'int', 'NULL', '', '', '',
'waive_setup', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'quotationpkgnum',
- 'unique' => [],
- 'index' => [ ['pkgpart'], ],
+ 'primary_key' => 'quotationpkgnum',
+ 'unique' => [],
+ 'index' => [ ['pkgpart'], ],
+ 'foreign_keys' => [
+ { columns => [ 'quotationnum' ],
+ table => 'quotation',
+ },
+ { columns => [ 'pkgpart' ],
+ table => 'part_pkg',
+ },
+ { columns => [ 'locationnum' ],
+ table => 'cust_location',
+ },
+ ],
},
'quotation_pkg_discount' => {
@@ -1374,9 +1829,17 @@ sub tables_hashref {
'discountnum', 'int', '', '', '', '',
#'end_date', @date_type, '', '',
],
- 'primary_key' => 'quotationpkgdiscountnum',
- 'unique' => [],
- 'index' => [ [ 'quotationpkgnum' ], ], #[ 'discountnum' ] ],
+ 'primary_key' => 'quotationpkgdiscountnum',
+ 'unique' => [],
+ 'index' => [ [ 'quotationpkgnum' ], ], #[ 'discountnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'quotationpkgnum' ],
+ table => 'quotation_pkg',
+ },
+ { columns => [ 'discountnum' ],
+ table => 'discount',
+ },
+ ],
},
'cust_location' => { #'location' now that its prospects too, but...
@@ -1404,12 +1867,20 @@ sub tables_hashref {
'location_kind', 'char', 'NULL', 1, '', '',
'disabled', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'locationnum',
- 'unique' => [],
- 'index' => [ [ 'prospectnum' ], [ 'custnum' ],
- [ 'county' ], [ 'state' ], [ 'country' ], [ 'zip' ],
- [ 'city' ], [ 'district' ]
- ],
+ 'primary_key' => 'locationnum',
+ 'unique' => [],
+ 'index' => [ [ 'prospectnum' ], [ 'custnum' ],
+ [ 'county' ], [ 'state' ], [ 'country' ], [ 'zip' ],
+ [ 'city' ], [ 'district' ]
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'prospectnum' ],
+ table => 'prospect_main',
+ },
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ ],
},
'cust_main_invoice' => {
@@ -1418,9 +1889,14 @@ sub tables_hashref {
'custnum', 'int', '', '', '', '',
'dest', 'varchar', '', $char_d, '', '',
],
- 'primary_key' => 'destnum',
- 'unique' => [],
- 'index' => [ ['custnum'], ],
+ 'primary_key' => 'destnum',
+ 'unique' => [],
+ 'index' => [ ['custnum'], ],
+ 'foreign_keys' => [
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ ],
},
'cust_main_note' => {
@@ -1433,11 +1909,22 @@ sub tables_hashref {
'usernum', 'int', 'NULL', '', '', '',
'comments', 'text', 'NULL', '', '', '',
],
- 'primary_key' => 'notenum',
- 'unique' => [],
- 'index' => [ [ 'custnum' ], [ '_date' ], [ 'usernum' ], ],
+ 'primary_key' => 'notenum',
+ 'unique' => [],
+ 'index' => [ [ 'custnum' ], [ '_date' ], [ 'usernum' ], ],
+ 'foreign_keys' => [
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ { columns => [ 'classnum' ],
+ table => 'cust_note_class',
+ },
+ { columns => [ 'usernum' ],
+ table => 'access_user',
+ },
+ ],
},
-
+
'cust_note_class' => {
'columns' => [
'classnum', 'serial', '', '', '', '',
@@ -1469,9 +1956,14 @@ sub tables_hashref {
'tax', 'char', 'NULL', 1, '', '',
'disabled', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'classnum',
- 'unique' => [],
- 'index' => [ ['disabled'] ],
+ 'primary_key' => 'classnum',
+ 'unique' => [],
+ 'index' => [ ['disabled'] ],
+ 'foreign_keys' => [
+ { columns => [ 'categorynum' ],
+ table => 'cust_category',
+ },
+ ],
},
'cust_tag' => {
@@ -1480,9 +1972,17 @@ sub tables_hashref {
'custnum', 'int', '', '', '', '',
'tagnum', 'int', '', '', '', '',
],
- 'primary_key' => 'custtagnum',
- 'unique' => [ [ 'custnum', 'tagnum' ] ],
- 'index' => [ [ 'custnum' ] ],
+ 'primary_key' => 'custtagnum',
+ 'unique' => [ [ 'custnum', 'tagnum' ] ],
+ 'index' => [ [ 'custnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ { columns => [ 'tagnum' ],
+ table => 'part_tag',
+ },
+ ],
},
'part_tag' => {
@@ -1507,9 +2007,14 @@ sub tables_hashref {
'exempt_number', 'varchar', 'NULL', $char_d, '', '',
#start/end dates? for reporting?
],
- 'primary_key' => 'exemptionnum',
- 'unique' => [],
- 'index' => [ [ 'custnum' ] ],
+ 'primary_key' => 'exemptionnum',
+ 'unique' => [],
+ 'index' => [ [ 'custnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ ],
},
'cust_tax_adjustment' => {
@@ -1523,9 +2028,17 @@ sub tables_hashref {
'billpkgnum', 'int', 'NULL', '', '', '',
#more? no cust_bill_pkg_tax_location?
],
- 'primary_key' => 'adjustmentnum',
- 'unique' => [],
- 'index' => [ [ 'custnum' ], [ 'billpkgnum' ] ],
+ 'primary_key' => 'adjustmentnum',
+ 'unique' => [],
+ 'index' => [ [ 'custnum' ], [ 'billpkgnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ { columns => [ 'billpkgnum' ],
+ table => 'cust_bill_pkg',
+ },
+ ],
},
'cust_main_county' => { #district+city+county+state+country are checked
@@ -1587,9 +2100,14 @@ sub tables_hashref {
'manual', 'char', 'NULL', 1, '', '', # Y = manually edited
'disabled', 'char', 'NULL', 1, '', '', # Y = tax disabled
],
- 'primary_key' => 'taxnum',
- 'unique' => [],
- 'index' => [ ['taxclassnum'], ['data_vendor', 'geocode'] ],
+ 'primary_key' => 'taxnum',
+ 'unique' => [],
+ 'index' => [ ['taxclassnum'], ['data_vendor', 'geocode'] ],
+ 'foreign_keys' => [
+ { columns => [ 'taxclassnum' ],
+ table => 'tax_class',
+ },
+ ],
},
'tax_rate_location' => {
@@ -1666,9 +2184,29 @@ sub tables_hashref {
'discount_term','int', 'NULL', '', '', '',
'failure_status','varchar','NULL', 16, '', '',
],
- 'primary_key' => 'paypendingnum',
- 'unique' => [ [ 'payunique' ] ],
- 'index' => [ [ 'custnum' ], [ 'status' ], ],
+ 'primary_key' => 'paypendingnum',
+ 'unique' => [ [ 'payunique' ] ],
+ 'index' => [ [ 'custnum' ], [ 'status' ], ],
+ 'foreign_keys' => [
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ { columns => [ 'pkgnum' ],
+ table => 'cust_pkg',
+ },
+ { columns => [ 'gatewaynum' ],
+ table => 'payment_gateway',
+ },
+ { columns => [ 'paynum' ],
+ table => 'cust_pay',
+ },
+ { columns => [ 'jobnum' ],
+ table => 'queue',
+ },
+ { columns => [ 'invnum' ],
+ table => 'cust_bill',
+ },
+ ],
},
'cust_pay' => {
@@ -1703,9 +2241,28 @@ sub tables_hashref {
'auth', 'varchar', 'NULL', 16, '', '', # CC auth number
'order_number','varchar', 'NULL', $char_d, '', '', # transaction number
],
- 'primary_key' => 'paynum',
+ 'primary_key' => 'paynum',
#i guess not now, with cust_pay_pending, if we actually make it here, we _do_ want to record it# 'unique' => [ [ 'payunique' ] ],
- 'index' => [ [ 'custnum' ], [ 'paybatch' ], [ 'payby' ], [ '_date' ], [ 'usernum' ] ],
+ 'index' => [ ['custnum'], ['paybatch'], ['payby'], ['_date'],
+ ['usernum'],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ { columns => [ 'usernum' ],
+ table => 'access_user',
+ },
+ { columns => [ 'pkgnum' ],
+ table => 'cust_pkg',
+ },
+ { columns => [ 'batchnum' ],
+ table => 'pay_batch',
+ },
+ { columns => [ 'gatewaynum' ],
+ table => 'payment_gateway',
+ },
+ ],
},
'cust_pay_void' => {
@@ -1743,9 +2300,30 @@ sub tables_hashref {
'reason', 'varchar', 'NULL', $char_d, '', '',
'void_usernum', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'paynum',
- 'unique' => [],
- 'index' => [ [ 'custnum' ], [ 'usernum' ], [ 'void_usernum' ] ],
+ 'primary_key' => 'paynum',
+ 'unique' => [],
+ 'index' => [ ['custnum'], ['usernum'], ['void_usernum'] ],
+ 'foreign_keys' => [
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ { columns => [ 'usernum' ],
+ table => 'access_user',
+ },
+ { columns => [ 'pkgnum' ],
+ table => 'cust_pkg',
+ },
+ { columns => [ 'batchnum' ],
+ table => 'pay_batch',
+ },
+ { columns => [ 'gatewaynum' ],
+ table => 'payment_gateway',
+ },
+ { columns => [ 'void_usernum' ],
+ table => 'access_user',
+ references => [ 'usernum' ],
+ },
+ ],
},
'cust_bill_pay' => {
@@ -1757,9 +2335,20 @@ sub tables_hashref {
'_date', @date_type, '', '',
'pkgnum', 'int', 'NULL', '', '', '', #desired pkgnum for pkg-balances
],
- 'primary_key' => 'billpaynum',
- 'unique' => [],
- 'index' => [ [ 'paynum' ], [ 'invnum' ] ],
+ 'primary_key' => 'billpaynum',
+ 'unique' => [],
+ 'index' => [ [ 'paynum' ], [ 'invnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'invnum' ],
+ table => 'cust_bill',
+ },
+ { columns => [ 'paynum' ],
+ table => 'cust_pay',
+ },
+ { columns => [ 'pkgnum' ],
+ table => 'cust_pkg',
+ },
+ ],
},
'cust_bill_pay_batch' => {
@@ -1770,9 +2359,17 @@ sub tables_hashref {
'amount', @money_type, '', '',
'_date', @date_type, '', '',
],
- 'primary_key' => 'billpaynum',
- 'unique' => [],
- 'index' => [ [ 'paybatchnum' ], [ 'invnum' ] ],
+ 'primary_key' => 'billpaynum',
+ 'unique' => [],
+ 'index' => [ [ 'paybatchnum' ], [ 'invnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'invnum' ],
+ table => 'cust_bill',
+ },
+ { columns => [ 'paybatchnum' ],
+ table => 'cust_pay_batch',
+ },
+ ],
},
'cust_bill_pay_pkg' => {
@@ -1787,9 +2384,23 @@ sub tables_hashref {
'sdate', @date_type, '', '',
'edate', @date_type, '', '',
],
- 'primary_key' => 'billpaypkgnum',
- 'unique' => [],
- 'index' => [ [ 'billpaynum' ], [ 'billpkgnum' ], ],
+ 'primary_key' => 'billpaypkgnum',
+ 'unique' => [],
+ 'index' => [ [ 'billpaynum' ], [ 'billpkgnum' ], ],
+ 'foreign_keys' => [
+ { columns => [ 'billpaynum' ],
+ table => 'cust_bill_pay_batch',
+ },
+ { columns => [ 'billpkgnum' ],
+ table => 'cust_bill_pkg',
+ },
+ { columns => [ 'billpkgtaxlocationnum' ],
+ table => 'cust_bill_pkg_tax_location',
+ },
+ { columns => [ 'billpkgtaxratelocationnum' ],
+ table => 'cust_bill_pkg_tax_rate_location',
+ },
+ ],
},
'pay_batch' => { #batches of payments to an external processor
@@ -1802,9 +2413,14 @@ sub tables_hashref {
'upload', @date_type, '', '',
'title', 'varchar', 'NULL',255, '', '',
],
- 'primary_key' => 'batchnum',
- 'unique' => [],
- 'index' => [],
+ 'primary_key' => 'batchnum',
+ 'unique' => [],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ },
+ ],
},
'cust_pay_batch' => { #list of customers in current CARD/CHEK batch
@@ -1832,9 +2448,20 @@ sub tables_hashref {
'failure_status','varchar', 'NULL', 16, '', '',
'error_message', 'varchar', 'NULL', $char_d, '', '',
],
- 'primary_key' => 'paybatchnum',
- 'unique' => [],
- 'index' => [ ['batchnum'], ['invnum'], ['custnum'] ],
+ 'primary_key' => 'paybatchnum',
+ 'unique' => [],
+ 'index' => [ ['batchnum'], ['invnum'], ['custnum'] ],
+ 'foreign_keys' => [
+ { columns => [ 'batchnum' ],
+ table => 'pay_batch',
+ },
+ { columns => [ 'invnum' ],
+ table => 'cust_bill',
+ },
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ ],
},
'fcc477map' => {
@@ -1888,15 +2515,67 @@ sub tables_hashref {
'setup_show_zero', 'char', 'NULL', 1, '', '',
'change_to_pkgnum', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'pkgnum',
- 'unique' => [],
- 'index' => [ ['custnum'], ['pkgpart'], [ 'pkgbatch' ], [ 'locationnum' ],
- [ 'usernum' ], [ 'agent_pkgid' ],
- ['order_date'], [ 'start_date' ], ['setup'], ['bill'],
- ['last_bill'], ['susp'], ['adjourn'], ['cancel'],
- ['expire'], ['contract_end'], ['change_date'], ['no_auto'],
- ],
- },
+ 'primary_key' => 'pkgnum',
+ 'unique' => [],
+ 'index' => [ ['custnum'], ['pkgpart'], ['pkgbatch'],
+ ['locationnum'], ['usernum'], ['agent_pkgid'],
+ ['order_date'], [ 'start_date' ], ['setup'], ['bill'],
+ ['last_bill'], ['susp'], ['adjourn'], ['cancel'],
+ ['expire'], ['contract_end'], ['change_date'],
+ ['no_auto'],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ { columns => [ 'pkgpart' ],
+ table => 'part_pkg',
+ },
+ { columns => [ 'contactnum' ],
+ table => 'contact',
+ },
+ { columns => [ 'locationnum' ],
+ table => 'cust_location',
+ },
+ { columns => [ 'usernum' ],
+ table => 'access_user',
+ },
+ { columns => [ 'salesnum' ],
+ table => 'sales',
+ },
+ { columns => [ 'uncancel_pkgnum' ],
+ table => 'cust_pkg',
+ references => [ 'pkgnum' ],
+ },
+ { columns => [ 'change_pkgnum' ],
+ table => 'cust_pkg',
+ references => [ 'pkgnum' ],
+ },
+ { columns => [ 'change_pkgpart' ],
+ table => 'part_pkg',
+ references => [ 'pkgpart' ],
+ },
+ { columns => [ 'change_locationnum' ],
+ table => 'cust_location',
+ references => [ 'locationnum' ],
+ },
+ { columns => [ 'change_custnum' ],
+ table => 'cust_main',
+ references => [ 'custnum' ],
+ },
+ { columns => [ 'main_pkgnum' ],
+ table => 'cust_pkg',
+ references => [ 'pkgnum' ],
+ },
+ { columns => [ 'pkglinknum' ],
+ table => 'part_pkg_link',
+ },
+ { columns => [ 'change_to_pkgnum' ],
+ table => 'cust_pkg',
+ references => [ 'pkgnum' ],
+ },
+ ],
+ },
'cust_pkg_option' => {
'columns' => [
@@ -1905,9 +2584,14 @@ sub tables_hashref {
'optionname', 'varchar', '', $char_d, '', '',
'optionvalue', 'text', 'NULL', '', '', '',
],
- 'primary_key' => 'optionnum',
- 'unique' => [],
- 'index' => [ [ 'pkgnum' ], [ 'optionname' ] ],
+ 'primary_key' => 'optionnum',
+ 'unique' => [],
+ 'index' => [ [ 'pkgnum' ], [ 'optionname' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'pkgnum' ],
+ table => 'cust_pkg',
+ },
+ ],
},
'cust_pkg_detail' => {
@@ -1918,9 +2602,14 @@ sub tables_hashref {
'detailtype', 'char', '', 1, '', '', # "I"nvoice or "C"omment
'weight', 'int', '', '', '', '',
],
- 'primary_key' => 'pkgdetailnum',
- 'unique' => [],
- 'index' => [ [ 'pkgnum', 'detailtype' ] ],
+ 'primary_key' => 'pkgdetailnum',
+ 'unique' => [],
+ 'index' => [ [ 'pkgnum', 'detailtype' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'pkgnum' ],
+ table => 'cust_pkg',
+ },
+ ],
},
'cust_pkg_reason' => {
@@ -1933,9 +2622,20 @@ sub tables_hashref {
'usernum', 'int', 'NULL', '', '', '',
'date', @date_type, '', '',
],
- 'primary_key' => 'num',
- 'unique' => [],
- 'index' => [ [ 'pkgnum' ], [ 'reasonnum' ], ['action'], [ 'usernum' ], ],
+ 'primary_key' => 'num',
+ 'unique' => [],
+ 'index' => [ ['pkgnum'], ['reasonnum'], ['action'], ['usernum'], ],
+ 'foreign_keys' => [
+ { columns => [ 'pkgnum' ],
+ table => 'cust_pkg',
+ },
+ { columns => [ 'reasonnum' ],
+ table => 'reason',
+ },
+ { columns => [ 'usernum' ],
+ table => 'access_user',
+ },
+ ],
},
'cust_pkg_discount' => {
@@ -1949,9 +2649,20 @@ sub tables_hashref {
'usernum', 'int', 'NULL', '', '', '',
'disabled', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'pkgdiscountnum',
- 'unique' => [],
- 'index' => [ [ 'pkgnum' ], [ 'discountnum' ], [ 'usernum' ], ],
+ 'primary_key' => 'pkgdiscountnum',
+ 'unique' => [],
+ 'index' => [ [ 'pkgnum' ], [ 'discountnum' ], [ 'usernum' ], ],
+ 'foreign_keys' => [
+ { columns => [ 'pkgnum' ],
+ table => 'cust_pkg',
+ },
+ { columns => [ 'discountnum' ],
+ table => 'discount',
+ },
+ { columns => [ 'usernum' ],
+ table => 'access_user',
+ },
+ ],
},
'cust_pkg_usage' => {
@@ -1961,9 +2672,17 @@ sub tables_hashref {
'minutes', 'int', '', '', '', '',
'pkgusagepart', 'int', '', '', '', '',
],
- 'primary_key' => 'pkgusagenum',
- 'unique' => [],
- 'index' => [ [ 'pkgnum' ], [ 'pkgusagepart' ] ],
+ 'primary_key' => 'pkgusagenum',
+ 'unique' => [],
+ 'index' => [ [ 'pkgnum' ], [ 'pkgusagepart' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'pkgnum' ],
+ table => 'cust_pkg',
+ },
+ { columns => [ 'pkgusagepart' ],
+ table => 'part_pkg_usage',
+ },
+ ],
},
'cdr_cust_pkg_usage' => {
@@ -1973,9 +2692,17 @@ sub tables_hashref {
'pkgusagenum', 'int', '', '', '', '',
'minutes', 'int', '', '', '', '',
],
- 'primary_key' => 'cdrusagenum',
- 'unique' => [],
- 'index' => [ [ 'pkgusagenum' ], [ 'acctid' ] ],
+ 'primary_key' => 'cdrusagenum',
+ 'unique' => [],
+ 'index' => [ [ 'pkgusagenum' ], [ 'acctid' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'acctid' ],
+ table => 'cdr',
+ },
+ { columns => [ 'pkgusagenum' ],
+ table => 'cust_pkg_usage',
+ },
+ ],
},
'cust_bill_pkg_discount' => {
@@ -1986,9 +2713,17 @@ sub tables_hashref {
'amount', @money_type, '', '',
'months', 'decimal', 'NULL', '7,4', '', '',
],
- 'primary_key' => 'billpkgdiscountnum',
- 'unique' => [],
- 'index' => [ [ 'billpkgnum' ], [ 'pkgdiscountnum' ] ],
+ 'primary_key' => 'billpkgdiscountnum',
+ 'unique' => [],
+ 'index' => [ [ 'billpkgnum' ], [ 'pkgdiscountnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'billpkgnum' ],
+ table => 'cust_bill_pkg',
+ },
+ { columns => [ 'pkgdiscountnum' ],
+ table => 'cust_pkg_discount',
+ },
+ ],
},
'cust_bill_pkg_discount_void' => {
@@ -1999,9 +2734,17 @@ sub tables_hashref {
'amount', @money_type, '', '',
'months', 'decimal', 'NULL', '7,4', '', '',
],
- 'primary_key' => 'billpkgdiscountnum',
- 'unique' => [],
- 'index' => [ [ 'billpkgnum' ], [ 'pkgdiscountnum' ] ],
+ 'primary_key' => 'billpkgdiscountnum',
+ 'unique' => [],
+ 'index' => [ [ 'billpkgnum' ], [ 'pkgdiscountnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'billpkgnum' ],
+ table => 'cust_bill_pkg_void',
+ },
+ { columns => [ 'pkgdiscountnum' ],
+ table => 'cust_pkg_discount',
+ },
+ ],
},
'discount' => {
@@ -2017,9 +2760,14 @@ sub tables_hashref {
'setup', 'char', 'NULL', 1, '', '',
#'linked', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'discountnum',
- 'unique' => [],
- 'index' => [], # [ 'agentnum' ], ],
+ 'primary_key' => 'discountnum',
+ 'unique' => [],
+ 'index' => [], # [ 'agentnum' ], ],
+ 'foreign_keys' => [
+ { columns => [ 'classnum' ],
+ table => 'discount_class',
+ },
+ ],
},
'discount_class' => {
@@ -2057,9 +2805,20 @@ sub tables_hashref {
'auth', 'varchar','NULL',16, '', '', # CC auth number
'order_number', 'varchar','NULL',$char_d, '', '', # transaction number
],
- 'primary_key' => 'refundnum',
- 'unique' => [],
- 'index' => [ ['custnum'], ['_date'], [ 'usernum' ], ],
+ 'primary_key' => 'refundnum',
+ 'unique' => [],
+ 'index' => [ ['custnum'], ['_date'], [ 'usernum' ], ],
+ 'foreign_keys' => [
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ { columns => [ 'usernum' ],
+ table => 'access_user',
+ },
+ { columns => [ 'gatewaynum' ],
+ table => 'payment_gateway',
+ },
+ ],
},
'cust_credit_refund' => {
@@ -2070,9 +2829,17 @@ sub tables_hashref {
'amount', @money_type, '', '',
'_date', @date_type, '', '',
],
- 'primary_key' => 'creditrefundnum',
- 'unique' => [],
- 'index' => [ ['crednum'], ['refundnum'] ],
+ 'primary_key' => 'creditrefundnum',
+ 'unique' => [],
+ 'index' => [ ['crednum'], ['refundnum'] ],
+ 'foreign_keys' => [
+ { columns => [ 'crednum' ],
+ table => 'cust_credit',
+ },
+ { columns => [ 'refundnum' ],
+ table => 'cust_refund',
+ },
+ ],
},
@@ -2084,9 +2851,19 @@ sub tables_hashref {
'agent_svcid', 'int', 'NULL', '', '', '',
'overlimit', @date_type, '', '',
],
- 'primary_key' => 'svcnum',
- 'unique' => [],
- 'index' => [ ['svcnum'], ['pkgnum'], ['svcpart'], [ 'agent_svcid' ] ],
+ 'primary_key' => 'svcnum',
+ 'unique' => [],
+ 'index' => [ ['svcnum'], ['pkgnum'], ['svcpart'],
+ ['agent_svcid'],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'pkgnum' ],
+ table => 'cust_pkg',
+ },
+ { columns => [ 'svcpart' ],
+ table => 'part_svc',
+ },
+ ],
},
'cust_svc_option' => {
@@ -2096,9 +2873,14 @@ sub tables_hashref {
'optionname', 'varchar', '', $char_d, '', '',
'optionvalue', 'text', 'NULL', '', '', '',
],
- 'primary_key' => 'optionnum',
- 'unique' => [],
- 'index' => [ [ 'svcnum' ], [ 'optionname' ] ],
+ 'primary_key' => 'optionnum',
+ 'unique' => [],
+ 'index' => [ [ 'svcnum' ], [ 'optionname' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ },
+ ],
},
'svc_export_machine' => {
@@ -2108,9 +2890,20 @@ sub tables_hashref {
'exportnum', 'int', '', '', '', '',
'machinenum', 'int', '', '', '', '',
],
- 'primary_key' => 'svcexportmachinenum',
- 'unique' => [ ['svcnum', 'exportnum'] ],
- 'index' => [],
+ 'primary_key' => 'svcexportmachinenum',
+ 'unique' => [ ['svcnum', 'exportnum'] ],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ },
+ { columns => [ 'exportnum' ],
+ table => 'part_export',
+ },
+ { columns => [ 'machinenum' ],
+ table => 'part_export_machine',
+ },
+ ],
},
'part_export_machine' => {
@@ -2120,9 +2913,14 @@ sub tables_hashref {
'machine', 'varchar', 'NULL', $char_d, '', '',
'disabled', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'machinenum',
- 'unique' => [ [ 'exportnum', 'machine' ] ],
- 'index' => [ [ 'exportnum' ] ],
+ 'primary_key' => 'machinenum',
+ 'unique' => [ [ 'exportnum', 'machine' ] ],
+ 'index' => [ [ 'exportnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'exportnum' ],
+ table => 'part_export',
+ },
+ ],
},
'part_pkg' => {
@@ -2155,11 +2953,34 @@ sub tables_hashref {
'family_pkgpart','int', 'NULL', '', '', '',
'delay_start', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'pkgpart',
- 'unique' => [],
- 'index' => [ [ 'promo_code' ], [ 'disabled' ], [ 'classnum' ],
- [ 'agentnum' ], ['no_auto'],
- ],
+ 'primary_key' => 'pkgpart',
+ 'unique' => [],
+ 'index' => [ [ 'promo_code' ], [ 'disabled' ], [ 'classnum' ],
+ [ 'agentnum' ], ['no_auto'],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'classnum' ],
+ table => 'pkg_class',
+ },
+ { columns => [ 'addon_classnum' ],
+ table => 'pkg_class',
+ references => [ 'classnum' ],
+ },
+ { columns => [ 'taxproductnum' ],
+ table => 'part_pkg_taxproduct',
+ },
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ },
+ { columns => [ 'successor' ],
+ table => 'part_pkg',
+ references => [ 'pkgpart' ],
+ },
+ { columns => [ 'family_pkgpart' ],
+ table => 'part_pkg',
+ references => [ 'pkgpart' ],
+ },
+ ],
},
'part_pkg_msgcat' => {
@@ -2170,9 +2991,14 @@ sub tables_hashref {
'pkg', 'varchar', '', $char_d, '', '', #longer/no limit?
'comment', 'varchar', 'NULL', 2*$char_d, '', '', #longer/no limit?
],
- 'primary_key' => 'pkgpartmsgnum',
- 'unique' => [ [ 'pkgpart', 'locale' ] ],
- 'index' => [],
+ 'primary_key' => 'pkgpartmsgnum',
+ 'unique' => [ [ 'pkgpart', 'locale' ] ],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'pkgpart' ],
+ table => 'part_pkg',
+ },
+ ],
},
'part_pkg_currency' => {
@@ -2183,9 +3009,14 @@ sub tables_hashref {
'optionname', 'varchar', '', $char_d, '', '',
'optionvalue', 'text', '', '', '', '',
],
- 'primary_key' => 'pkgcurrencynum',
- 'unique' => [ [ 'pkgpart', 'currency', 'optionname' ] ],
- 'index' => [ ['pkgpart'] ],
+ 'primary_key' => 'pkgcurrencynum',
+ 'unique' => [ [ 'pkgpart', 'currency', 'optionname' ] ],
+ 'index' => [ ['pkgpart'] ],
+ 'foreign_keys' => [
+ { columns => [ 'pkgpart' ],
+ table => 'part_pkg',
+ },
+ ],
},
'currency_exchange' => {
@@ -2208,9 +3039,19 @@ sub tables_hashref {
'link_type', 'varchar', '', $char_d, '', '',
'hidden', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'pkglinknum',
- 'unique' => [ [ 'src_pkgpart', 'dst_pkgpart', 'link_type', 'hidden' ] ],
- 'index' => [ [ 'src_pkgpart' ] ],
+ 'primary_key' => 'pkglinknum',
+ 'unique' => [ ['src_pkgpart','dst_pkgpart','link_type','hidden'] ],
+ 'index' => [ [ 'src_pkgpart' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'src_pkgpart' ],
+ table => 'part_pkg',
+ references => [ 'pkgpart' ]
+ },
+ { columns => [ 'dst_pkgpart' ],
+ table => 'part_pkg',
+ references => [ 'pkgpart' ]
+ },
+ ],
},
# XXX somewhat borked unique: we don't really want a hidden and unhidden
# it turns out we'd prefer to use svc, bill, and invisibill (or something)
@@ -2221,9 +3062,17 @@ sub tables_hashref {
'pkgpart', 'int', '', '', '', '',
'discountnum', 'int', '', '', '', '',
],
- 'primary_key' => 'pkgdiscountnum',
- 'unique' => [ [ 'pkgpart', 'discountnum' ] ],
- 'index' => [],
+ 'primary_key' => 'pkgdiscountnum',
+ 'unique' => [ [ 'pkgpart', 'discountnum' ] ],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'pkgpart' ],
+ table => 'part_pkg',
+ },
+ { columns => [ 'discountnum' ],
+ table => 'discount',
+ },
+ ],
},
'part_pkg_taxclass' => {
@@ -2266,9 +3115,21 @@ sub tables_hashref {
'effdate', @date_type, '', '',
'taxable', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'pkgtaxratenum',
- 'unique' => [],
- 'index' => [ [ 'data_vendor', 'geocode', 'taxproductnum' ] ],
+ 'primary_key' => 'pkgtaxratenum',
+ 'unique' => [],
+ 'index' => [ [ 'data_vendor', 'geocode', 'taxproductnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'taxproductnum' ],
+ table => 'part_pkg_taxproduct',
+ },
+ { columns => [ 'taxclassnumtaxed' ],
+ table => 'tax_class',
+ references => [ 'taxclassnum' ],
+ },
+ { columns => [ 'taxclassnum' ],
+ table => 'tax_class',
+ },
+ ],
},
'part_pkg_taxoverride' => {
@@ -2278,9 +3139,17 @@ sub tables_hashref {
'taxclassnum', 'int', '', '', '', '',
'usage_class', 'varchar', 'NULL', $char_d, '', '',
],
- 'primary_key' => 'taxoverridenum',
- 'unique' => [],
- 'index' => [ [ 'pkgpart' ], [ 'taxclassnum' ] ],
+ 'primary_key' => 'taxoverridenum',
+ 'unique' => [],
+ 'index' => [ [ 'pkgpart' ], [ 'taxclassnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'pkgpart' ],
+ table => 'part_pkg',
+ },
+ { columns => [ 'taxclassnum' ],
+ table => 'tax_class',
+ },
+ ],
},
# 'part_title' => {
@@ -2303,9 +3172,17 @@ sub tables_hashref {
'hidden', 'char', 'NULL', 1, '', '',
'bulk_skip', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'pkgsvcnum',
- 'unique' => [ ['pkgpart', 'svcpart'] ],
- 'index' => [ ['pkgpart'], ['quantity'] ],
+ 'primary_key' => 'pkgsvcnum',
+ 'unique' => [ ['pkgpart', 'svcpart'] ],
+ 'index' => [ ['pkgpart'], ['quantity'] ],
+ 'foreign_keys' => [
+ { columns => [ 'pkgpart' ],
+ table => 'part_pkg',
+ },
+ { columns => [ 'svcpart' ],
+ table => 'part_svc',
+ },
+ ],
},
'part_referral' => {
@@ -2315,9 +3192,14 @@ sub tables_hashref {
'disabled', 'char', 'NULL', 1, '', '',
'agentnum', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'refnum',
- 'unique' => [],
- 'index' => [ ['disabled'], ['agentnum'], ],
+ 'primary_key' => 'refnum',
+ 'unique' => [],
+ 'index' => [ ['disabled'], ['agentnum'], ],
+ 'foreign_keys' => [
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ },
+ ],
},
'part_svc' => {
@@ -2332,9 +3214,14 @@ sub tables_hashref {
'restrict_edit_password','char', 'NULL', 1, '', '',
'has_router', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'svcpart',
- 'unique' => [],
- 'index' => [ [ 'disabled' ] ],
+ 'primary_key' => 'svcpart',
+ 'unique' => [],
+ 'index' => [ [ 'disabled' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'classnum' ],
+ table => 'part_svc_class',
+ },
+ ],
},
'part_svc_column' => {
@@ -2346,9 +3233,14 @@ sub tables_hashref {
'columnvalue', 'varchar', 'NULL', 512, '', '',
'columnflag', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'columnnum',
- 'unique' => [ [ 'svcpart', 'columnname' ] ],
- 'index' => [ [ 'svcpart' ] ],
+ 'primary_key' => 'columnnum',
+ 'unique' => [ [ 'svcpart', 'columnname' ] ],
+ 'index' => [ [ 'svcpart' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'svcpart' ],
+ table => 'part_svc',
+ },
+ ],
},
'part_svc_class' => {
@@ -2386,11 +3278,16 @@ sub tables_hashref {
'npa', 'char', '', 3, '', '',
'nxx', 'char', '', 3, '', '',
],
- 'primary_key' => 'localnum',
- 'unique' => [],
- 'index' => [ [ 'npa', 'nxx' ], [ 'popnum' ] ],
+ 'primary_key' => 'localnum',
+ 'unique' => [],
+ 'index' => [ [ 'npa', 'nxx' ], [ 'popnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'popnum' ],
+ table => 'svc_acct_pop',
+ },
+ ],
},
-
+
'qual' => {
'columns' => [
'qualnum', 'serial', '', '', '', '',
@@ -2402,12 +3299,27 @@ sub tables_hashref {
'vendor_qual_id', 'varchar', 'NULL', $char_d, '', '',
'status', 'char', '', 1, '', '',
],
- 'primary_key' => 'qualnum',
- 'unique' => [],
- 'index' => [ [ 'locationnum' ], ['custnum'], ['prospectnum'],
- ['phonenum'], ['vendor_qual_id'] ],
+ 'primary_key' => 'qualnum',
+ 'unique' => [],
+ 'index' => [ ['locationnum'], ['custnum'], ['prospectnum'],
+ ['phonenum'], ['vendor_qual_id'],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ { columns => [ 'prospectnum' ],
+ table => 'prospect_main',
+ },
+ { columns => [ 'locationnum' ],
+ table => 'cust_location',
+ },
+ { columns => [ 'exportnum' ],
+ table => 'part_export',
+ },
+ ],
},
-
+
'qual_option' => {
'columns' => [
'optionnum', 'serial', '', '', '', '',
@@ -2415,9 +3327,14 @@ sub tables_hashref {
'optionname', 'varchar', '', $char_d, '', '',
'optionvalue', 'text', 'NULL', '', '', '',
],
- 'primary_key' => 'optionnum',
- 'unique' => [],
- 'index' => [],
+ 'primary_key' => 'optionnum',
+ 'unique' => [],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'qualnum' ],
+ table => 'qual',
+ },
+ ],
},
'svc_acct' => {
@@ -2481,24 +3398,62 @@ sub tables_hashref {
#XXX RPOP settings
#
],
- 'primary_key' => 'svcnum',
- #'unique' => [ [ 'username', 'domsvc' ] ],
- 'unique' => [],
- 'index' => [ ['username'], ['domsvc'], ['pbxsvc'] ],
+ 'primary_key' => 'svcnum',
+ #'unique' => [ [ 'username', 'domsvc' ] ],
+ 'unique' => [],
+ 'index' => [ ['username'], ['domsvc'], ['pbxsvc'] ],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ },
+ { columns => [ 'popnum' ],
+ table => 'svc_acct_pop',
+ },
+ { columns => [ 'sectornum' ],
+ table => 'tower_sector',
+ },
+ { columns => [ 'routernum' ],
+ table => 'router',
+ },
+ { columns => [ 'blocknum' ],
+ table => 'addr_block',
+ },
+ { columns => [ 'domsvc' ],
+ table => 'svc_domain', #'cust_svc',
+ references => [ 'svcnum' ],
+ },
+ { columns => [ 'pbxsvc' ],
+ table => 'svc_pbx', #'cust_svc',
+ references => [ 'svcnum' ],
+ },
+ ],
},
'acct_rt_transaction' => {
'columns' => [
- 'svcrtid', 'int', '', '', '', '',
+ 'svcrtid', 'int', '', '', '', '', #why am i not a serial
'svcnum', 'int', '', '', '', '',
'transaction_id', 'int', '', '', '', '',
'_date', @date_type, '', '',
'seconds', 'int', '', '', '', '', #uhhhh
'support', 'int', '', '', '', '',
],
- 'primary_key' => 'svcrtid',
- 'unique' => [],
- 'index' => [ ['svcnum', 'transaction_id'] ],
+ 'primary_key' => 'svcrtid',
+ 'unique' => [],
+ 'index' => [ ['svcnum', 'transaction_id'] ],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'svc_acct', #'cust_svc',
+ },
+ # 1. RT tables aren't part of our data structure, so
+ # we can't make sure Queue is created already
+ # 2. This is our internal hack for time tracking, not
+ # a user-facing feature
+ #{ columns => [ 'transaction_id' ],
+ # table => 'Transaction',
+ # references => [ 'id' ],
+ #},
+ ],
},
#'svc_charge' => {
@@ -2553,11 +3508,27 @@ sub tables_hashref {
'acct_def_cgp_prontoskinname', 'varchar', 'NULL', $char_d, '', '',
'acct_def_cgp_sendmdnmode', 'varchar', 'NULL', $char_d, '', '',
],
- 'primary_key' => 'svcnum',
- 'unique' => [ ],
- 'index' => [ ['domain'] ],
+ 'primary_key' => 'svcnum',
+ 'unique' => [],
+ 'index' => [ ['domain'] ],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ },
+ { columns => [ 'catchall' ],
+ table => 'svc_acct',
+ references => [ 'svcnum' ],
+ },
+ { columns => [ 'parent_svcnum' ],
+ table => 'cust_svc',
+ references => [ 'svcnum' ],
+ },
+ { columns => [ 'registrarnum' ],
+ table => 'registrar',
+ },
+ ],
},
-
+
'svc_dsl' => {
'columns' => [
'svcnum', 'int', '', '', '', '',
@@ -2587,9 +3558,14 @@ sub tables_hashref {
'monitored', 'char', 'NULL', 1, '', '',
'last_pull', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'svcnum',
- 'unique' => [ ],
- 'index' => [ ['phonenum'], ['vendor_order_id'] ],
+ 'primary_key' => 'svcnum',
+ 'unique' => [ ],
+ 'index' => [ ['phonenum'], ['vendor_order_id'] ],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ },
+ ],
},
'dsl_device' => {
@@ -2600,11 +3576,16 @@ sub tables_hashref {
'svcnum', 'int', '', '', '', '',
'mac_addr', 'varchar', '', 12, '', '',
],
- 'primary_key' => 'devicenum',
- 'unique' => [ [ 'mac_addr' ], ],
- 'index' => [ [ 'svcnum' ], ], # [ 'devicepart' ] ],
+ 'primary_key' => 'devicenum',
+ 'unique' => [ [ 'mac_addr' ], ],
+ 'index' => [ [ 'svcnum' ], ], # [ 'devicepart' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'svc_dsl',
+ },
+ ],
},
-
+
'dsl_note' => {
'columns' => [
'notenum', 'serial', '', '', '', '',
@@ -2614,9 +3595,14 @@ sub tables_hashref {
'_date', 'int', 'NULL', '', '', '',
'note', 'text', '', '', '', '',
],
- 'primary_key' => 'notenum',
- 'unique' => [ ],
- 'index' => [ ['svcnum'] ],
+ 'primary_key' => 'notenum',
+ 'unique' => [],
+ 'index' => [ ['svcnum'] ],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'svc_dsl',
+ },
+ ],
},
'svc_dish' => {
@@ -2626,9 +3612,14 @@ sub tables_hashref {
'installdate', @date_type, '', '',
'note', 'text', 'NULL', '', '', '',
],
- 'primary_key' => 'svcnum',
- 'unique' => [ ],
- 'index' => [ ],
+ 'primary_key' => 'svcnum',
+ 'unique' => [],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ },
+ ],
},
'svc_hardware' => {
@@ -2642,9 +3633,20 @@ sub tables_hashref {
'statusnum','int', 'NULL', '', '', '',
'note', 'text', 'NULL', '', '', '',
],
- 'primary_key' => 'svcnum',
- 'unique' => [ ],
- 'index' => [ ],
+ 'primary_key' => 'svcnum',
+ 'unique' => [],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ },
+ { columns => [ 'typenum' ],
+ table => 'hardware_type',
+ },
+ { columns => [ 'statusnum' ],
+ table => 'hardware_status',
+ },
+ ],
},
'hardware_class' => {
@@ -2664,9 +3666,14 @@ sub tables_hashref {
'model', 'varchar', '', $char_d, '', '',
'revision','varchar', 'NULL', $char_d, '', '',
],
- 'primary_key' => 'typenum',
- 'unique' => [ [ 'classnum', 'model', 'revision' ] ],
- 'index' => [ ],
+ 'primary_key' => 'typenum',
+ 'unique' => [ [ 'classnum', 'model', 'revision' ] ],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'classnum' ],
+ table => 'hardware_class',
+ },
+ ],
},
'hardware_status' => {
@@ -2690,9 +3697,14 @@ sub tables_hashref {
'recdata', 'varchar', '', 255, '', '',
'ttl', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'recnum',
- 'unique' => [],
- 'index' => [ ['svcnum'] ],
+ 'primary_key' => 'recnum',
+ 'unique' => [],
+ 'index' => [ ['svcnum'] ],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'svc_domain',
+ },
+ ],
},
'registrar' => {
@@ -2716,6 +3728,11 @@ sub tables_hashref {
'primary_key' => 'rulenum',
'unique' => [ [ 'svcnum', 'name' ] ],
'index' => [ [ 'svcnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc', #svc_acct / svc_domain
+ },
+ ],
},
'cgp_rule_condition' => {
@@ -2726,9 +3743,14 @@ sub tables_hashref {
'params', 'varchar', 'NULL', 255, '', '',
'rulenum', 'int', '', '', '', '',
],
- 'primary_key' => 'ruleconditionnum',
- 'unique' => [],
- 'index' => [ [ 'rulenum' ] ],
+ 'primary_key' => 'ruleconditionnum',
+ 'unique' => [],
+ 'index' => [ [ 'rulenum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'rulenum' ],
+ table => 'cgp_rule',
+ },
+ ],
},
'cgp_rule_action' => {
@@ -2738,9 +3760,14 @@ sub tables_hashref {
'params', 'varchar', 'NULL', 255, '', '',
'rulenum', 'int', '', '', '', '',
],
- 'primary_key' => 'ruleactionnum',
- 'unique' => [],
- 'index' => [ [ 'rulenum' ] ],
+ 'primary_key' => 'ruleactionnum',
+ 'unique' => [],
+ 'index' => [ [ 'rulenum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'rulenum' ],
+ table => 'cgp_rule',
+ },
+ ],
},
'svc_forward' => {
@@ -2751,9 +3778,22 @@ sub tables_hashref {
'dstsvc', 'int', 'NULL', '', '', '',
'dst', 'varchar', 'NULL', 255, '', '',
],
- 'primary_key' => 'svcnum',
- 'unique' => [],
- 'index' => [ ['srcsvc'], ['dstsvc'] ],
+ 'primary_key' => 'svcnum',
+ 'unique' => [],
+ 'index' => [ ['srcsvc'], ['dstsvc'] ],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ },
+ { columns => [ 'srcsvc' ],
+ table => 'svc_acct',
+ references => [ 'svcnum' ]
+ },
+ { columns => [ 'dstsvc' ],
+ table => 'svc_acct',
+ references => [ 'svcnum' ]
+ },
+ ],
},
'svc_www' => {
@@ -2766,6 +3806,18 @@ sub tables_hashref {
'primary_key' => 'svcnum',
'unique' => [],
'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ },
+ { columns => [ 'recnum' ],
+ table => 'domain_record',
+ },
+ { columns => [ 'usersvc' ],
+ table => 'svc_acct',
+ references => [ 'svcnum' ]
+ },
+ ],
},
#'svc_wo' => {
@@ -2792,9 +3844,14 @@ sub tables_hashref {
'totalbytes', 'bigint', 'NULL', '', '', '',
'agentnum', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'prepaynum',
- 'unique' => [ ['identifier'] ],
- 'index' => [],
+ 'primary_key' => 'prepaynum',
+ 'unique' => [ ['identifier'] ],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ },
+ ],
},
'port' => {
@@ -2804,9 +3861,14 @@ sub tables_hashref {
'nasport', 'int', 'NULL', '', '', '',
'nasnum', 'int', '', '', '', '',
],
- 'primary_key' => 'portnum',
- 'unique' => [],
- 'index' => [],
+ 'primary_key' => 'portnum',
+ 'unique' => [],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'nasnum' ],
+ table => 'nas',
+ },
+ ],
},
'nas' => {
@@ -2822,9 +3884,14 @@ sub tables_hashref {
'description', 'varchar', '', 200, 'RADIUS Client', '',
'svcnum', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'nasnum',
- 'unique' => [ [ 'nasname' ], ],
- 'index' => [],
+ 'primary_key' => 'nasnum',
+ 'unique' => [ [ 'nasname' ], ],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'svc_broadband',
+ },
+ ],
},
'export_nas' => {
@@ -2833,9 +3900,17 @@ sub tables_hashref {
'exportnum', 'int', '', '', '', '',
'nasnum', 'int', '', '', '', '',
],
- 'primary_key' => 'exportnasnum',
- 'unique' => [ [ 'exportnum', 'nasnum' ] ],
- 'index' => [ [ 'exportnum' ], [ 'nasnum' ] ],
+ 'primary_key' => 'exportnasnum',
+ 'unique' => [ [ 'exportnum', 'nasnum' ] ],
+ 'index' => [ [ 'exportnum' ], [ 'nasnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'exportnum' ],
+ table => 'part_export',
+ },
+ { columns => [ 'nasnum' ],
+ table => 'nas',
+ },
+ ],
},
'queue' => {
@@ -2850,11 +3925,19 @@ sub tables_hashref {
'secure', 'char', 'NULL', 1, '', '',
'priority', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'jobnum',
- 'unique' => [],
- 'index' => [ [ 'secure' ], [ 'priority' ],
- [ 'job' ], [ 'svcnum' ], [ 'custnum' ], [ 'status' ],
- ],
+ 'primary_key' => 'jobnum',
+ 'unique' => [],
+ 'index' => [ [ 'secure' ], [ 'priority' ],
+ [ 'job' ], [ 'svcnum' ], [ 'custnum' ], [ 'status' ],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ },
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ ],
},
'queue_arg' => {
@@ -2864,9 +3947,14 @@ sub tables_hashref {
'frozen', 'char', 'NULL', 1, '', '',
'arg', 'text', 'NULL', '', '', '',
],
- 'primary_key' => 'argnum',
- 'unique' => [],
- 'index' => [ [ 'jobnum' ] ],
+ 'primary_key' => 'argnum',
+ 'unique' => [],
+ 'index' => [ [ 'jobnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'jobnum' ],
+ table => 'queue',
+ },
+ ],
},
'queue_depend' => {
@@ -2875,9 +3963,18 @@ sub tables_hashref {
'jobnum', 'bigint', '', '', '', '',
'depend_jobnum', 'bigint', '', '', '', '',
],
- 'primary_key' => 'dependnum',
- 'unique' => [],
- 'index' => [ [ 'jobnum' ], [ 'depend_jobnum' ] ],
+ 'primary_key' => 'dependnum',
+ 'unique' => [],
+ 'index' => [ [ 'jobnum' ], [ 'depend_jobnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'jobnum' ],
+ table => 'queue',
+ },
+ { columns => [ 'depend_jobnum' ],
+ table => 'queue',
+ references => [ 'jobnum' ],
+ },
+ ],
},
'export_svc' => {
@@ -2886,20 +3983,36 @@ sub tables_hashref {
'exportnum' => 'int', '', '', '', '',
'svcpart' => 'int', '', '', '', '',
],
- 'primary_key' => 'exportsvcnum',
- 'unique' => [ [ 'exportnum', 'svcpart' ] ],
- 'index' => [ [ 'exportnum' ], [ 'svcpart' ] ],
+ 'primary_key' => 'exportsvcnum',
+ 'unique' => [ [ 'exportnum', 'svcpart' ] ],
+ 'index' => [ [ 'exportnum' ], [ 'svcpart' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'exportnum' ],
+ table => 'part_export',
+ },
+ { columns => [ 'svcpart' ],
+ table => 'part_svc',
+ },
+ ],
},
'export_device' => {
'columns' => [
'exportdevicenum' => 'serial', '', '', '', '',
- 'exportnum' => 'int', '', '', '', '',
+ 'exportnum' => 'int', '', '', '', '',
'devicepart' => 'int', '', '', '', '',
],
- 'primary_key' => 'exportdevicenum',
- 'unique' => [ [ 'exportnum', 'devicepart' ] ],
- 'index' => [ [ 'exportnum' ], [ 'devicepart' ] ],
+ 'primary_key' => 'exportdevicenum',
+ 'unique' => [ [ 'exportnum', 'devicepart' ] ],
+ 'index' => [ [ 'exportnum' ], [ 'devicepart' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'exportnum' ],
+ table => 'part_export',
+ },
+ { columns => [ 'devicepart' ],
+ table => 'part_device',
+ },
+ ],
},
'part_export' => {
@@ -2911,9 +4024,15 @@ sub tables_hashref {
'nodomain', 'char', 'NULL', 1, '', '',
'default_machine','int', 'NULL', '', '', '',
],
- 'primary_key' => 'exportnum',
- 'unique' => [],
- 'index' => [ [ 'machine' ], [ 'exporttype' ] ],
+ 'primary_key' => 'exportnum',
+ 'unique' => [],
+ 'index' => [ [ 'machine' ], [ 'exporttype' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'default_machine' ],
+ table => 'part_export_machine',
+ references => [ 'machinenum' ]
+ },
+ ],
},
'part_export_option' => {
@@ -2923,23 +4042,36 @@ sub tables_hashref {
'optionname', 'varchar', '', $char_d, '', '',
'optionvalue', 'text', 'NULL', '', '', '',
],
- 'primary_key' => 'optionnum',
- 'unique' => [],
- 'index' => [ [ 'exportnum' ], [ 'optionname' ] ],
+ 'primary_key' => 'optionnum',
+ 'unique' => [],
+ 'index' => [ [ 'exportnum' ], [ 'optionname' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'exportnum' ],
+ table => 'part_export',
+ },
+ ],
},
'radius_usergroup' => {
'columns' => [
'usergroupnum', 'serial', '', '', '', '',
'svcnum', 'int', '', '', '', '',
- 'groupname', 'varchar', 'NULL', $char_d, '', '',
+ 'groupname', 'varchar', 'NULL', $char_d, '', '', #deprecated
'groupnum', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'usergroupnum',
- 'unique' => [],
- 'index' => [ [ 'svcnum' ], [ 'groupname' ] ],
+ 'primary_key' => 'usergroupnum',
+ 'unique' => [],
+ 'index' => [ [ 'svcnum' ], [ 'groupname' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc', #svc_acct / svc_broadband
+ },
+ { columns => [ 'groupnum' ],
+ table => 'radius_group',
+ },
+ ],
},
-
+
'radius_group' => {
'columns' => [
'groupnum', 'serial', '', '', '', '',
@@ -2963,9 +4095,14 @@ sub tables_hashref {
'attrtype', 'char', '', 1, '', '',
'op', 'char', '', 2, '', '',
],
- 'primary_key' => 'attrnum',
- 'unique' => [],
- 'index' => [ ['groupnum'], ],
+ 'primary_key' => 'attrnum',
+ 'unique' => [],
+ 'index' => [ ['groupnum'], ],
+ 'foreign_keys' => [
+ { columns => [ 'groupnum' ],
+ table => 'radius_group',
+ },
+ ],
},
'msgcat' => {
@@ -2989,9 +4126,17 @@ sub tables_hashref {
'month', 'int', '', '', '', '',
'amount', @money_type, '', '',
],
- 'primary_key' => 'exemptnum',
- 'unique' => [ [ 'custnum', 'taxnum', 'year', 'month' ] ],
- 'index' => [],
+ 'primary_key' => 'exemptnum',
+ 'unique' => [ [ 'custnum', 'taxnum', 'year', 'month' ] ],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ { columns => [ 'taxnum' ],
+ table => 'cust_main_county',
+ },
+ ],
},
'cust_tax_exempt_pkg' => {
@@ -3011,13 +4156,24 @@ sub tables_hashref {
'exempt_cust_taxname', 'char', 'NULL', 1, '', '',
'exempt_monthly', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'exemptpkgnum',
- 'unique' => [],
- 'index' => [ [ 'taxnum', 'year', 'month' ],
- [ 'billpkgnum' ],
- [ 'taxnum' ],
- [ 'creditbillpkgnum' ],
- ],
+ 'primary_key' => 'exemptpkgnum',
+ 'unique' => [],
+ 'index' => [ [ 'taxnum', 'year', 'month' ],
+ [ 'billpkgnum' ],
+ [ 'taxnum' ],
+ [ 'creditbillpkgnum' ],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'billpkgnum' ],
+ table => 'cust_bill_pkg',
+ },
+ { columns => [ 'taxnum' ],
+ table => 'cust_main_county',
+ },
+ { columns => [ 'creditbillpkgnum' ],
+ table => 'cust_credit_bill_pkg',
+ },
+ ],
},
'cust_tax_exempt_pkg_void' => {
@@ -3037,13 +4193,24 @@ sub tables_hashref {
'exempt_cust_taxname', 'char', 'NULL', 1, '', '',
'exempt_monthly', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'exemptpkgnum',
- 'unique' => [],
- 'index' => [ [ 'taxnum', 'year', 'month' ],
- [ 'billpkgnum' ],
- [ 'taxnum' ],
- [ 'creditbillpkgnum' ],
- ],
+ 'primary_key' => 'exemptpkgnum',
+ 'unique' => [],
+ 'index' => [ [ 'taxnum', 'year', 'month' ],
+ [ 'billpkgnum' ],
+ [ 'taxnum' ],
+ [ 'creditbillpkgnum' ],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'billpkgnum' ],
+ table => 'cust_bill_pkg_void',
+ },
+ { columns => [ 'taxnum' ],
+ table => 'cust_main_county',
+ },
+ { columns => [ 'creditbillpkgnum' ],
+ table => 'cust_credit_bill_pkg',
+ },
+ ],
},
'router' => {
@@ -3054,9 +4221,17 @@ sub tables_hashref {
'agentnum', 'int', 'NULL', '', '', '',
'manual_addr', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'routernum',
- 'unique' => [],
- 'index' => [],
+ 'primary_key' => 'routernum',
+ 'unique' => [],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc', #svc_acct / svc_broadband
+ },
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ },
+ ],
},
'part_svc_router' => {
@@ -3065,9 +4240,17 @@ sub tables_hashref {
'svcpart', 'int', '', '', '', '',
'routernum', 'int', '', '', '', '',
],
- 'primary_key' => 'svcrouternum',
- 'unique' => [],
- 'index' => [],
+ 'primary_key' => 'svcrouternum',
+ 'unique' => [],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'svcpart' ],
+ table => 'part_svc',
+ },
+ { columns => [ 'routernum' ],
+ table => 'router',
+ },
+ ],
},
'addr_block' => {
@@ -3079,9 +4262,17 @@ sub tables_hashref {
'agentnum', 'int', 'NULL', '', '', '',
'manual_flag', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'blocknum',
- 'unique' => [ [ 'blocknum', 'routernum' ] ],
- 'index' => [],
+ 'primary_key' => 'blocknum',
+ 'unique' => [ [ 'blocknum', 'routernum' ] ],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'routernum' ],
+ table => 'router',
+ },
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ },
+ ],
},
'svc_broadband' => {
@@ -3109,9 +4300,27 @@ sub tables_hashref {
'suid', 'int', 'NULL', '', '', '',
'shared_svcnum', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'svcnum',
- 'unique' => [ [ 'ip_addr' ], [ 'mac_addr' ] ],
- 'index' => [],
+ 'primary_key' => 'svcnum',
+ 'unique' => [ [ 'ip_addr' ], [ 'mac_addr' ] ],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ },
+ { columns => [ 'routernum' ],
+ table => 'router',
+ },
+ { columns => [ 'blocknum' ],
+ table => 'addr_block',
+ },
+ { columns => [ 'sectornum' ],
+ table => 'tower_sector',
+ },
+ { columns => [ 'shared_svcnum' ],
+ table => 'svc_broadband',
+ references => [ 'svcnum' ],
+ },
+ ],
},
'tower' => {
@@ -3146,9 +4355,14 @@ sub tables_hashref {
#downtilt etc? rfpath has profile files for devices/antennas you upload?
'range', 'decimal', 'NULL', '', '', '', #?
],
- 'primary_key' => 'sectornum',
- 'unique' => [ [ 'towernum', 'sectorname' ], [ 'ip_addr' ], ],
- 'index' => [ [ 'towernum' ] ],
+ 'primary_key' => 'sectornum',
+ 'unique' => [ [ 'towernum', 'sectorname' ], [ 'ip_addr' ], ],
+ 'index' => [ [ 'towernum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'towernum' ],
+ table => 'tower',
+ },
+ ],
},
'part_virtual_field' => {
@@ -3171,9 +4385,14 @@ sub tables_hashref {
'vfieldpart', 'int', '', '', '', '',
'value', 'varchar', '', 128, '', '',
],
- 'primary_key' => 'vfieldnum',
- 'unique' => [ [ 'vfieldpart', 'recnum' ] ],
- 'index' => [],
+ 'primary_key' => 'vfieldnum',
+ 'unique' => [ [ 'vfieldpart', 'recnum' ] ],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'vfieldpart' ],
+ table => 'part_virtual_field',
+ },
+ ],
},
'acct_snarf' => {
@@ -3191,9 +4410,14 @@ sub tables_hashref {
'tls', 'char', 'NULL', 1, '', '',
'mailbox', 'varchar', 'NULL', $char_d, '', '',
],
- 'primary_key' => 'snarfnum',
- 'unique' => [],
- 'index' => [ [ 'svcnum' ] ],
+ 'primary_key' => 'snarfnum',
+ 'unique' => [],
+ 'index' => [ [ 'svcnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'svc_acct',
+ },
+ ],
},
'svc_external' => {
@@ -3202,9 +4426,14 @@ sub tables_hashref {
'id', 'bigint', 'NULL', '', '', '',
'title', 'varchar', 'NULL', $char_d, '', '',
],
- 'primary_key' => 'svcnum',
- 'unique' => [],
- 'index' => [],
+ 'primary_key' => 'svcnum',
+ 'unique' => [],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ },
+ ],
},
'cust_pay_refund' => {
@@ -3215,9 +4444,17 @@ sub tables_hashref {
'_date', @date_type, '', '',
'amount', @money_type, '', '',
],
- 'primary_key' => 'payrefundnum',
- 'unique' => [],
- 'index' => [ ['paynum'], ['refundnum'] ],
+ 'primary_key' => 'payrefundnum',
+ 'unique' => [],
+ 'index' => [ ['paynum'], ['refundnum'] ],
+ 'foreign_keys' => [
+ { columns => [ 'paynum' ],
+ table => 'cust_pay',
+ },
+ { columns => [ 'refundnum' ],
+ table => 'cust_refund',
+ },
+ ],
},
'part_pkg_option' => {
@@ -3227,9 +4464,14 @@ sub tables_hashref {
'optionname', 'varchar', '', $char_d, '', '',
'optionvalue', 'text', 'NULL', '', '', '',
],
- 'primary_key' => 'optionnum',
- 'unique' => [],
- 'index' => [ [ 'pkgpart' ], [ 'optionname' ] ],
+ 'primary_key' => 'optionnum',
+ 'unique' => [],
+ 'index' => [ [ 'pkgpart' ], [ 'optionname' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'pkgpart' ],
+ table => 'part_pkg',
+ },
+ ],
},
'part_pkg_vendor' => {
@@ -3239,11 +4481,19 @@ sub tables_hashref {
'exportnum', 'int', '', '', '', '',
'vendor_pkg_id', 'varchar', '', $char_d, '', '',
],
- 'primary_key' => 'num',
- 'unique' => [ [ 'pkgpart', 'exportnum' ] ],
- 'index' => [ [ 'pkgpart' ] ],
+ 'primary_key' => 'num',
+ 'unique' => [ [ 'pkgpart', 'exportnum' ] ],
+ 'index' => [ [ 'pkgpart' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'pkgpart' ],
+ table => 'part_pkg',
+ },
+ { columns => [ 'exportnum' ],
+ table => 'part_export',
+ },
+ ],
},
-
+
'part_pkg_report_option' => {
'columns' => [
'num', 'serial', '', '', '', '',
@@ -3265,9 +4515,14 @@ sub tables_hashref {
'rollover', 'char', 'NULL', 1, '', '',
'description', 'varchar', 'NULL', $char_d, '', '',
],
- 'primary_key' => 'pkgusagepart',
- 'unique' => [],
- 'index' => [ [ 'pkgpart' ] ],
+ 'primary_key' => 'pkgusagepart',
+ 'unique' => [],
+ 'index' => [ [ 'pkgpart' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'pkgpart' ],
+ table => 'part_pkg',
+ },
+ ],
},
'part_pkg_usage_class' => {
@@ -3276,9 +4531,17 @@ sub tables_hashref {
'pkgusagepart', 'int', '', '', '', '',
'classnum', 'int','NULL', '', '', '',
],
- 'primary_key' => 'num',
- 'unique' => [ [ 'pkgusagepart', 'classnum' ] ],
- 'index' => [],
+ 'primary_key' => 'num',
+ 'unique' => [ [ 'pkgusagepart', 'classnum' ] ],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'pkgusagepart' ],
+ table => 'part_pkg_usage',
+ },
+ { columns => [ 'classnum' ],
+ table => 'usage_class',
+ },
+ ],
},
'rate' => {
@@ -3307,11 +4570,33 @@ sub tables_hashref {
'cdrtypenum', 'int', 'NULL', '', '', '',
'region_group', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'ratedetailnum',
- 'unique' => [ [ 'ratenum', 'orig_regionnum', 'dest_regionnum' ] ],
- 'index' => [ [ 'ratenum', 'dest_regionnum' ],
- [ 'ratenum', 'ratetimenum' ]
- ],
+ 'primary_key' => 'ratedetailnum',
+ 'unique' => [ [ 'ratenum', 'orig_regionnum', 'dest_regionnum' ] ],
+ 'index' => [ [ 'ratenum', 'dest_regionnum' ],
+ [ 'ratenum', 'ratetimenum' ]
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'ratenum' ],
+ table => 'rate',
+ },
+ { columns => [ 'orig_regionnum' ],
+ table => 'rate_region',
+ references => [ 'regionnum' ],
+ },
+ { columns => [ 'dest_regionnum' ],
+ table => 'rate_region',
+ references => [ 'regionnum' ],
+ },
+ { columns => [ 'ratetimenum' ],
+ table => 'rate_time',
+ },
+ { columns => [ 'classnum' ],
+ table => 'usage_class',
+ },
+ { columns => [ 'cdrtypenum' ],
+ table => 'cdr_type',
+ },
+ ],
},
'rate_region' => {
@@ -3336,9 +4621,17 @@ sub tables_hashref {
'state', 'char', 'NULL', 2, '', '',
'ocn', 'char', 'NULL', 4, '', '',
],
- 'primary_key' => 'prefixnum',
- 'unique' => [],
- 'index' => [ [ 'countrycode' ], [ 'npa' ], [ 'regionnum' ] ],
+ 'primary_key' => 'prefixnum',
+ 'unique' => [],
+ 'index' => [ [ 'countrycode' ], [ 'npa' ], [ 'regionnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'regionnum' ],
+ table => 'rate_region',
+ },
+ { columns => [ 'latanum' ],
+ table => 'lata',
+ },
+ ],
},
'rate_time' => {
@@ -3358,10 +4651,15 @@ sub tables_hashref {
'etime', 'int', '', '', '', '',
'ratetimenum', 'int', '', '', '', '',
],
- 'primary_key' => 'intervalnum',
- 'unique' => [],
- 'index' => [],
- },
+ 'primary_key' => 'intervalnum',
+ 'unique' => [],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'ratetimenum' ],
+ table => 'rate_time',
+ },
+ ],
+ },
#not really part of the above rate_ stuff (used with flat rate rather than
# rated billing), but could be eventually, and its a rate
@@ -3382,9 +4680,14 @@ sub tables_hashref {
'min_quan', 'int', '', '', '', '',
'min_charge', 'decimal', '', '10,4', '', '',
],
- 'primary_key' => 'tierdetailnum',
- 'unique' => [],
- 'index' => [ ['tiernum'], ],
+ 'primary_key' => 'tierdetailnum',
+ 'unique' => [],
+ 'index' => [ ['tiernum'], ],
+ 'foreign_keys' => [
+ { columns => [ 'tiernum' ],
+ table => 'rate_tier',
+ },
+ ],
},
'usage_class' => {
@@ -3406,10 +4709,15 @@ sub tables_hashref {
'code', 'varchar', '', $char_d, '', '',
'agentnum', 'int', '', '', '', '',
],
- 'primary_key' => 'codenum',
- 'unique' => [ [ 'agentnum', 'code' ] ],
- 'index' => [ [ 'agentnum' ] ],
- },
+ 'primary_key' => 'codenum',
+ 'unique' => [ [ 'agentnum', 'code' ] ],
+ 'index' => [ [ 'agentnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ },
+ ],
+ },
'reg_code_pkg' => {
'columns' => [
@@ -3417,9 +4725,17 @@ sub tables_hashref {
'codenum', 'int', '', '', '', '',
'pkgpart', 'int', '', '', '', '',
],
- 'primary_key' => 'codepkgnum',
- 'unique' => [ [ 'codenum', 'pkgpart' ] ],
- 'index' => [ [ 'codenum' ] ],
+ 'primary_key' => 'codepkgnum',
+ 'unique' => [ [ 'codenum', 'pkgpart' ] ],
+ 'index' => [ [ 'codenum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'codenum' ],
+ table => 'reg_code',
+ },
+ { columns => [ 'pkgpart' ],
+ table => 'part_pkg',
+ },
+ ],
},
'clientapi_session' => {
@@ -3440,9 +4756,14 @@ sub tables_hashref {
'fieldname', 'varchar', '', $char_d, '', '',
'fieldvalue', 'text', 'NULL', '', '', '',
],
- 'primary_key' => 'fieldnum',
- 'unique' => [ [ 'sessionnum', 'fieldname' ] ],
- 'index' => [],
+ 'primary_key' => 'fieldnum',
+ 'unique' => [ [ 'sessionnum', 'fieldname' ] ],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'sessionnum' ],
+ table => 'clientapi_session',
+ },
+ ],
},
'payment_gateway' => {
@@ -3469,9 +4790,14 @@ sub tables_hashref {
'optionname', 'varchar', '', $char_d, '', '',
'optionvalue', 'text', 'NULL', '', '', '',
],
- 'primary_key' => 'optionnum',
- 'unique' => [],
- 'index' => [ [ 'gatewaynum' ], [ 'optionname' ] ],
+ 'primary_key' => 'optionnum',
+ 'unique' => [],
+ 'index' => [ [ 'gatewaynum' ], [ 'optionname' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'gatewaynum' ],
+ table => 'payment_gateway',
+ },
+ ],
},
'agent_payment_gateway' => {
@@ -3482,9 +4808,19 @@ sub tables_hashref {
'cardtype', 'varchar', 'NULL', $char_d, '', '',
'taxclass', 'varchar', 'NULL', $char_d, '', '',
],
- 'primary_key' => 'agentgatewaynum',
- 'unique' => [],
- 'index' => [ [ 'agentnum', 'cardtype' ], ],
+ 'primary_key' => 'agentgatewaynum',
+ 'unique' => [],
+ 'index' => [ [ 'agentnum', 'cardtype' ], ],
+
+ 'foreign_keys' => [
+
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ },
+ { columns => [ 'gatewaynum' ],
+ table => 'payment_gateway',
+ },
+ ],
},
'banned_pay' => {
@@ -3500,9 +4836,14 @@ sub tables_hashref {
'bantype', 'varchar', 'NULL', $char_d, '', '',
'reason', 'varchar', 'NULL', $char_d, '', '',
],
- 'primary_key' => 'bannum',
- 'unique' => [],
- 'index' => [ [ 'payby', 'payinfo' ], [ 'usernum' ], ],
+ 'primary_key' => 'bannum',
+ 'unique' => [],
+ 'index' => [ [ 'payby', 'payinfo' ], [ 'usernum' ], ],
+ 'foreign_keys' => [
+ { columns => [ 'usernum' ],
+ table => 'access_user',
+ },
+ ],
},
'pkg_category' => {
@@ -3526,9 +4867,14 @@ sub tables_hashref {
'disabled', 'char', 'NULL', 1, '', '',
'fcc_ds0s', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'classnum',
- 'unique' => [],
- 'index' => [ ['disabled'] ],
+ 'primary_key' => 'classnum',
+ 'unique' => [],
+ 'index' => [ ['disabled'] ],
+ 'foreign_keys' => [
+ { columns => [ 'categorynum' ],
+ table => 'pkg_category',
+ },
+ ],
},
'cdr' => {
@@ -3610,7 +4956,7 @@ sub tables_hashref {
###
'servicecode', 'int', 'NULL', '', '', '',
'quantity_able', 'int', 'NULL', '', '', '',
-
+
###
#and now for our own fields
###
@@ -3670,6 +5016,8 @@ sub tables_hashref {
[ 'cdrbatch' ], [ 'cdrbatchnum' ],
[ 'src_ip_addr' ], [ 'dst_ip_addr' ], [ 'dst_term' ],
],
+ #no FKs on cdr table... choosing not to throw errors no matter what's
+ # thrown in here. better to have the data.
},
'cdr_batch' => {
@@ -3694,9 +5042,17 @@ sub tables_hashref {
'status', 'varchar', 'NULL', 32, '', '',
'svcnum', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'cdrtermnum',
- 'unique' => [ [ 'acctid', 'termpart' ] ],
- 'index' => [ [ 'acctid' ], [ 'status' ], ],
+ 'primary_key' => 'cdrtermnum',
+ 'unique' => [ [ 'acctid', 'termpart' ] ],
+ 'index' => [ [ 'acctid' ], [ 'status' ], ],
+ 'foreign_keys' => [
+ { columns => [ 'acctid' ],
+ table => 'cdr',
+ },
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ },
+ ],
},
#to handle multiple termination/settlement passes...
@@ -3767,9 +5123,20 @@ sub tables_hashref {
'svcnum', 'int', 'NULL', '', '', '',
'svc_field', 'varchar', 'NULL', $char_d, '', '',
],
- 'primary_key' => 'itemnum',
- 'unique' => [ [ 'classnum', 'item' ] ],
- 'index' => [ [ 'classnum' ], [ 'agentnum' ], [ 'svcnum' ] ],
+ 'primary_key' => 'itemnum',
+ 'unique' => [ [ 'classnum', 'item' ] ],
+ 'index' => [ [ 'classnum' ], [ 'agentnum' ], [ 'svcnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'classnum' ],
+ table => 'inventory_class',
+ },
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ },
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ },
+ ],
},
'inventory_class' => {
@@ -3790,9 +5157,14 @@ sub tables_hashref {
'start_date', @date_type, '', '',
'last_date', @date_type, '', '',
],
- 'primary_key' => 'sessionnum',
- 'unique' => [ [ 'sessionkey' ] ],
- 'index' => [],
+ 'primary_key' => 'sessionnum',
+ 'unique' => [ [ 'sessionkey' ] ],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'usernum' ],
+ table => 'access_user',
+ },
+ ],
},
'access_user' => {
@@ -3807,9 +5179,19 @@ sub tables_hashref {
'report_salesnum', 'int', 'NULL', '', '', '',
'disabled', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'usernum',
- 'unique' => [ [ 'username' ] ],
- 'index' => [ [ 'user_custnum' ] ],
+ 'primary_key' => 'usernum',
+ 'unique' => [ [ 'username' ] ],
+ 'index' => [ [ 'user_custnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'user_custnum' ],
+ table => 'cust_main',
+ references => [ 'custnum' ],
+ },
+ { columns => [ 'report_salesnum' ],
+ table => 'sales',
+ references => [ 'salesnum' ],
+ },
+ ],
},
'access_user_pref' => {
@@ -3820,9 +5202,14 @@ sub tables_hashref {
'prefvalue', 'text', 'NULL', '', '', '',
'expiration', @date_type, '', '',
],
- 'primary_key' => 'prefnum',
- 'unique' => [],
- 'index' => [ [ 'usernum' ] ],
+ 'primary_key' => 'prefnum',
+ 'unique' => [],
+ 'index' => [ [ 'usernum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'usernum' ],
+ table => 'access_user',
+ },
+ ],
},
'access_group' => {
@@ -3841,10 +5228,18 @@ sub tables_hashref {
'usernum', 'int', '', '', '', '',
'groupnum', 'int', '', '', '', '',
],
- 'primary_key' => 'usergroupnum',
- 'unique' => [ [ 'usernum', 'groupnum' ] ],
- 'index' => [ [ 'usernum' ] ],
- },
+ 'primary_key' => 'usergroupnum',
+ 'unique' => [ [ 'usernum', 'groupnum' ] ],
+ 'index' => [ [ 'usernum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'usernum' ],
+ table => 'access_user',
+ },
+ { columns => [ 'groupnum' ],
+ table => 'access_group',
+ },
+ ],
+ },
'access_groupagent' => {
'columns' => [
@@ -3852,9 +5247,17 @@ sub tables_hashref {
'groupnum', 'int', '', '', '', '',
'agentnum', 'int', '', '', '', '',
],
- 'primary_key' => 'groupagentnum',
- 'unique' => [ [ 'groupnum', 'agentnum' ] ],
- 'index' => [ [ 'groupnum' ] ],
+ 'primary_key' => 'groupagentnum',
+ 'unique' => [ [ 'groupnum', 'agentnum' ] ],
+ 'index' => [ [ 'groupnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'groupnum' ],
+ table => 'access_group',
+ },
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ },
+ ],
},
'access_right' => {
@@ -3895,11 +5298,31 @@ sub tables_hashref {
'sms_account', 'varchar', 'NULL', $char_d, '', '',
'max_simultaneous', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'svcnum',
- 'unique' => [ [ 'sms_carrierid', 'sms_account'] ],
- 'index' => [ ['countrycode', 'phonenum'], ['pbxsvc'], ['domsvc'],
- ['locationnum'], ['sms_carrierid'],
- ],
+ 'primary_key' => 'svcnum',
+ 'unique' => [ [ 'sms_carrierid', 'sms_account'] ],
+ 'index' => [ ['countrycode', 'phonenum'], ['pbxsvc'], ['domsvc'],
+ ['locationnum'], ['sms_carrierid'],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ },
+ { columns => [ 'pbxsvc' ],
+ table => 'svc_pbx', #'cust_svc',
+ references => [ 'svcnum' ],
+ },
+ { columns => [ 'domsvc' ],
+ table => 'svc_domain', #'cust_svc',
+ references => [ 'svcnum' ],
+ },
+ { columns => [ 'locationnum' ],
+ table => 'cust_location',
+ },
+ { columns => [ 'sms_carrierid' ],
+ table => 'cdr_carrier',
+ references => [ 'carrierid' ],
+ },
+ ],
},
'phone_device' => {
@@ -3909,9 +5332,17 @@ sub tables_hashref {
'svcnum', 'int', '', '', '', '',
'mac_addr', 'varchar', 'NULL', 12, '', '',
],
- 'primary_key' => 'devicenum',
- 'unique' => [ [ 'mac_addr' ], ],
- 'index' => [ [ 'devicepart' ], [ 'svcnum' ], ],
+ 'primary_key' => 'devicenum',
+ 'unique' => [ [ 'mac_addr' ], ],
+ 'index' => [ [ 'devicepart' ], [ 'svcnum' ], ],
+ 'foreign_keys' => [
+ { columns => [ 'devicepart' ],
+ table => 'part_device',
+ },
+ { columns => [ 'svcnum' ],
+ table => 'svc_phone',
+ },
+ ],
},
'part_device' => {
@@ -3920,9 +5351,15 @@ sub tables_hashref {
'devicename', 'varchar', '', $char_d, '', '',
'inventory_classnum', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'devicepart',
- 'unique' => [ [ 'devicename' ] ], #?
- 'index' => [],
+ 'primary_key' => 'devicepart',
+ 'unique' => [ [ 'devicename' ] ], #?
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'inventory_classnum' ],
+ table => 'inventory_class',
+ references => [ 'classnum' ],
+ },
+ ],
},
'phone_avail' => {
@@ -3942,18 +5379,35 @@ sub tables_hashref {
'svcnum', 'int', 'NULL', '', '', '',
'availbatch', 'varchar', 'NULL', $char_d, '', '',
],
- 'primary_key' => 'availnum',
- 'unique' => [],
- 'index' => [ [ 'exportnum', 'countrycode', 'state' ], #npa search
- [ 'exportnum', 'countrycode', 'npa' ], #nxx search
- [ 'exportnum', 'countrycode', 'npa', 'nxx' ],#station search
- [ 'exportnum', 'countrycode', 'npa', 'nxx', 'station' ], # #
- [ 'svcnum' ],
- [ 'availbatch' ],
- [ 'latanum' ],
- ],
+ 'primary_key' => 'availnum',
+ 'unique' => [],
+ 'index' => [ ['exportnum','countrycode','state'], #npa search
+ ['exportnum','countrycode','npa'], #nxx search
+ ['exportnum','countrycode','npa','nxx'],#station srch
+ [ 'exportnum','countrycode','npa','nxx','station'], #
+ [ 'svcnum' ],
+ [ 'availbatch' ],
+ [ 'latanum' ],
+ ],
+ 'foreign_keys' => [
+ { columns => [ 'exportnum' ],
+ table => 'part_export',
+ },
+ { columns => [ 'latanum' ],
+ table => 'lata',
+ },
+ { columns => [ 'msanum' ],
+ table => 'msa',
+ },
+ { columns => [ 'ordernum' ],
+ table => 'did_order',
+ },
+ { columns => [ 'svcnum' ],
+ table => 'svc_phone',
+ },
+ ],
},
-
+
'lata' => {
'columns' => [
'latanum', 'int', '', '', '', '',
@@ -3964,7 +5418,7 @@ sub tables_hashref {
'unique' => [],
'index' => [],
},
-
+
'msa' => {
'columns' => [
'msanum', 'int', '', '', '', '',
@@ -3974,7 +5428,7 @@ sub tables_hashref {
'unique' => [],
'index' => [],
},
-
+
'rate_center' => {
'columns' => [
'ratecenternum', 'serial', '', '', '', '',
@@ -3994,7 +5448,7 @@ sub tables_hashref {
'unique' => [],
'index' => [],
},
-
+
'did_order_item' => {
'columns' => [
'orderitemnum', 'serial', '', '', '', '',
@@ -4007,9 +5461,26 @@ sub tables_hashref {
'quantity', 'int', '', '', '', '',
'custnum', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'orderitemnum',
- 'unique' => [],
- 'index' => [],
+ 'primary_key' => 'orderitemnum',
+ 'unique' => [],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'ordernum' ],
+ table => 'did_order',
+ },
+ { columns => [ 'msanum' ],
+ table => 'msa',
+ },
+ { columns => [ 'latanum' ],
+ table => 'lata',
+ },
+ { columns => [ 'ratecenternum' ],
+ table => 'rate_center',
+ },
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ ],
},
'did_order' => {
@@ -4022,9 +5493,17 @@ sub tables_hashref {
'confirmed', 'int', 'NULL', '', '', '',
'received', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'ordernum',
- 'unique' => [ [ 'vendornum', 'vendor_order_id' ] ],
- 'index' => [],
+ 'primary_key' => 'ordernum',
+ 'unique' => [ [ 'vendornum', 'vendor_order_id' ] ],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'vendornum' ],
+ table => 'did_vendor',
+ },
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ ],
},
'reason_type' => {
@@ -4047,9 +5526,19 @@ sub tables_hashref {
'unsuspend_pkgpart', 'int', 'NULL', '', '', '',
'unsuspend_hold','char', 'NULL', 1, '', '',
],
- 'primary_key' => 'reasonnum',
- 'unique' => [],
- 'index' => [],
+ 'primary_key' => 'reasonnum',
+ 'unique' => [],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'reason_type' ],
+ table => 'reason_type',
+ references => [ 'typenum' ],
+ },
+ { columns => [ 'unsuspend_pkgpart' ],
+ table => 'part_pkg',
+ references => [ 'pkgpart' ],
+ },
+ ],
},
'conf' => {
@@ -4060,9 +5549,14 @@ sub tables_hashref {
'name', 'varchar', '', $char_d, '', '',
'value', 'text', 'NULL', '', '', '',
],
- 'primary_key' => 'confnum',
- 'unique' => [ [ 'agentnum', 'locale', 'name' ] ],
- 'index' => [],
+ 'primary_key' => 'confnum',
+ 'unique' => [ [ 'agentnum', 'locale', 'name' ] ],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ },
+ ],
},
'pkg_referral' => {
@@ -4071,9 +5565,17 @@ sub tables_hashref {
'pkgnum', 'int', '', '', '', '',
'refnum', 'int', '', '', '', '',
],
- 'primary_key' => 'pkgrefnum',
- 'unique' => [ [ 'pkgnum', 'refnum' ] ],
- 'index' => [ [ 'pkgnum' ], [ 'refnum' ] ],
+ 'primary_key' => 'pkgrefnum',
+ 'unique' => [ [ 'pkgnum', 'refnum' ] ],
+ 'index' => [ [ 'pkgnum' ], [ 'refnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'pkgnum' ],
+ table => 'cust_pkg',
+ },
+ { columns => [ 'refnum' ],
+ table => 'part_referral',
+ },
+ ],
},
'svc_pbx' => {
@@ -4084,9 +5586,14 @@ sub tables_hashref {
'max_extensions', 'int', 'NULL', '', '', '',
'max_simultaneous', 'int', 'NULL', '', '', '',
],
- 'primary_key' => 'svcnum',
- 'unique' => [],
- 'index' => [ [ 'id' ] ],
+ 'primary_key' => 'svcnum',
+ 'unique' => [],
+ 'index' => [ [ 'id' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ },
+ ],
},
'svc_mailinglist' => { #svc_group?
@@ -4100,9 +5607,21 @@ sub tables_hashref {
'reject_auto', 'char', 'NULL', 1, '', '',#RejectAuto
'remove_to_and_cc', 'char', 'NULL', 1, '', '',#RemoveToAndCc
],
- 'primary_key' => 'svcnum',
- 'unique' => [],
- 'index' => [ ['username'], ['domsvc'], ['listnum'] ],
+ 'primary_key' => 'svcnum',
+ 'unique' => [],
+ 'index' => [ ['username'], ['domsvc'], ['listnum'] ],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ },
+ { columns => [ 'domsvc' ],
+ table => 'svc_domain', #'cust_svc',
+ references => [ 'svcnum' ],
+ },
+ { columns => [ 'listnum' ],
+ table => 'mailinglist',
+ },
+ ],
},
'mailinglist' => {
@@ -4123,9 +5642,20 @@ sub tables_hashref {
'contactemailnum', 'int', 'NULL', '', '', '',
'email', 'varchar', 'NULL', 255, '', '',
],
- 'primary_key' => 'membernum',
- 'unique' => [],
- 'index' => [['listnum'],['svcnum'],['contactemailnum'],['email']],
+ 'primary_key' => 'membernum',
+ 'unique' => [],
+ 'index' => [['listnum'],['svcnum'],['contactemailnum'],['email']],
+ 'foreign_keys' => [
+ { columns => [ 'listnum' ],
+ table => 'mailinglist',
+ },
+ { columns => [ 'svcnum' ],
+ table => 'svc_acct',
+ },
+ { columns => [ 'contactemailnum' ],
+ table => 'contact_email',
+ },
+ ],
},
'bill_batch' => {
@@ -4135,9 +5665,14 @@ sub tables_hashref {
'status', 'char', 'NULL', '1', '', '',
'pdf', 'blob', 'NULL', '', '', '',
],
- 'primary_key' => 'batchnum',
- 'unique' => [],
- 'index' => [ ['agentnum'] ],
+ 'primary_key' => 'batchnum',
+ 'unique' => [],
+ 'index' => [ ['agentnum'] ],
+ 'foreign_keys' => [
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ },
+ ],
},
'cust_bill_batch' => {
@@ -4146,9 +5681,17 @@ sub tables_hashref {
'batchnum', 'int', '', '', '', '',
'invnum', 'int', '', '', '', '',
],
- 'primary_key' => 'billbatchnum',
- 'unique' => [],
- 'index' => [ [ 'batchnum' ], [ 'invnum' ] ],
+ 'primary_key' => 'billbatchnum',
+ 'unique' => [],
+ 'index' => [ [ 'batchnum' ], [ 'invnum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'batchnum' ],
+ table => 'bill_batch',
+ },
+ { columns => [ 'invnum' ],
+ table => 'cust_bill',
+ },
+ ],
},
'cust_bill_batch_option' => {
@@ -4158,10 +5701,15 @@ sub tables_hashref {
'optionname', 'varchar', '', $char_d, '', '',
'optionvalue', 'text', 'NULL', '', '', '',
],
- 'primary_key' => 'optionnum',
- 'unique' => [],
- 'index' => [ [ 'billbatchnum' ], [ 'optionname' ] ],
- },
+ 'primary_key' => 'optionnum',
+ 'unique' => [],
+ 'index' => [ [ 'billbatchnum' ], [ 'optionname' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'billbatchnum' ],
+ table => 'cust_bill_batch',
+ },
+ ],
+ },
'msg_template' => {
'columns' => [
@@ -4175,9 +5723,14 @@ sub tables_hashref {
'from_addr', 'varchar', 'NULL', 255, '', '',
'bcc_addr', 'varchar', 'NULL', 255, '', '',
],
- 'primary_key' => 'msgnum',
- 'unique' => [ ],
- 'index' => [ ['agentnum'], ],
+ 'primary_key' => 'msgnum',
+ 'unique' => [ ],
+ 'index' => [ ['agentnum'], ],
+ 'foreign_keys' => [
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ },
+ ],
},
'template_content' => {
@@ -4188,9 +5741,14 @@ sub tables_hashref {
'subject', 'varchar', 'NULL', 512, '', '',
'body', 'text', 'NULL', '', '', '',
],
- 'primary_key' => 'contentnum',
- 'unique' => [ ['msgnum', 'locale'] ],
- 'index' => [ ],
+ 'primary_key' => 'contentnum',
+ 'unique' => [ ['msgnum', 'locale'] ],
+ 'index' => [ ],
+ 'foreign_keys' => [
+ { columns => [ 'msgnum' ],
+ table => 'msg_template',
+ },
+ ],
},
'cust_msg' => {
@@ -4206,9 +5764,17 @@ sub tables_hashref {
'error', 'varchar', 'NULL', 255, '', '',
'status', 'varchar', '',$char_d, '', '',
],
- 'primary_key' => 'custmsgnum',
- 'unique' => [ ],
- 'index' => [ ['custnum'], ],
+ 'primary_key' => 'custmsgnum',
+ 'unique' => [ ],
+ 'index' => [ ['custnum'], ],
+ 'foreign_keys' => [
+ { columns => [ 'custnum' ],
+ table => 'cust_main',
+ },
+ { columns => [ 'msgnum' ],
+ table => 'msg_template',
+ },
+ ],
},
'svc_cert' => {
@@ -4227,9 +5793,17 @@ sub tables_hashref {
'country', 'char', 'NULL', 2, '', '',
'cert_contact', 'varchar', 'NULL', $char_d, '', '',
],
- 'primary_key' => 'svcnum',
- 'unique' => [],
- 'index' => [], #recnum
+ 'primary_key' => 'svcnum',
+ 'unique' => [],
+ 'index' => [], #recnum
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ },
+ { columns => [ 'recnum' ],
+ table => 'domain_record',
+ },
+ ],
},
'svc_port' => {
@@ -4237,9 +5811,14 @@ sub tables_hashref {
'svcnum', 'int', '', '', '', '',
'serviceid', 'varchar', '', 64, '', '', #srvexport / reportfields
],
- 'primary_key' => 'svcnum',
- 'unique' => [],
- 'index' => [], #recnum
+ 'primary_key' => 'svcnum',
+ 'unique' => [],
+ 'index' => [], #recnum
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ },
+ ],
},
'areacode' => {
@@ -4281,9 +5860,14 @@ sub tables_hashref {
'subject', 'varchar', 'NULL', '255', '', '',
'handling', 'varchar', 'NULL', $char_d, '', '',
],
- 'primary_key' => 'targetnum',
- 'unique' => [ [ 'targetnum' ] ],
- 'index' => [],
+ 'primary_key' => 'targetnum',
+ 'unique' => [ [ 'targetnum' ] ],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ },
+ ],
},
'log' => {
@@ -4296,9 +5880,14 @@ sub tables_hashref {
'level', 'int', '', '', '', '',
'message', 'text', '', '', '', '',
],
- 'primary_key' => 'lognum',
- 'unique' => [],
- 'index' => [ ['_date'], ['level'] ],
+ 'primary_key' => 'lognum',
+ 'unique' => [],
+ 'index' => [ ['_date'], ['level'] ],
+ 'foreign_keys' => [
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ },
+ ],
},
'log_context' => {
@@ -4307,9 +5896,14 @@ sub tables_hashref {
'lognum', 'int', '', '', '', '',
'context', 'varchar', '', 32, '', '',
],
- 'primary_key' => 'logcontextnum',
- 'unique' => [ [ 'lognum', 'context' ] ],
- 'index' => [],
+ 'primary_key' => 'logcontextnum',
+ 'unique' => [ [ 'lognum', 'context' ] ],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'lognum' ],
+ table => 'log',
+ },
+ ],
},
'svc_alarm' => {
@@ -4323,9 +5917,14 @@ sub tables_hashref {
#cs
#rep
],
- 'primary_key' => 'svcnum',
- 'unique' => [], #system/type/acctnum??
- 'index' => [],
+ 'primary_key' => 'svcnum',
+ 'unique' => [], #system/type/acctnum??
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ },
+ ],
},
'svc_cable' => {
@@ -4337,9 +5936,20 @@ sub tables_hashref {
'serialnum', 'varchar', 'NULL', $char_d, '', '',
'mac_addr', 'varchar', 'NULL', 12, '', '',
],
- 'primary_key' => 'svcnum',
- 'unique' => [],
- 'index' => [],
+ 'primary_key' => 'svcnum',
+ 'unique' => [],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'svcnum' ],
+ table => 'cust_svc',
+ },
+ { columns => [ 'providernum' ],
+ table => 'cable_provider',
+ },
+ { columns => [ 'modelnum' ],
+ table => 'cable_model',
+ },
+ ],
},
'cable_model' => {
@@ -4371,9 +5981,14 @@ sub tables_hashref {
'classnum', 'int', '', '', '', '',
'disabled', 'char', 'NULL', 1, '', '',
],
- 'primary_key' => 'vendnum',
- 'unique' => [ ['vendname', 'disabled'] ],
- 'index' => [],
+ 'primary_key' => 'vendnum',
+ 'unique' => [ ['vendname', 'disabled'] ],
+ 'index' => [],
+ 'foreign_keys' => [
+ { columns => [ 'classnum' ],
+ table => 'vend_class',
+ },
+ ],
},
'vend_class' => {
@@ -4394,9 +6009,14 @@ sub tables_hashref {
'_date', @date_type, '', '',
'charged', @money_type, '', '',
],
- 'primary_key' => 'vendbillnum',
- 'unique' => [],
- 'index' => [ ['vendnum'], ['_date'], ],
+ 'primary_key' => 'vendbillnum',
+ 'unique' => [],
+ 'index' => [ ['vendnum'], ['_date'], ],
+ 'foreign_keys' => [
+ { columns => [ 'vendnum' ],
+ table => 'vend_main',
+ },
+ ],
},
'vend_pay' => {
@@ -4406,9 +6026,14 @@ sub tables_hashref {
'_date', @date_type, '', '',
'paid', @money_type, '', '',
],
- 'primary_key' => 'vendpaynum',
- 'unique' => [],
- 'index' => [ [ 'vendnum' ], [ '_date' ], ],
+ 'primary_key' => 'vendpaynum',
+ 'unique' => [],
+ 'index' => [ [ 'vendnum' ], [ '_date' ], ],
+ 'foreign_keys' => [
+ { columns => [ 'vendnum' ],
+ table => 'vend_main',
+ },
+ ],
},
'vend_bill_pay' => {
@@ -4419,9 +6044,17 @@ sub tables_hashref {
'amount', @money_type, '', '',
#? '_date', @date_type, '', '',
],
- 'primary_key' => 'vendbillpaynum',
- 'unique' => [],
- 'index' => [ [ 'vendbillnum' ], [ 'vendpaynum' ] ],
+ 'primary_key' => 'vendbillpaynum',
+ 'unique' => [],
+ 'index' => [ [ 'vendbillnum' ], [ 'vendpaynum' ] ],
+ 'foreign_keys' => [
+ { columns => [ 'vendbillnum' ],
+ table => 'vend_bill',
+ },
+ { columns => [ 'vendpaynum' ],
+ table => 'vend_pay',
+ },
+ ],
},
%{ tables_hashref_torrus() },
@@ -4444,9 +6077,14 @@ sub tables_hashref {
'derivenum', 'int', '', '', '', '',
'serviceid', 'varchar', '', 64, '', '', #srvexport / reportfields
],
- 'primary_key' => 'componentnum',
- 'unique' => [ [ 'derivenum', 'serviceid' ], ],
- 'index' => [ [ 'derivenum', ], ],
+ 'primary_key' => 'componentnum',
+ 'unique' => [ [ 'derivenum', 'serviceid' ], ],
+ 'index' => [ [ 'derivenum', ], ],
+ 'foreign_keys' => [
+ { columns => [ 'derivenum' ],
+ table => 'torrus_srvderive',
+ },
+ ],
},
'invoice_mode' => {
@@ -4458,6 +6096,11 @@ sub tables_hashref {
'primary_key' => 'modenum',
'unique' => [ ],
'index' => [ ],
+ 'foreign_keys' => [
+ { columns => [ 'agentnum' ],
+ table => 'agent',
+ },
+ ],
},
'invoice_conf' => {
@@ -4491,9 +6134,14 @@ sub tables_hashref {
'logo_eps', 'blob', 'NULL', '', '', '',
'lpr', 'varchar', 'NULL', $char_d, '', '',
],
- 'primary_key' => 'confnum',
- 'unique' => [ [ 'modenum', 'locale' ] ],
- 'index' => [ ],
+ 'primary_key' => 'confnum',
+ 'unique' => [ [ 'modenum', 'locale' ] ],
+ 'index' => [ ],
+ 'foreign_keys' => [
+ { columns => [ 'modenum' ],
+ table => 'invoice_mode',
+ },
+ ],
},
# name type nullability length default local
-----------------------------------------------------------------------
Summary of changes:
FS/FS/Record.pm | 35 +-
FS/FS/Schema.pm | 2894 +++++++++++++++++++++++++++++++++++++++++++------------
2 files changed, 2286 insertions(+), 643 deletions(-)
More information about the freeside-commits
mailing list