3 use vars qw(@ISA @EXPORT_OK $DEBUG $setup_hack %dbdef_cache);
4 use subs qw(reload_dbdef);
6 use DBIx::DBSchema 0.44; #for foreign keys with MATCH / ON DELETE/UPDATE
7 use DBIx::DBSchema::Table;
8 use DBIx::DBSchema::Column;
9 use DBIx::DBSchema::Index;
10 use DBIx::DBSchema::ForeignKey;
11 #can't use this yet, dependency bs #use FS::Conf;
14 @EXPORT_OK = qw( dbdef dbdef_dist reload_dbdef );
21 FS::Schema - Freeside database schema
25 use FS::Schema qw(dbdef dbdef_dist reload_dbdef);
27 $dbdef = reload_dbdef;
28 $dbdef = reload_dbdef "/non/standard/filename";
30 $dbdef_dist = dbdef_dist;
34 This class represents the database schema.
40 =item reload_dbdef([FILENAME])
42 Load a database definition (see L<DBIx::DBSchema>), optionally from a
43 non-default filename. This command is executed at startup unless
44 I<$FS::Schema::setup_hack> is true. Returns a DBIx::DBSchema object.
51 unless ( exists $dbdef_cache{$file} ) {
52 warn "[debug]$me loading dbdef for $file\n" if $DEBUG;
53 $dbdef_cache{$file} = DBIx::DBSchema->load( $file )
54 or die "can't load database schema from $file: $DBIx::DBSchema::errstr\n";
56 warn "[debug]$me re-using cached dbdef for $file\n" if $DEBUG;
58 $dbdef = $dbdef_cache{$file};
59 FS::Record::fk_methods_init();
64 Returns the current database definition (represents the current database,
65 assuming it is up-to-date). See L<DBIx::DBSchema>.
71 =item dbdef_dist [ DATASRC ]
73 Returns the current canoical database definition as defined in this file.
75 Optionally, pass a DBI data source to enable syntax specific to that database.
76 Currently, this enables "ENGINE=InnoDB" for MySQL databases.
81 my $datasrc = @_ && !ref($_[0]) ? shift : '';
82 my $opt = @_ ? shift : {};
84 my $local_options = '';
85 if ( $datasrc =~ /^dbi:mysql/i ) {
86 $local_options = 'ENGINE=InnoDB';
90 # create a dbdef object from the old data structure
93 my $tables_hashref = tables_hashref();
96 my $dbdef = new DBIx::DBSchema map {
102 while (@{$tables_hashref->{$tablename}{'columns'}}) {
103 #my($name, $type, $null, $length, $default, $local) =
105 splice @{$tables_hashref->{$tablename}{'columns'}}, 0, 6;
106 my %hash = map { $_ => shift @coldef }
107 qw( name type null length default local );
109 #can be removed once we depend on DBIx::DBSchema 0.39;
110 $hash{'type'} = 'LONGTEXT'
111 if $hash{'type'} =~ /^TEXT$/i && $datasrc =~ /^dbi:mysql/i;
113 unless ( defined $hash{'default'} ) {
114 warn "$tablename:\n".
115 join('', map "$_ => $hash{$_}\n", keys %hash) ;# $stop = <STDIN>;
118 push @columns, new DBIx::DBSchema::Column ( \%hash );
121 #false laziness w/sub indices in DBIx::DBSchema::DBD (well, sorta)
122 #and sub sql_create_table in DBIx::DBSchema::Table (slighty more?)
123 my $unique = $tables_hashref->{$tablename}{'unique'};
124 warn "missing index for $tablename\n" unless defined $tables_hashref->{$tablename}{'index'};
125 my @index = @{ $tables_hashref->{$tablename}{'index'} };
127 # kludge to avoid avoid "BLOB/TEXT column 'statustext' used in key
128 # specification without a key length".
129 # better solution: teach DBIx::DBSchema to specify a default length for
130 # MySQL indices on text columns, or just to support an index length at all
131 # so we can pass something in.
132 # best solution: eliminate need for this index in cust_main::retry_realtime
133 @index = grep { @{$_}[0] ne 'statustext' } @index
134 if $datasrc =~ /^dbi:mysql/i;
138 DBIx::DBSchema::Index->new({
139 'name' => $tablename. $indexnum++,
146 DBIx::DBSchema::Index->new({
147 'name' => $tablename. $indexnum++,
155 map DBIx::DBSchema::ForeignKey->new($_),
156 @{ $tables_hashref->{$tablename}{'foreign_keys'} || [] };
158 DBIx::DBSchema::Table->new({
160 primary_key => $tables_hashref->{$tablename}{'primary_key'},
161 columns => \@columns,
162 indices => \@indices,
163 foreign_keys => \@foreign_keys,
164 local_options => $local_options,
167 } keys %$tables_hashref;
170 warn "[debug]$me initial dbdef_dist created ($dbdef) with tables:\n";
171 warn "[debug]$me $_\n" foreach $dbdef->tables;
174 #add radius attributes to svc_acct
176 #my($svc_acct)=$dbdef->table('svc_acct');
179 #foreach $attribute (@attributes) {
180 # $svc_acct->addcolumn ( new DBIx::DBSchema::Column (
181 # 'radius_'. $attribute,
188 #foreach $attribute (@check_attributes) {
189 # $svc_acct->addcolumn( new DBIx::DBSchema::Column (
197 my $tables_hashref_torrus = tables_hashref_torrus();
199 #create history tables
201 grep { ! /^(clientapi|access_user)_session/
203 && ! /^log(_context)?$/
204 && ! /^(legacy_cust_history|cacti_page|template_image|access_user_log)$/
205 && ( ! /^queue(_arg|_depend|_stat)?$/ || ! $opt->{'queue-no_history'} )
206 && ! $tables_hashref_torrus->{$_}
210 my $tableobj = $dbdef->table($table)
211 or die "unknown table $table";
215 unless ( $table eq 'cust_event' || $table eq 'cdr' ) { #others?
217 my %indices = $tableobj->indices;
221 DBIx::DBSchema::Index->new({
222 'name' => 'h_'. $indices{$_}->name,
224 'columns' => [ @{$indices{$_}->columns} ],
230 $h_indices{"h_${table}_srckey"} =
231 DBIx::DBSchema::Index->new({
232 'name' => "h_${table}_srckey",
234 'columns' => [ 'history_action', #right?
235 $tableobj->primary_key,
239 $h_indices{"h_${table}_srckey2"} =
240 DBIx::DBSchema::Index->new({
241 'name' => "h_${table}_srckey2",
243 'columns' => [ 'history_date',
244 $tableobj->primary_key,
248 #necessary for queries that want to look at *who* made changes
249 $h_indices{"h_${table}_usernum"} =
250 DBIx::DBSchema::Index->new({
251 'name' => "h_${table}_usernum",
253 'columns' => [ 'history_usernum'],
256 # necessary because of the evil OR username for older data, be really nice if everything was just migrated to usernum and we could drop username
257 # This will not be helpful to mysql, but postgres smartly does a bitmap across both indexes, mysql will just use one
259 $h_indices{"h_${table}_user"} =
260 DBIx::DBSchema::Index->new({
261 'name' => "h_${table}_user",
263 'columns' => [ 'history_user'],
267 my $primary_key_col = $tableobj->column($tableobj->primary_key)
268 or die "$table: primary key declared as ". $tableobj->primary_key.
269 ", but no column of that name\n";
271 my $historynum_type = ( $tableobj->column($tableobj->primary_key)->type
272 =~ /^(bigserial|bigint|int8)$/i
277 my $h_tableobj = DBIx::DBSchema::Table->new( {
278 'name' => "h_$table",
279 'primary_key' => 'historynum',
280 'indices' => \%h_indices,
281 'local_options' => $local_options,
283 DBIx::DBSchema::Column->new( {
284 'name' => 'historynum',
285 'type' => $historynum_type,
286 'null' => 'NOT NULL',
291 DBIx::DBSchema::Column->new( {
292 'name' => 'history_date',
299 DBIx::DBSchema::Column->new( {
300 'name' => 'history_user',
307 DBIx::DBSchema::Column->new( {
308 'name' => 'history_usernum',
315 DBIx::DBSchema::Column->new( {
316 'name' => 'history_action',
318 'null' => 'NOT NULL',
324 my $column = $tableobj->column($_);
326 #clone so as to not disturb the original
327 $column = DBIx::DBSchema::Column->new( {
328 map { $_ => $column->$_() }
329 qw( name type null length default local )
332 if ( $column->type =~ /^(\w*)SERIAL$/i ) {
333 $column->type(uc($1).'INT');
334 $column->null('NULL');
336 #$column->default('')
337 # if $column->default =~ /^nextval\(/i;
338 #( my $local = $column->local ) =~ s/AUTO_INCREMENT//i;
339 #$column->local($local);
344 $dbdef->addtable($h_tableobj);
347 if ( $datasrc =~ /^dbi:mysql/i ) {
349 my $dup_lock_table = DBIx::DBSchema::Table->new( {
350 'name' => 'duplicate_lock',
351 'primary_key' => 'duplocknum',
352 'local_options' => $local_options,
354 DBIx::DBSchema::Column->new( {
355 'name' => 'duplocknum',
357 'null' => 'NOT NULL',
362 DBIx::DBSchema::Column->new( {
363 'name' => 'lockname',
365 'null' => 'NOT NULL',
371 'indices' => { 'duplicate_lock1' =>
372 DBIx::DBSchema::Index->new({
373 'name' => 'duplicate_lock1',
375 'columns' => [ 'lockname' ],
380 $dbdef->addtable($dup_lock_table);
388 #torrus tables http://torrus.org/reporting_setup.pod.html#create_sql_tables
389 sub tables_hashref_torrus {
393 # Collector export table. It usually grows at several megabytes
394 # per month, and is updated every 5 minutes
397 'id', 'serial', '', '', '', '',
398 'srv_date', 'date', '', '', '', '',#date and time of the data sample
399 'srv_time', 'time', '', '', '', '',
400 'serviceid', 'varchar', '', 64, '', '',#unique service ID per counter
401 'value', 'double precision', '', '', '', '',#collected rate or gauge value
402 'intvl', 'int', '', '', '', '', # collection interval - for counter volume calculation
404 'primary_key' => 'id',
406 'index' => [ ['srv_date'], ['srv_date', 'srv_time'], ['serviceid'], ],
409 #Tables for (currently monthly only) report contents.
410 #These are updated usually once per month, and read at the moment of
411 #rendering the report output (HTML now, PDF or XML or Excel or whatever
414 #DBIx::Sequence backend, theplatform-independent inplementation
416 'dbix_sequence_state' => {
418 'id', 'serial', '', '', '', '',
419 'dataset', 'varchar', '', 50, '', '',
420 'state_id', 'int', '', '', '', '',
422 'primary_key' => 'id',
423 #CONSTRAINT pk_dbix_sequence PRIMARY KEY (dataset, state_id)
424 'unique' => [ [ 'dataset', 'state_id' ], ],
428 'dbix_sequence_release' => {
430 'id', 'serial', '', '', '', '',
431 'dataset', 'varchar', '', 50, '', '',
432 'released_id', 'int', '', '', '', '',
434 'primary_key' => 'id',
435 #CONSTRAINT pk_dbi_release PRIMARY KEY (dataset, released_id)
436 'unique' => [ [ 'dataset', 'released_id', ] ],
440 #Each report is characterized by name, date and time.
441 #Monthly reports are automatically assigned 00:00 of the 1st day
442 #in the month. The report contains fields for every service ID
443 #defined across all datasource trees.
446 'id', 'serial', '', '', '', '',
447 'rep_date', 'date', '', '', '', '',#Start date of the report
448 'rep_time', 'time', '', '', '', '',#Start time of the report
449 'reportname', 'varchar', '', 64, '', '',#Report name, such as
451 'iscomplete', 'int', '', '', '', '',#0 when the report is in
452 # progress, 1 when it is ready
454 'primary_key' => 'id',
455 'unique' => [ [ qw(rep_date rep_time reportname) ] ],
456 'index' => [ [ 'rep_date' ] ],
459 #Each report contains fields. For each service ID,
460 #the report may contain several fields for various statistics.
461 #Each field contains information about the units of the value it
465 'id', 'serial', '', '', '', '',
466 'rep_id', 'int', 'NULL', '', '', '',
467 'name', 'varchar', '', 64, '', '',#name of the field,
469 'serviceid', 'varchar', '', 64, '', '',#service ID
470 'value', 'double precision', '', '', '', '',#Numeric value
471 'units', 'varchar', '', 64, \"''", '',#Units, such as bytes
474 'primary_key', => 'id',
475 'unique' => [ [ qw(rep_id name serviceid) ] ],
485 my $char_d = 80; #default maxlength for text fields
487 #my(@date_type) = ( 'timestamp', '', '' );
488 my @date_type = ( 'int', 'NULL', '' );
489 my @perl_type = ( 'text', 'NULL', '' );
490 my @money_type = ( 'decimal', '', '10,2' );
491 my @money_typen = ( 'decimal', 'NULL', '10,2' );
492 my @taxrate_type = ( 'decimal', '', '14,8' ); # requires pg 8 for
493 my @taxrate_typen = ( 'decimal', 'NULL', '14,8' ); # fs-upgrade to work
495 my $username_len = 64; #usernamemax config file
497 # name type nullability length default local
503 'agentnum', 'serial', '', '', '', '',
504 'agent', 'varchar', '', $char_d, '', '',
505 'typenum', 'int', '', '', '', '',
506 'ticketing_queueid', 'int', 'NULL', '', '', '',
507 'invoice_template', 'varchar', 'NULL', $char_d, '', '',
508 'agent_custnum', 'int', 'NULL', '', '', '',
509 'disabled', 'char', 'NULL', 1, '', '',
510 'username', 'varchar', 'NULL', $char_d, '', '',
511 '_password', 'varchar', 'NULL', $char_d, '', '',
512 'freq', 'int', 'NULL', '', '', '', #deprecated (never used)
513 'prog', @perl_type, '', '', #deprecated (never used)
515 'primary_key' => 'agentnum',
516 #'unique' => [ [ 'agent_custnum' ] ], #one agent per customer?
517 #insert is giving it a value, tho..
518 #'index' => [ ['typenum'], ['disabled'] ],
520 'index' => [ ['typenum'], ['disabled'], ['agent_custnum'] ],
522 { columns => [ 'typenum' ],
523 table => 'agent_type',
525 # 1. RT tables aren't part of our data structure, so
526 # we can't make sure Queue is created already
527 # 2. Future ability to plug in other ticketing systems
528 #{ columns => [ 'ticketing_queueid' ],
530 # references => [ 'id' ],
532 { columns => [ 'agent_custnum' ],
533 table => 'cust_main',
534 references => [ 'custnum' ],
539 'agent_pkg_class' => {
541 'agentpkgclassnum', 'serial', '', '', '', '',
542 'agentnum', 'int', '', '', '', '',
543 'classnum', 'int', 'NULL', '', '', '',
544 'commission_percent', 'decimal', '', '7,4', '', '',
546 'primary_key' => 'agentpkgclassnum',
547 'unique' => [ [ 'agentnum', 'classnum' ], ],
550 { columns => [ 'agentnum' ],
553 { columns => [ 'classnum' ],
554 table => 'pkg_class',
561 'typenum', 'serial', '', '', '', '',
562 'atype', 'varchar', '', $char_d, '', '',
563 'disabled', 'char', 'NULL', 1, '', '',
565 'primary_key' => 'typenum',
567 'index' => [ ['disabled'] ],
572 'typepkgnum', 'serial', '', '', '', '',
573 'typenum', 'int', '', '', '', '',
574 'pkgpart', 'int', '', '', '', '',
576 'primary_key' => 'typepkgnum',
577 'unique' => [ ['typenum', 'pkgpart'] ],
578 'index' => [ ['typenum'] ],
580 { columns => [ 'typenum' ],
581 table => 'agent_type',
583 { columns => [ 'pkgpart' ],
589 'agent_currency' => {
591 'agentcurrencynum', 'serial', '', '', '', '',
592 'agentnum', 'int', '', '', '', '',
593 'currency', 'char', '', 3, '', '',
595 'primary_key' => 'agentcurrencynum',
597 'index' => [ ['agentnum'] ],
599 { columns => [ 'agentnum' ],
607 'salesnum', 'serial', '', '', '', '',
608 'salesperson', 'varchar', '', $char_d, '', '',
609 'agentnum', 'int', 'NULL', '', '', '',
610 'sales_custnum', 'int', 'NULL', '', '', '',
611 'disabled', 'char', 'NULL', 1, '', '',
613 'primary_key' => 'salesnum',
615 'index' => [ ['salesnum'], ['disabled'] ],
617 { columns => [ 'agentnum' ],
620 { columns => [ 'sales_custnum' ],
621 table => 'cust_main',
622 references => [ 'custnum' ],
627 'sales_pkg_class' => {
629 'salespkgclassnum', 'serial', '', '', '', '',
630 'salesnum', 'int', '', '', '', '',
631 'classnum', 'int', 'NULL', '', '', '',
632 'commission_percent', 'decimal', '', '7,4', '', '',
633 'commission_duration', 'int', 'NULL', '', '', '',
635 'primary_key' => 'salespkgclassnum',
636 'unique' => [ [ 'salesnum', 'classnum' ], ],
639 { columns => [ 'salesnum' ],
642 { columns => [ 'classnum' ],
643 table => 'pkg_class',
648 'cust_attachment' => {
650 'attachnum', 'serial', '', '', '', '',
651 'custnum', 'int', '', '', '', '',
652 '_date', @date_type, '', '',
653 'otaker', 'varchar', 'NULL', 32, '', '',
654 'usernum', 'int', 'NULL', '', '', '',
655 'filename', 'varchar', '', 255, '', '',
656 'mime_type', 'varchar', '', $char_d, '', '',
657 'title', 'varchar', 'NULL', $char_d, '', '',
658 'body', 'blob', 'NULL', '', '', '',
659 'disabled', @date_type, '', '',
661 'primary_key' => 'attachnum',
663 'index' => [ ['custnum'], ['usernum'], ],
665 { columns => [ 'custnum' ],
666 table => 'cust_main',
668 { columns => [ 'usernum' ],
669 table => 'access_user',
677 'invnum', 'serial', '', '', '', '',
678 'custnum', 'int', '', '', '', '',
679 '_date', @date_type, '', '',
680 'charged', @money_type, '', '',
681 'currency', 'char', 'NULL', 3, '', '',
682 'invoice_terms', 'varchar', 'NULL', $char_d, '', '',
684 #customer balance info at invoice generation time
686 'previous_balance', @money_typen, '', '', #eventually not nullable
687 'billing_balance', @money_typen, '', '', #eventually not nullable
689 #deprecated (unused by now, right?)
690 'printed', 'int', '', '', '', '',
693 'closed', 'char', 'NULL', 1, '', '', #not yet used much
694 'statementnum', 'int', 'NULL', '', '', '', #invoice aggregate statements
695 'agent_invid', 'int', 'NULL', '', '', '', #(varchar?) importing legacy
696 'promised_date', @date_type, '', '',
697 'taxengine_request', 'text', 'NULL', '', '', '',
699 'pending', 'char', 'NULL', 1, '', '',
701 'primary_key' => 'invnum',
702 'unique' => [ [ 'custnum', 'agent_invid' ] ], #agentnum? huh
703 'index' => [ ['custnum'], ['_date'], ['statementnum'],
707 { columns => [ 'custnum' ],
708 table => 'cust_main',
710 { columns => [ 'statementnum' ],
711 table => 'cust_statement',
716 'cust_bill_void' => {
719 'invnum', 'int', '', '', '', '',
720 'custnum', 'int', '', '', '', '',
721 '_date', @date_type, '', '',
722 'charged', @money_type, '', '',
723 'currency', 'char', 'NULL', 3, '', '',
724 'invoice_terms', 'varchar', 'NULL', $char_d, '', '',
726 #customer balance info at invoice generation time
727 'previous_balance', @money_typen, '', '', #eventually not nullable
728 'billing_balance', @money_typen, '', '', #eventually not nullable
731 'closed', 'char', 'NULL', 1, '', '', #not yet used much
732 'statementnum', 'int', 'NULL', '', '', '', #invoice aggregate statements
733 'agent_invid', 'int', 'NULL', '', '', '', #(varchar?) importing legacy
734 'promised_date', @date_type, '', '',
735 'taxengine_request', 'text', 'NULL', '', '', '',
738 'void_date', @date_type, '', '',
739 'reason', 'varchar', 'NULL', $char_d, '', '',
740 'reasonnum', 'int', 'NULL', '', '', '',
741 'void_usernum', 'int', 'NULL', '', '', '',
743 'primary_key' => 'invnum',
744 'unique' => [ [ 'custnum', 'agent_invid' ] ], #agentnum? huh
745 'index' => [ ['custnum'], ['_date'], ['statementnum'],
746 ['agent_invid'], [ 'void_usernum' ],
749 { columns => [ 'custnum' ],
750 table => 'cust_main',
752 { columns => [ 'statementnum' ],
753 table => 'cust_statement', #_void? both?
755 { columns => [ 'reasonnum' ],
758 { columns => [ 'void_usernum' ],
759 table => 'access_user',
760 references => [ 'usernum' ],
765 #for importing invoices from a legacy system for display purposes only
766 # no effect upon balance
767 'legacy_cust_bill' => {
769 'legacyinvnum', 'serial', '', '', '', '',
770 'legacyid', 'varchar', 'NULL', $char_d, '', '',
771 'custnum', 'int', '', '', '', '',
772 '_date', @date_type, '', '',
773 'charged', @money_type, '', '',
774 'currency', 'char', 'NULL', 3, '', '',
775 'content_pdf', 'blob', 'NULL', '', '', '',
776 'content_html', 'text', 'NULL', '', '', '',
777 'locale', 'varchar', 'NULL', 16, '', '',
779 'primary_key' => 'legacyinvnum',
781 'index' => [ ['legacyid', 'custnum', 'locale' ], ],
783 { columns => [ 'custnum' ],
784 table => 'cust_main',
789 'legacy_cust_history' => {
791 'legacyhistorynum', 'serial', '', '', '', '',
792 'custnum', 'int', '', '', '', '',
793 'history_action', 'varchar', '', $char_d, '', '',
794 'history_date', @date_type, '', '',
795 'history_usernum', 'int', 'NULL', '', '', '',
796 'item', 'varchar', 'NULL', $char_d, '', '',
797 'description', 'varchar', 'NULL', 2*$char_d, '', '',
798 'change_data', 'text', 'NULL', '', '', '',
800 'primary_key' => 'legacyhistorynum',
802 'index' => [ ['custnum'], ['history_date'], ],
804 { columns => [ 'custnum' ],
805 table => 'cust_main',
807 { columns => [ 'history_usernum' ],
808 table => 'access_user',
809 references => [ 'usernum' ],
814 'cust_statement' => {
816 'statementnum', 'serial', '', '', '', '',
817 'custnum', 'int', '', '', '', '',
818 '_date', @date_type, '', '',
820 'primary_key' => 'statementnum',
822 'index' => [ ['custnum'], ['_date'], ],
824 { columns => [ 'custnum' ],
825 table => 'cust_main',
832 'eventpart', 'serial', '', '', '', '',
833 'agentnum', 'int', 'NULL', '', '', '',
834 'event', 'varchar', '', $char_d, '', '',
835 'eventtable', 'varchar', '', $char_d, '', '',
836 'check_freq', 'varchar', 'NULL', $char_d, '', '',
837 'weight', 'int', '', '', '', '',
838 'action', 'varchar', '', $char_d, '', '',
839 'disabled', 'char', 'NULL', 1, '', '',
841 'primary_key' => 'eventpart',
843 'index' => [ ['agentnum'], ['eventtable'], ['check_freq'],
847 { columns => [ 'agentnum' ],
853 'part_event_option' => {
855 'optionnum', 'serial', '', '', '', '',
856 'eventpart', 'int', '', '', '', '',
857 'optionname', 'varchar', '', $char_d, '', '',
858 'optionvalue', 'text', 'NULL', '', '', '',
860 'primary_key' => 'optionnum',
862 'index' => [ [ 'eventpart' ], [ 'optionname' ] ],
864 { columns => [ 'eventpart' ],
865 table => 'part_event',
870 'part_event_condition' => {
872 'eventconditionnum', 'serial', '', '', '', '',
873 'eventpart', 'int', '', '', '', '',
874 'conditionname', 'varchar', '', $char_d, '', '',
876 'primary_key' => 'eventconditionnum',
878 'index' => [ [ 'eventpart' ], [ 'conditionname' ] ],
880 { columns => [ 'eventpart' ],
881 table => 'part_event',
886 'part_event_condition_option' => {
888 'optionnum', 'serial', '', '', '', '',
889 'eventconditionnum', 'int', '', '', '', '',
890 'optionname', 'varchar', '', $char_d, '', '',
891 'optionvalue', 'text', 'NULL', '', '', '',
893 'primary_key' => 'optionnum',
895 'index' => [ [ 'eventconditionnum' ], [ 'optionname' ] ],
897 { columns => [ 'eventconditionnum' ],
898 table => 'part_event_condition',
903 'part_event_condition_option_option' => {
905 'optionoptionnum', 'serial', '', '', '', '',
906 'optionnum', 'int', '', '', '', '',
907 'optionname', 'varchar', '', $char_d, '', '',
908 'optionvalue', 'text', 'NULL', '', '', '',
910 'primary_key' => 'optionoptionnum',
912 'index' => [ [ 'optionnum' ], [ 'optionname' ] ],
914 { columns => [ 'optionnum' ],
915 table => 'part_event_condition_option',
922 'eventnum', 'serial', '', '', '', '',
923 'eventpart', 'int', '', '', '', '',
924 'tablenum', 'int', '', '', '', '',
925 '_date', @date_type, '', '',
926 'status', 'varchar', '', $char_d, '', '',
927 'statustext', 'text', 'NULL', '', '', '',
928 'no_action', 'char', 'NULL', 1, '', '',
930 'primary_key' => 'eventnum',
931 #no... there are retries now #'unique' => [ [ 'eventpart', 'invnum' ] ],
933 'index' => [ ['eventpart'], ['tablenum'], ['status'],
934 ['statustext'], ['_date'], ['no_action'],
937 { columns => [ 'eventpart' ],
938 table => 'part_event',
943 'cust_event_fee' => {
945 'eventfeenum', 'serial', '', '', '', '',
946 'eventnum', 'int', '', '', '', '',
947 'billpkgnum', 'int', 'NULL', '', '', '',
948 'feepart', 'int', '', '', '', '',
949 'nextbill', 'char', 'NULL', 1, '', '',
951 'primary_key' => 'eventfeenum', # I'd rather just use eventnum
952 'unique' => [ [ 'billpkgnum' ], [ 'eventnum' ] ], # one-to-one link
953 'index' => [ [ 'feepart' ] ],
955 { columns => [ 'eventnum' ],
956 table => 'cust_event',
958 #{ columns => [ 'billpkgnum' ],
959 # table => 'cust_bill_pkg',
961 { columns => [ 'feepart' ],
969 'billpkgnum', 'serial', '', '', '', '',
970 'invnum', 'int', '', '', '', '',
971 'pkgnum', 'int', '', '', '', '',
972 'pkgpart_override', 'int', 'NULL', '', '', '',
973 'setup', @money_type, '', '',
974 'unitsetup', @money_typen, '', '',
975 'setup_billed_currency', 'char', 'NULL', 3, '', '',
976 'setup_billed_amount', @money_typen, '', '',
977 'recur', @money_type, '', '',
978 'unitrecur', @money_typen, '', '',
979 'recur_billed_currency', 'char', 'NULL', 3, '', '',
980 'recur_billed_amount', @money_typen, '', '',
981 'sdate', @date_type, '', '',
982 'edate', @date_type, '', '',
983 'itemdesc', 'varchar', 'NULL', $char_d, '', '',
984 'itemcomment', 'varchar', 'NULL', $char_d, '', '',
985 'section', 'varchar', 'NULL', $char_d, '', '',
986 'freq', 'varchar', 'NULL', $char_d, '', '',
987 'quantity', 'int', 'NULL', '', '', '',
988 'hidden', 'char', 'NULL', 1, '', '',
989 'feepart', 'int', 'NULL', '', '', '',
991 'primary_key' => 'billpkgnum',
993 'index' => [ ['invnum'], [ 'pkgnum' ], [ 'itemdesc' ], ],
995 { columns => [ 'invnum' ],
996 table => 'cust_bill',
998 #pkgnum 0 and -1 are used for special things
999 #{ columns => [ 'pkgnum' ],
1000 # table => 'cust_pkg',
1002 { columns => [ 'pkgpart_override' ],
1003 table => 'part_pkg',
1004 references => [ 'pkgpart' ],
1006 { columns => [ 'feepart' ],
1007 table => 'part_fee',
1012 'cust_bill_pkg_detail' => {
1014 'detailnum', 'serial', '', '', '', '',
1015 # bigserial? this table will eventually be as big as cdr...
1016 'billpkgnum', 'int', 'NULL', '', '', '', # should not be nullable
1017 'pkgnum', 'int', 'NULL', '', '', '', # deprecated
1018 'invnum', 'int', 'NULL', '', '', '', # deprecated
1019 'amount', 'decimal', 'NULL', '10,4', '', '',
1020 'format', 'char', 'NULL', 1, '', '',
1021 'classnum', 'int', 'NULL', '', '', '',
1022 'duration', 'int', 'NULL', '', 0, '',
1023 'phonenum', 'varchar', 'NULL', 255, '', '', # has to hold a service label
1024 'accountcode', 'varchar', 'NULL', 32, '', '',
1025 'startdate', @date_type, '', '',
1026 'regionname', 'varchar', 'NULL', $char_d, '', '',
1027 'detail', 'varchar', '', 255, '', '',
1029 'primary_key' => 'detailnum',
1031 'index' => [ [ 'billpkgnum' ], [ 'classnum' ],
1032 [ 'pkgnum', 'invnum' ],
1035 { columns => [ 'billpkgnum' ],
1036 table => 'cust_bill_pkg',
1038 #{ columns => [ 'pkgnum' ],
1039 # table => 'cust_pkg',
1041 #{ columns => [ 'invnum' ],
1042 # table => 'cust_bill',
1044 { columns => [ 'classnum' ],
1045 table => 'usage_class',
1050 'cust_bill_pkg_display' => {
1052 'billpkgdisplaynum', 'serial', '', '', '', '',
1053 'billpkgnum', 'int', '', '', '', '',
1054 'section', 'varchar', 'NULL', $char_d, '', '',
1055 #'unitsetup', @money_typen, '', '', #override the linked real one?
1056 #'unitrecur', @money_typen, '', '', #this too?
1057 'post_total', 'char', 'NULL', 1, '', '',
1058 'type', 'char', 'NULL', 1, '', '',
1059 'summary', 'char', 'NULL', 1, '', '',
1061 'primary_key' => 'billpkgdisplaynum',
1063 'index' => [ ['billpkgnum'], ],
1065 { columns => [ 'billpkgnum' ],
1066 table => 'cust_bill_pkg',
1071 'cust_bill_pkg_fee' => {
1073 'billpkgfeenum', 'serial', '', '', '', '',
1074 'billpkgnum', 'int', '', '', '', '',
1075 'base_invnum', 'int', '', '', '', '',
1076 'base_billpkgnum', 'int', 'NULL', '', '', '',
1077 'amount', @money_type, '', '',
1079 'primary_key' => 'billpkgfeenum',
1081 'index' => [ ['billpkgnum'],
1083 ['base_billpkgnum'],
1086 { columns => [ 'billpkgnum' ],
1087 table => 'cust_bill_pkg',
1092 'cust_bill_pkg_fee_void' => {
1094 'billpkgfeenum', 'serial', '', '', '', '',
1095 'billpkgnum', 'int', '', '', '', '',
1096 'base_invnum', 'int', '', '', '', '',
1097 'base_billpkgnum', 'int', 'NULL', '', '', '',
1098 'amount', @money_type, '', '',
1100 'primary_key' => 'billpkgfeenum',
1102 'index' => [ ['billpkgnum'],
1104 ['base_billpkgnum'],
1107 { columns => [ 'billpkgnum' ],
1108 table => 'cust_bill_pkg_void',
1114 'cust_bill_pkg_tax_location' => {
1116 'billpkgtaxlocationnum', 'serial', '', '', '', '',
1117 'billpkgnum', 'int', '', '', '', '',
1118 'taxnum', 'int', '', '', '', '',
1119 'taxtype', 'varchar', '', $char_d, '', '',
1120 'pkgnum', 'int', '', '', '', '', #redundant
1121 'locationnum', 'int', '', '', '', '', #redundant
1122 'amount', @money_type, '', '',
1123 'currency', 'char', 'NULL', 3, '', '',
1124 'taxable_billpkgnum', 'int', 'NULL', '', '', '',
1126 'primary_key' => 'billpkgtaxlocationnum',
1128 'index' => [ [ 'billpkgnum' ],
1132 [ 'taxable_billpkgnum' ],
1135 { columns => [ 'billpkgnum' ],
1136 table => 'cust_bill_pkg',
1138 #{ columns => [ 'pkgnum' ],
1139 # table => 'cust_pkg',
1140 #}, # taxes can apply to fees
1141 { columns => [ 'locationnum' ],
1142 table => 'cust_location',
1144 #{ columns => [ 'taxable_billpkgnum' ],
1145 # table => 'cust_bill_pkg',
1146 # references => [ 'billpkgnum' ],
1151 'cust_bill_pkg_tax_rate_location' => {
1153 'billpkgtaxratelocationnum', 'serial', '', '', '', '',
1154 'billpkgnum', 'int', '', '', '', '',
1155 'taxnum', 'int', '', '', '', '',
1156 'taxtype', 'varchar', '', $char_d, '', '',
1157 'locationtaxid', 'varchar', 'NULL', $char_d, '', '',
1158 'taxratelocationnum', 'int', '', '', '', '',
1159 'amount', @money_type, '', '',
1160 'currency', 'char', 'NULL', 3, '', '',
1161 'taxable_billpkgnum', 'int', 'NULL', '', '', '',
1162 'taxclass', 'varchar', 'NULL', 10, '', '',
1164 'primary_key' => 'billpkgtaxratelocationnum',
1166 'index' => [ ['billpkgnum'], ['taxnum'], ['taxratelocationnum'],
1167 ['taxable_billpkgnum'],
1170 { columns => [ 'billpkgnum' ],
1171 table => 'cust_bill_pkg',
1173 { columns => [ 'taxratelocationnum' ],
1174 table => 'tax_rate_location',
1176 #{ columns => [ 'taxable_billpkgnum' ],
1177 # table => 'cust_bill_pkg',
1178 # references => [ 'billpkgnum' ],
1183 'cust_bill_pkg_void' => {
1185 'billpkgnum', 'int', '', '', '', '',
1186 'invnum', 'int', '', '', '', '',
1187 'pkgnum', 'int', '', '', '', '',
1188 'pkgpart_override', 'int', 'NULL', '', '', '',
1189 'setup', @money_type, '', '',
1190 'recur', @money_type, '', '',
1191 #XXX a currency for a line item? or just one for the entire invoice
1192 #'currency', 'char', 'NULL', 3, '', '',
1193 'sdate', @date_type, '', '',
1194 'edate', @date_type, '', '',
1195 'itemdesc', 'varchar', 'NULL', $char_d, '', '',
1196 'itemcomment', 'varchar', 'NULL', $char_d, '', '',
1197 'section', 'varchar', 'NULL', $char_d, '', '',
1198 'freq', 'varchar', 'NULL', $char_d, '', '',
1199 'quantity', 'int', 'NULL', '', '', '',
1200 'unitsetup', @money_typen, '', '',
1201 'unitrecur', @money_typen, '', '',
1202 'hidden', 'char', 'NULL', 1, '', '',
1203 'feepart', 'int', 'NULL', '', '', '',
1205 'void_date', @date_type, '', '',
1206 'reason', 'varchar', 'NULL', $char_d, '', '',
1207 'reasonnum', 'int', 'NULL', '', '', '',
1208 'void_usernum', 'int', 'NULL', '', '', '',
1210 'primary_key' => 'billpkgnum',
1212 'index' => [ ['invnum'], ['pkgnum'], ['itemdesc'],
1216 { columns => [ 'invnum' ],
1217 table => 'cust_bill_void',
1219 { columns => [ 'reasonnum' ],
1222 #pkgnum 0 and -1 are used for special things
1223 #{ columns => [ 'pkgnum' ],
1224 # table => 'cust_pkg',
1226 { columns => [ 'pkgpart_override' ],
1227 table => 'part_pkg',
1228 references => [ 'pkgpart' ],
1230 { columns => [ 'void_usernum' ],
1231 table => 'access_user',
1232 references => [ 'usernum' ],
1237 'cust_bill_pkg_detail_void' => {
1239 'detailnum', 'int', '', '', '', '',
1240 'billpkgnum', 'int', 'NULL', '', '', '', # should not be nullable
1241 'pkgnum', 'int', 'NULL', '', '', '', # deprecated
1242 'invnum', 'int', 'NULL', '', '', '', # deprecated
1243 'amount', 'decimal', 'NULL', '10,4', '', '',
1244 'format', 'char', 'NULL', 1, '', '',
1245 'classnum', 'int', 'NULL', '', '', '',
1246 'duration', 'int', 'NULL', '', 0, '',
1247 'phonenum', 'varchar', 'NULL', 255, '', '',
1248 'accountcode', 'varchar', 'NULL', 32, '', '',
1249 'startdate', @date_type, '', '',
1250 'regionname', 'varchar', 'NULL', $char_d, '', '',
1251 'detail', 'varchar', '', 255, '', '',
1253 'primary_key' => 'detailnum',
1255 'index' => [ ['billpkgnum'], ['classnum'], ['pkgnum', 'invnum'] ],
1257 { columns => [ 'billpkgnum' ],
1258 table => 'cust_bill_pkg_void',
1260 #{ columns => [ 'pkgnum' ],
1261 # table => 'cust_pkg',
1263 #{ columns => [ 'invnum' ],
1264 # table => 'cust_bill',
1266 { columns => [ 'classnum' ],
1267 table => 'usage_class',
1272 'cust_bill_pkg_display_void' => {
1274 'billpkgdisplaynum', 'int', '', '', '', '',
1275 'billpkgnum', 'int', '', '', '', '',
1276 'section', 'varchar', 'NULL', $char_d, '', '',
1277 #'unitsetup', @money_typen, '', '', #override the linked real one?
1278 #'unitrecur', @money_typen, '', '', #this too?
1279 'post_total', 'char', 'NULL', 1, '', '',
1280 'type', 'char', 'NULL', 1, '', '',
1281 'summary', 'char', 'NULL', 1, '', '',
1283 'primary_key' => 'billpkgdisplaynum',
1285 'index' => [ ['billpkgnum'], ],
1287 { columns => [ 'billpkgnum' ],
1288 table => 'cust_bill_pkg_void',
1293 'cust_bill_pkg_tax_location_void' => {
1295 'billpkgtaxlocationnum', 'int', '', '', '', '',
1296 'billpkgnum', 'int', '', '', '', '',
1297 'taxnum', 'int', '', '', '', '',
1298 'taxtype', 'varchar', '', $char_d, '', '',
1299 'pkgnum', 'int', '', '', '', '',
1300 'locationnum', 'int', '', '', '', '', #redundant?
1301 'amount', @money_type, '', '',
1302 'currency', 'char', 'NULL', 3, '', '',
1303 'taxable_billpkgnum', 'int', 'NULL', '', '', '',
1305 'primary_key' => 'billpkgtaxlocationnum',
1307 'index' => [ ['billpkgnum'], ['taxnum'], ['pkgnum'],
1311 { columns => [ 'billpkgnum' ],
1312 table => 'cust_bill_pkg_void',
1314 { columns => [ 'locationnum' ],
1315 table => 'cust_location',
1317 #{ columns => [ 'taxable_billpkgnum' ],
1318 # table => 'cust_bill_pkg_void',
1319 # references => [ 'billpkgnum' ],
1324 'cust_bill_pkg_tax_rate_location_void' => {
1326 'billpkgtaxratelocationnum', 'int', '', '', '', '',
1327 'billpkgnum', 'int', '', '', '', '',
1328 'taxnum', 'int', '', '', '', '',
1329 'taxtype', 'varchar', '', $char_d, '', '',
1330 'locationtaxid', 'varchar', 'NULL', $char_d, '', '',
1331 'taxratelocationnum', 'int', '', '', '', '',
1332 'amount', @money_type, '', '',
1333 'currency', 'char', 'NULL', 3, '', '',
1335 'primary_key' => 'billpkgtaxratelocationnum',
1337 'index' => [ ['billpkgnum'], ['taxnum'], ['taxratelocationnum'] ],
1339 { columns => [ 'billpkgnum' ],
1340 table => 'cust_bill_pkg_void',
1342 { columns => [ 'taxratelocationnum' ],
1343 table => 'tax_rate_location',
1350 'crednum', 'serial', '', '', '', '',
1351 'custnum', 'int', '', '', '', '',
1352 '_date', @date_type, '', '',
1353 'amount',@money_type, '', '',
1354 'currency', 'char', 'NULL', 3, '', '',
1355 'otaker', 'varchar', 'NULL', 32, '', '',
1356 'usernum', 'int', 'NULL', '', '', '',
1357 'reason', 'text', 'NULL', '', '', '',
1358 'reasonnum', 'int', 'NULL', '', '', '',
1359 'addlinfo', 'text', 'NULL', '', '', '',
1360 'closed', 'char', 'NULL', 1, '', '',
1361 'pkgnum', 'int', 'NULL', '', '','',#desired pkgnum for pkg-balances
1362 'eventnum', 'int', 'NULL', '', '','',#triggering event for commission
1363 'commission_agentnum', 'int', 'NULL', '', '', '', #
1364 'commission_salesnum', 'int', 'NULL', '', '', '', #
1365 'commission_pkgnum', 'int', 'NULL', '', '', '', #
1366 'credbatch', 'varchar', 'NULL', $char_d, '', '',
1368 'primary_key' => 'crednum',
1370 'index' => [ ['custnum'], ['_date'], ['usernum'], ['eventnum'],
1371 ['commission_salesnum'], ['credbatch'],
1374 { columns => [ 'custnum' ],
1375 table => 'cust_main',
1377 { columns => [ 'usernum' ],
1378 table => 'access_user',
1380 { columns => [ 'reasonnum' ],
1383 { columns => [ 'pkgnum' ],
1384 table => 'cust_pkg',
1386 { columns => [ 'eventnum' ],
1387 table => 'cust_event',
1389 { columns => [ 'commission_agentnum' ],
1391 references => [ 'agentnum' ],
1393 { columns => [ 'commission_salesnum' ],
1395 references => [ 'salesnum' ],
1397 { columns => [ 'commission_pkgnum' ],
1398 table => 'cust_pkg',
1399 references => [ 'pkgnum' ],
1404 'cust_credit_void' => {
1406 'crednum', 'serial', '', '', '', '',
1407 'custnum', 'int', '', '', '', '',
1408 '_date', @date_type, '', '',
1409 'amount',@money_type, '', '',
1410 'currency', 'char', 'NULL', 3, '', '',
1411 'otaker', 'varchar', 'NULL', 32, '', '',
1412 'usernum', 'int', 'NULL', '', '', '',
1413 'reason', 'text', 'NULL', '', '', '',
1414 'reasonnum', 'int', 'NULL', '', '', '',
1415 'addlinfo', 'text', 'NULL', '', '', '',
1416 'closed', 'char', 'NULL', 1, '', '',
1417 'pkgnum', 'int', 'NULL', '', '','',
1418 'eventnum', 'int', 'NULL', '', '','',
1419 'commission_agentnum', 'int', 'NULL', '', '', '',
1420 'commission_salesnum', 'int', 'NULL', '', '', '',
1421 'commission_pkgnum', 'int', 'NULL', '', '', '',
1423 'void_date', @date_type, '', '',
1424 'void_reason', 'varchar', 'NULL', $char_d, '', '',
1425 'void_reasonnum', 'int', 'NULL', '', '', '',
1426 'void_usernum', 'int', 'NULL', '', '', '',
1428 'primary_key' => 'crednum',
1430 'index' => [ ['custnum'], ['_date'], ['usernum'], ['eventnum'],
1431 ['commission_salesnum'],
1434 { columns => [ 'custnum' ],
1435 table => 'cust_main',
1437 { columns => [ 'usernum' ],
1438 table => 'access_user',
1440 { columns => [ 'reasonnum' ],
1443 { columns => [ 'pkgnum' ],
1444 table => 'cust_pkg',
1446 { columns => [ 'eventnum' ],
1447 table => 'cust_event',
1449 { columns => [ 'commission_agentnum' ],
1451 references => [ 'agentnum' ],
1453 { columns => [ 'commission_salesnum' ],
1455 references => [ 'salesnum' ],
1457 { columns => [ 'commission_pkgnum' ],
1458 table => 'cust_pkg',
1459 references => [ 'pkgnum' ],
1461 { columns => [ 'void_reasonnum' ],
1463 references => [ 'reasonnum' ],
1465 { columns => [ 'void_usernum' ],
1466 table => 'access_user',
1467 references => [ 'usernum' ],
1473 'cust_credit_bill' => {
1475 'creditbillnum', 'serial', '', '', '', '',
1476 'crednum', 'int', '', '', '', '',
1477 'invnum', 'int', '', '', '', '',
1478 '_date', @date_type, '', '',
1479 'amount', @money_type, '', '',
1480 'pkgnum', 'int', 'NULL', '', '', '', #desired pkgnum for pkg-balances
1482 'primary_key' => 'creditbillnum',
1484 'index' => [ ['crednum'], ['invnum'] ],
1486 { columns => [ 'crednum' ],
1487 table => 'cust_credit',
1489 { columns => [ 'invnum' ],
1490 table => 'cust_bill',
1492 { columns => [ 'pkgnum' ],
1493 table => 'cust_pkg',
1498 'cust_credit_bill_pkg' => {
1500 'creditbillpkgnum', 'serial', '', '', '', '',
1501 'creditbillnum', 'int', '', '', '', '',
1502 'billpkgnum', 'int', '', '', '', '',
1503 'billpkgtaxlocationnum', 'int', 'NULL', '', '', '',
1504 'billpkgtaxratelocationnum', 'int', 'NULL', '', '', '',
1505 'amount', @money_type, '', '',
1506 'setuprecur', 'varchar', '', $char_d, '', '',
1507 'sdate', @date_type, '', '',
1508 'edate', @date_type, '', '',
1510 'primary_key' => 'creditbillpkgnum',
1512 'index' => [ [ 'creditbillnum' ],
1514 [ 'billpkgtaxlocationnum' ],
1515 [ 'billpkgtaxratelocationnum' ],
1518 { columns => [ 'creditbillnum' ],
1519 table => 'cust_credit_bill',
1521 { columns => [ 'billpkgnum' ],
1522 table => 'cust_bill_pkg',
1524 { columns => [ 'billpkgtaxlocationnum' ],
1525 table => 'cust_bill_pkg_tax_location',
1527 { columns => [ 'billpkgtaxratelocationnum' ],
1528 table => 'cust_bill_pkg_tax_rate_location',
1533 'cust_credit_source_bill_pkg' => {
1535 'creditsourcebillpkgnum', 'serial', '', '', '', '',
1536 'crednum', 'int', '', '', '', '',
1537 'billpkgnum', 'int', '', '', '', '',
1538 'amount', @money_type, '', '',
1539 'currency', 'char', 'NULL', 3, '', '',
1541 'primary_key' => 'creditsourcebillpkgnum',
1543 'index' => [ ['crednum'], ['billpkgnum'] ],
1545 { columns => ['billpkgnum'],
1546 table => 'cust_bill_pkg',
1548 { columns => ['crednum'],
1549 table => 'cust_credit',
1556 'custnum', 'serial', '', '', '', '',
1557 'agentnum', 'int', '', '', '', '',
1558 'salesnum', 'int', 'NULL', '', '', '',
1559 'agent_custid', 'varchar', 'NULL', $char_d, '', '',
1560 'classnum', 'int', 'NULL', '', '', '',
1561 'custbatch', 'varchar', 'NULL', $char_d, '', '',
1562 # 'titlenum', 'int', 'NULL', '', '', '',
1563 'last', 'varchar', '', 2*$char_d, '', '',
1564 # 'middle', 'varchar', 'NULL', $char_d, '', '',
1565 'first', 'varchar', '', $char_d, '', '',
1566 'ss', 'varchar', 'NULL', 11, '', '',
1567 'stateid', 'varchar', 'NULL', $char_d, '', '',
1568 'stateid_state', 'varchar', 'NULL', $char_d, '', '',
1569 'national_id', 'varchar', 'NULL', $char_d, '', '',
1570 'birthdate' ,@date_type, '', '',
1571 'spouse_last', 'varchar', 'NULL', 2*$char_d, '', '',
1572 'spouse_first', 'varchar', 'NULL', $char_d, '', '',
1573 'spouse_birthdate', @date_type, '', '',
1574 'anniversary_date', @date_type, '', '',
1575 'signupdate',@date_type, '', '',
1576 'dundate', @date_type, '', '',
1577 'company', 'varchar', 'NULL', $char_d, '', '',
1578 'address1', 'varchar', 'NULL', $char_d, '', '',
1579 'address2', 'varchar', 'NULL', $char_d, '', '',
1580 'city', 'varchar', 'NULL', $char_d, '', '',
1581 'county', 'varchar', 'NULL', $char_d, '', '',
1582 'state', 'varchar', 'NULL', $char_d, '', '',
1583 'zip', 'varchar', 'NULL', 10, '', '',
1584 'country', 'char', 'NULL', 2, '', '',
1585 'latitude', 'decimal', 'NULL', '10,7', '', '',
1586 'longitude','decimal', 'NULL', '10,7', '', '',
1587 'coord_auto', 'char', 'NULL', 1, '', '',
1588 'addr_clean', 'char', 'NULL', 1, '', '',
1589 'daytime', 'varchar', 'NULL', 20, '', '',
1590 'night', 'varchar', 'NULL', 20, '', '',
1591 'fax', 'varchar', 'NULL', 12, '', '',
1592 'mobile', 'varchar', 'NULL', 12, '', '',
1593 'ship_last', 'varchar', 'NULL', 2*$char_d, '', '',
1594 # 'ship_middle', 'varchar', 'NULL', $char_d, '', '',
1595 'ship_first', 'varchar', 'NULL', $char_d, '', '',
1596 'ship_company', 'varchar', 'NULL', $char_d, '', '',
1597 'ship_address1', 'varchar', 'NULL', $char_d, '', '',
1598 'ship_address2', 'varchar', 'NULL', $char_d, '', '',
1599 'ship_city', 'varchar', 'NULL', $char_d, '', '',
1600 'ship_county', 'varchar', 'NULL', $char_d, '', '',
1601 'ship_state', 'varchar', 'NULL', $char_d, '', '',
1602 'ship_zip', 'varchar', 'NULL', 10, '', '',
1603 'ship_country', 'char', 'NULL', 2, '', '',
1604 'ship_latitude', 'decimal', 'NULL', '10,7', '', '',
1605 'ship_longitude','decimal', 'NULL', '10,7', '', '',
1606 'ship_coord_auto', 'char', 'NULL', 1, '', '',
1607 'ship_addr_clean', 'char', 'NULL', 1, '', '',
1608 'ship_daytime', 'varchar', 'NULL', 20, '', '',
1609 'ship_night', 'varchar', 'NULL', 20, '', '',
1610 'ship_fax', 'varchar', 'NULL', 12, '', '',
1611 'ship_mobile', 'varchar', 'NULL', 12, '', '',
1612 'currency', 'char', 'NULL', 3, '', '',
1614 #deprecated, info moved to cust_payby
1615 'payby', 'char', 'NULL', 4, '', '',
1616 'payinfo', 'varchar', 'NULL', 512, '', '',
1617 'paycvv', 'varchar', 'NULL', 512, '', '',
1618 'paymask', 'varchar', 'NULL', $char_d, '', '',
1619 #'paydate', @date_type, '', '',
1620 'paydate', 'varchar', 'NULL', 10, '', '',
1621 'paystart_month', 'int', 'NULL', '', '', '',
1622 'paystart_year', 'int', 'NULL', '', '', '',
1623 'payissue', 'varchar', 'NULL', 2, '', '',
1624 'payname', 'varchar', 'NULL', 2*$char_d, '', '',
1625 'paystate', 'varchar', 'NULL', $char_d, '', '',
1626 'paytype', 'varchar', 'NULL', $char_d, '', '',
1627 'payip', 'varchar', 'NULL', 15, '', '',
1628 'paycardtype', 'varchar', 'NULL', $char_d, '', '',
1630 'is_tokenized', 'char', 'NULL', '1', '', '',
1632 'geocode', 'varchar', 'NULL', 20, '', '',
1633 'censustract', 'varchar', 'NULL', 20, '', '', # 7 to save space?
1634 'censusyear', 'char', 'NULL', 4, '', '',
1635 'district', 'varchar', 'NULL', 20, '', '',
1636 'tax', 'char', 'NULL', 1, '', '',
1637 'otaker', 'varchar', 'NULL', 32, '', '',
1638 'usernum', 'int', 'NULL', '', '', '',
1639 'refnum', 'int', '', '', '', '',
1640 'referral_custnum', 'int', 'NULL', '', '', '',
1641 'comments', 'text', 'NULL', '', '', '',
1642 'spool_cdr','char', 'NULL', 1, '', '',
1643 'squelch_cdr','char', 'NULL', 1, '', '',
1644 'cdr_termination_percentage', 'decimal', 'NULL', '7,4', '', '',
1645 'invoice_terms', 'varchar', 'NULL', $char_d, '', '',
1646 'credit_limit', @money_typen, '', '',
1647 'credit_limit_currency', 'char', 'NULL', 3, '', '',
1648 'archived', 'char', 'NULL', 1, '', '',
1649 'email_csv_cdr', 'char', 'NULL', 1, '', '',
1650 'accountcode_cdr', 'char', 'NULL', 1, '', '',
1651 'billday', 'int', 'NULL', '', '', '',
1652 'prorate_day', 'int', 'NULL', '', '', '',
1653 'force_prorate_day', 'char', 'NULL', 1, '', '',
1654 'edit_subject', 'char', 'NULL', 1, '', '',
1655 'locale', 'varchar', 'NULL', 16, '', '',
1656 'calling_list_exempt', 'char', 'NULL', 1, '', '',
1657 'invoice_noemail', 'char', 'NULL', 1, '', '',
1658 'message_noemail', 'char', 'NULL', 1, '', '',
1659 'bill_locationnum', 'int', 'NULL', '', '', '',
1660 'ship_locationnum', 'int', 'NULL', '', '', '',
1661 'taxstatusnum', 'int', 'NULL', '', '', '',
1662 'complimentary', 'char', 'NULL', 1, '', '',
1663 'po_number', 'varchar', 'NULL', $char_d, '', '',
1664 'invoice_attn', 'varchar', 'NULL', $char_d, '', '',
1665 'invoice_ship_address', 'char', 'NULL', 1, '', '',
1666 'postal_invoice', 'char', 'NULL', 1, '', '',
1667 'paymentreceipt_noemail', 'char', 'NULL', 1, '', '',
1669 'primary_key' => 'custnum',
1670 'unique' => [ [ 'agentnum', 'agent_custid' ] ],
1671 #'index' => [ ['last'], ['company'] ],
1673 ['agentnum'], ['refnum'], ['classnum'], ['usernum'],
1675 [ 'referral_custnum' ],
1676 [ 'payby' ], [ 'paydate' ],
1678 [ 'ship_locationnum' ],
1679 [ 'bill_locationnum' ],
1684 { columns => [ 'agentnum' ],
1687 { columns => [ 'salesnum' ],
1690 { columns => [ 'refnum' ],
1691 table => 'part_referral',
1693 { columns => [ 'classnum' ],
1694 table => 'cust_class',
1696 { columns => [ 'usernum' ],
1697 table => 'access_user',
1699 { columns => [ 'referral_custnum' ],
1700 table => 'cust_main',
1701 references => [ 'custnum' ],
1703 { columns => [ 'bill_locationnum' ],
1704 table => 'cust_location',
1705 references => [ 'locationnum' ],
1707 { columns => [ 'ship_locationnum' ],
1708 table => 'cust_location',
1709 references => [ 'locationnum' ],
1716 'custpaybynum', 'serial', '', '', '', '',
1717 'custnum', 'int', '', '', '', '',
1718 'weight', 'int', 'NULL', '', '', '',
1719 'payby', 'char', '', 4, '', '',
1720 'payinfo', 'varchar', 'NULL', 512, '', '',
1721 'paycardtype', 'varchar', 'NULL', $char_d, '', '',
1722 'paycvv', 'varchar', 'NULL', 512, '', '',
1723 'paymask', 'varchar', 'NULL', $char_d, '', '',
1724 #'paydate', @date_type, '', '',
1725 'paydate', 'varchar', 'NULL', 10, '', '',
1726 'paystart_month', 'int', 'NULL', '', '', '',
1727 'paystart_year', 'int', 'NULL', '', '', '',
1728 'payissue', 'varchar', 'NULL', 2, '', '',
1729 'payname', 'varchar', 'NULL', 2*$char_d, '', '',
1730 'paystate', 'varchar', 'NULL', $char_d, '', '',
1731 'paytype', 'varchar', 'NULL', $char_d, '', '',
1732 'payip', 'varchar', 'NULL', 15, '', '',
1733 'locationnum', 'int', 'NULL', '', '', '',
1734 'is_tokenized', 'char', 'NULL', 1, '', '',
1736 'primary_key' => 'custpaybynum',
1738 'index' => [ [ 'custnum' ], [ 'is_tokenized' ] ],
1740 { columns => [ 'custnum' ],
1741 table => 'cust_main',
1743 { columns => [ 'locationnum' ],
1744 table => 'cust_location',
1749 'contact_class' => {
1751 'classnum', 'serial', '', '', '', '',
1752 'classname', 'varchar', '', $char_d, '', '',
1753 'disabled', 'char', 'NULL', 1, '', '',
1755 'primary_key' => 'classnum',
1757 'index' => [ ['disabled'] ],
1762 'custcontactnum', 'serial', '', '', '', '',
1763 'custnum', 'int', '', '', '', '',
1764 'contactnum', 'int', '', '', '', '',
1765 'classnum', 'int', 'NULL', '', '', '',
1766 'comment', 'varchar', 'NULL', 255, '', '',
1767 'selfservice_access', 'char', 'NULL', 1, '', '',
1768 'invoice_dest', 'char', 'NULL', 1, '', '', # Y or NULL
1769 'message_dest', 'char', 'NULL', 1, '', '', # Y or NULL
1771 'primary_key' => 'custcontactnum',
1772 'unique' => [ [ 'custnum', 'contactnum' ], ],
1773 'index' => [ [ 'custnum' ], [ 'contactnum' ], ],
1775 { columns => [ 'custnum' ],
1776 table => 'cust_main',
1778 { columns => [ 'contactnum' ],
1781 { columns => [ 'classnum' ],
1782 table => 'contact_class',
1787 'prospect_contact' => {
1789 'prospectcontactnum', 'serial', '', '', '', '',
1790 'prospectnum', 'int', '', '', '', '',
1791 'contactnum', 'int', '', '', '', '',
1792 'classnum', 'int', 'NULL', '', '', '',
1793 'comment', 'varchar', 'NULL', 255, '', '',
1795 'primary_key' => 'prospectcontactnum',
1796 'unique' => [ [ 'prospectnum', 'contactnum' ], ],
1797 'index' => [ [ 'prospectnum' ], [ 'contactnum' ], ],
1799 { columns => [ 'prospectnum' ],
1800 table => 'prospect_main',
1802 { columns => [ 'contactnum' ],
1805 { columns => [ 'classnum' ],
1806 table => 'contact_class',
1813 'contactnum', 'serial', '', '', '', '',
1814 'prospectnum', 'int', 'NULL', '', '', '', #deprecated, now prospect_contact table
1815 'custnum', 'int', 'NULL', '', '', '', #deprecated, now cust_contact table
1816 'locationnum', 'int', 'NULL', '', '', '', #not yet
1817 'classnum', 'int', 'NULL', '', '', '', #deprecated, now prospect_contact or cust_contact
1818 # 'titlenum', 'int', 'NULL', '', '', '', #eg Mr. Mrs. Dr. Rev.
1819 'last', 'varchar', '', $char_d, '', '',
1820 # 'middle', 'varchar', 'NULL', $char_d, '', '',
1821 'first', 'varchar', '', $char_d, '', '',
1822 'title', 'varchar', 'NULL', $char_d, '', '', #eg Head Bottle Washer
1823 'comment', 'varchar', 'NULL', 255, '', '', #depredated, now prospect_contact or cust_contact
1824 'selfservice_access', 'char', 'NULL', 1, '', '', #deprecated, now cust_contact
1825 '_password', 'varchar', 'NULL', $char_d, '', '',
1826 '_password_encoding', 'varchar', 'NULL', $char_d, '', '',
1827 'disabled', 'char', 'NULL', 1, '', '',
1828 'invoice_dest', 'char', 'NULL', 1, '', '',
1830 'primary_key' => 'contactnum',
1832 'index' => [ [ 'prospectnum' ], [ 'custnum' ], [ 'locationnum' ],
1833 [ 'last' ], [ 'first' ],
1836 { columns => [ 'prospectnum' ],
1837 table => 'prospect_main',
1839 { columns => [ 'custnum' ],
1840 table => 'cust_main',
1842 { columns => [ 'locationnum' ],
1843 table => 'cust_location',
1845 { columns => [ 'classnum' ],
1846 table => 'contact_class',
1851 'contact_phone' => {
1853 'contactphonenum', 'serial', '', '', '', '',
1854 'contactnum', 'int', '', '', '', '',
1855 'phonetypenum', 'int', '', '', '', '',
1856 'countrycode', 'varchar', '', 3, '', '',
1857 'phonenum', 'varchar', '', 14, '', '',
1858 'extension', 'varchar', 'NULL', 7, '', '',
1859 #?#'comment', 'varchar', '', $char_d, '', '',
1861 'primary_key' => 'contactphonenum',
1865 { columns => [ 'contactnum' ],
1868 { columns => [ 'phonetypenum' ],
1869 table => 'phone_type',
1876 'phonetypenum', 'serial', '', '', '', '',
1877 'typename', 'varchar', '', $char_d, '', '',
1878 'weight', 'int', '', '', '', '',
1880 'primary_key' => 'phonetypenum',
1881 'unique' => [ [ 'typename' ], ],
1885 'contact_email' => {
1887 'contactemailnum', 'serial', '', '', '', '',
1888 'contactnum', 'int', '', '', '', '',
1889 'emailaddress', 'varchar', '', $char_d, '', '',
1891 'primary_key' => 'contactemailnum',
1892 #'unique' => [ [ 'contactnum', 'emailaddress' ], ],
1893 'unique' => [ [ 'emailaddress' ], ],
1896 { columns => [ 'contactnum' ],
1902 'prospect_main' => {
1904 'prospectnum', 'serial', '', '', '', '',
1905 'agentnum', 'int', '', '', '', '',
1906 'company', 'varchar', 'NULL', $char_d, '', '',
1907 'add_date', @date_type, '', '',
1908 'disabled', 'char', 'NULL', 1, '', '',
1909 'custnum', 'int', 'NULL', '', '', '',
1910 'refnum', 'int', 'NULL', '', '', '',
1911 'taxstatusnum', 'int', 'NULL', '', '', '',
1913 'primary_key' => 'prospectnum',
1915 'index' => [ ['company'], ['agentnum'], ['disabled'], ['refnum'] ],
1917 { columns => [ 'agentnum' ],
1920 { columns => [ 'custnum' ],
1921 table => 'cust_main',
1923 { columns => [ 'refnum' ],
1924 table => 'part_referral',
1932 'quotationnum', 'serial', '', '', '', '',
1933 'prospectnum', 'int', 'NULL', '', '', '',
1934 'custnum', 'int', 'NULL', '', '', '',
1935 '_date', @date_type, '', '',
1936 'disabled', 'char', 'NULL', 1, '', '',
1937 'usernum', 'int', 'NULL', '', '', '',
1938 'close_date', @date_type, '', '',
1939 'confidence', 'int', 'NULL', '', '', '',
1940 'quotation_description', 'varchar', 'NULL', '50', '', '',
1941 #'total', @money_type, '', '',
1942 #'quotation_term', 'varchar', 'NULL', $char_d, '', '',
1944 'primary_key' => 'quotationnum',
1946 'index' => [ [ 'prospectnum' ], ['custnum'], ['disabled'], ],
1948 { columns => [ 'prospectnum' ],
1949 table => 'prospect_main',
1951 { columns => [ 'custnum' ],
1952 table => 'cust_main',
1954 { columns => [ 'usernum' ],
1955 table => 'access_user',
1960 'quotation_pkg' => {
1962 'quotationpkgnum', 'serial', '', '', '', '',
1963 'quotationnum', 'int', 'NULL', '', '', '', #shouldn't be null,
1965 'pkgpart', 'int', '', '', '', '',
1966 'locationnum', 'int', 'NULL', '', '', '',
1967 'start_date', @date_type, '', '',
1968 'contract_end', @date_type, '', '',
1969 'quantity', 'int', 'NULL', '', '', '',
1970 'waive_setup', 'char', 'NULL', 1, '', '',
1971 'unitsetup', @money_typen, '', '',
1972 'unitrecur', @money_typen, '', '',
1974 'primary_key' => 'quotationpkgnum',
1976 'index' => [ ['pkgpart'], ],
1978 { columns => [ 'quotationnum' ],
1979 table => 'quotation',
1981 { columns => [ 'pkgpart' ],
1982 table => 'part_pkg',
1984 { columns => [ 'locationnum' ],
1985 table => 'cust_location',
1990 'quotation_pkg_detail' => {
1992 'detailnum', 'serial', '', '', '', '',
1993 'quotationpkgnum', 'int', '', '', '', '',
1994 'format', 'char', 'NULL', 1, '', '', # not used for anything
1995 'detail', 'varchar', '', 255, '', '',
1996 'copy_on_order', 'char', 'NULL', 1, '', '', # 'Y' to copy when ordering
1998 'primary_key' => 'detailnum',
2000 'index' => [ [ 'quotationpkgnum' ] ],
2002 { columns => [ 'quotationpkgnum' ],
2003 table => 'quotation_pkg',
2004 references => [ 'quotationpkgnum' ],
2009 'quotation_pkg_discount' => {
2011 'quotationpkgdiscountnum', 'serial', '', '', '', '',
2012 'quotationpkgnum', 'int', '', '', '', '',
2013 'discountnum', 'int', '', '', '', '',
2014 'setuprecur', 'varchar', 'NULL', $char_d, '', '',
2015 'amount', @money_typen, '', '',
2016 #'end_date', @date_type, '', '',
2018 'primary_key' => 'quotationpkgdiscountnum',
2020 'index' => [ [ 'quotationpkgnum' ], ], #[ 'discountnum' ] ],
2022 { columns => [ 'quotationpkgnum' ],
2023 table => 'quotation_pkg',
2025 { columns => [ 'discountnum' ],
2026 table => 'discount',
2031 'quotation_pkg_tax' => {
2033 'quotationtaxnum', 'serial', '', '', '', '',
2034 'quotationpkgnum', 'int', '', '', '', '',
2035 'itemdesc', 'varchar', '', $char_d, '', '',
2036 'setup_amount', @money_type, '', '',
2037 'recur_amount', @money_type, '', '',
2039 'primary_key' => 'quotationtaxnum',
2041 'index' => [ [ 'quotationpkgnum' ] ],
2043 { columns => [ 'quotationpkgnum' ],
2044 table => 'quotation_pkg',
2049 'cust_location' => { #'location' now that its prospects too, but...
2051 'locationnum', 'serial', '', '', '', '',
2052 'prospectnum', 'int', 'NULL', '', '', '',
2053 'custnum', 'int', 'NULL', '', '', '',
2054 'locationname', 'varchar', 'NULL', $char_d, '', '',
2055 'address1', 'varchar', '', $char_d, '', '',
2056 'address2', 'varchar', 'NULL', $char_d, '', '',
2057 'city', 'varchar', 'NULL', $char_d, '', '',
2058 'county', 'varchar', 'NULL', $char_d, '', '',
2059 'state', 'varchar', 'NULL', $char_d, '', '',
2060 'zip', 'varchar', 'NULL', 10, '', '',
2061 'latitude', 'decimal', 'NULL', '10,7', '', '',
2062 'longitude', 'decimal', 'NULL', '10,7', '', '',
2063 'coord_auto', 'char', 'NULL', 1, '', '',
2064 'addr_clean', 'char', 'NULL', 1, '', '',
2065 'country', 'char', '', 2, '', '',
2066 'geocode', 'varchar', 'NULL', 20, '', '',
2067 'district', 'varchar', 'NULL', 20, '', '',
2068 'censustract', 'varchar', 'NULL', 20, '', '',
2069 'censusyear', 'char', 'NULL', 4, '', '',
2071 #used only in... DSL qualification? .CA DSL qualification?
2072 'location_type', 'varchar', 'NULL', 20, '', '',
2073 'location_number', 'varchar', 'NULL', 20, '', '',
2074 'location_kind', 'char', 'NULL', 1, '', '',
2076 'incorporated', 'char', 'NULL', 1, '', '',
2077 'disabled', 'char', 'NULL', 1, '', '',
2079 'primary_key' => 'locationnum',
2081 'index' => [ [ 'prospectnum' ], [ 'custnum' ],
2082 [ 'county' ], [ 'state' ], [ 'country' ], [ 'zip' ],
2083 [ 'city' ], [ 'district' ]
2086 { columns => [ 'prospectnum' ],
2087 table => 'prospect_main',
2089 { columns => [ 'custnum' ],
2090 table => 'cust_main',
2095 'cust_main_invoice' => {
2097 'destnum', 'serial', '', '', '', '',
2098 'custnum', 'int', '', '', '', '',
2099 'dest', 'varchar', '', $char_d, '', '',
2101 'primary_key' => 'destnum',
2103 'index' => [ ['custnum'], ],
2105 { columns => [ 'custnum' ],
2106 table => 'cust_main',
2111 'cust_main_credit_limit' => {
2113 'creditlimitnum', 'serial', '', '', '', '',
2114 'custnum', 'int', '', '', '', '',
2115 '_date', @date_type, '', '',
2116 'amount', @money_typen, '', '',
2117 #'amount_currency', 'char', 'NULL', 3, '', '',
2118 'credit_limit', @money_typen, '', '',
2119 #'credit_limit_currency', 'char', 'NULL', 3, '', '',
2121 'primary_key' => 'creditlimitnum',
2123 'index' => [ ['custnum'], ],
2125 { columns => [ 'custnum' ],
2126 table => 'cust_main',
2131 'cust_main_note' => {
2133 'notenum', 'serial', '', '', '', '',
2134 'custnum', 'int', '', '', '', '',
2135 'classnum', 'int', 'NULL', '', '', '',
2136 '_date', @date_type, '', '',
2137 'otaker', 'varchar', 'NULL', 32, '', '',
2138 'usernum', 'int', 'NULL', '', '', '',
2139 'comments', 'text', 'NULL', '', '', '',
2140 'sticky', 'int', '', '', 0, '',
2142 'primary_key' => 'notenum',
2144 'index' => [ [ 'custnum' ], [ '_date' ], [ 'usernum' ], ],
2146 { columns => [ 'custnum' ],
2147 table => 'cust_main',
2149 { columns => [ 'classnum' ],
2150 table => 'cust_note_class',
2152 { columns => [ 'usernum' ],
2153 table => 'access_user',
2158 'cust_note_class' => {
2160 'classnum', 'serial', '', '', '', '',
2161 'classname', 'varchar', '', $char_d, '', '',
2162 'disabled', 'char', 'NULL', 1, '', '',
2164 'primary_key' => 'classnum',
2166 'index' => [ ['disabled'] ],
2169 'cust_category' => {
2171 'categorynum', 'serial', '', '', '', '',
2172 'categoryname', 'varchar', '', $char_d, '', '',
2173 'weight', 'int', 'NULL', '', '', '',
2174 'disabled', 'char', 'NULL', 1, '', '',
2176 'primary_key' => 'categorynum',
2178 'index' => [ ['disabled'] ],
2183 'classnum', 'serial', '', '', '', '',
2184 'classname', 'varchar', '', $char_d, '', '',
2185 'categorynum', 'int', 'NULL', '', '', '',
2186 'tax', 'char', 'NULL', 1, '', '',
2187 'disabled', 'char', 'NULL', 1, '', '',
2189 'primary_key' => 'classnum',
2191 'index' => [ ['disabled'] ],
2193 { columns => [ 'categorynum' ],
2194 table => 'cust_category',
2201 'custtagnum', 'serial', '', '', '', '',
2202 'custnum', 'int', '', '', '', '',
2203 'tagnum', 'int', '', '', '', '',
2205 'primary_key' => 'custtagnum',
2206 'unique' => [ [ 'custnum', 'tagnum' ] ],
2207 'index' => [ [ 'custnum' ] ],
2209 { columns => [ 'custnum' ],
2210 table => 'cust_main',
2212 { columns => [ 'tagnum' ],
2213 table => 'part_tag',
2220 'tagnum', 'serial', '', '', '', '',
2221 'tagname', 'varchar', '', $char_d, '', '',
2222 'tagdesc', 'varchar', 'NULL', $char_d, '', '',
2223 'tagcolor', 'varchar', 'NULL', 6, '', '',
2224 'by_default', 'char', 'NULL', 1, '', '',
2225 'disabled', 'char', 'NULL', 1, '', '',
2227 'primary_key' => 'tagnum',
2228 'unique' => [], #[ [ 'tagname' ] ], #?
2229 'index' => [ [ 'disabled' ] ],
2232 'cust_main_exemption' => {
2234 'exemptionnum', 'serial', '', '', '', '',
2235 'custnum', 'int', '', '', '', '',
2236 'taxname', 'varchar', '', $char_d, '', '',
2237 'exempt_number', 'varchar', 'NULL', $char_d, '', '',
2238 #start/end dates? for reporting?
2240 'primary_key' => 'exemptionnum',
2242 'index' => [ [ 'custnum' ] ],
2244 { columns => [ 'custnum' ],
2245 table => 'cust_main',
2250 'cust_tax_adjustment' => {
2252 'adjustmentnum', 'serial', '', '', '', '',
2253 'custnum', 'int', '', '', '', '',
2254 'taxname', 'varchar', '', $char_d, '', '',
2255 'amount', @money_type, '', '',
2256 'currency', 'char', 'NULL', 3, '', '',
2257 'comment', 'varchar', 'NULL', $char_d, '', '',
2258 'billpkgnum', 'int', 'NULL', '', '', '',
2259 #more? no cust_bill_pkg_tax_location?
2261 'primary_key' => 'adjustmentnum',
2263 'index' => [ [ 'custnum' ], [ 'billpkgnum' ] ],
2265 { columns => [ 'custnum' ],
2266 table => 'cust_main',
2268 { columns => [ 'billpkgnum' ],
2269 table => 'cust_bill_pkg',
2274 'cust_main_county' => { #district+city+county+state+country are checked
2275 #off the cust_main_county for validation and to
2276 #provide a tax rate.
2278 'taxnum', 'serial', '', '', '', '',
2279 'district', 'varchar', 'NULL', 20, '', '',
2280 'city', 'varchar', 'NULL', $char_d, '', '',
2281 'county', 'varchar', 'NULL', $char_d, '', '',
2282 'state', 'varchar', 'NULL', $char_d, '', '',
2283 'country', 'char', '', 2, '', '',
2284 'taxclass', 'varchar', 'NULL', $char_d, '', '',
2285 'exempt_amount', @money_type, '', '',
2286 'exempt_amount_currency', 'char', 'NULL', 3, '', '',
2287 'tax', 'real', '', '', '', '', #tax %
2288 'taxname', 'varchar', 'NULL', $char_d, '', '',
2289 'setuptax', 'char', 'NULL', 1, '', '', # Y = setup tax exempt
2290 'recurtax', 'char', 'NULL', 1, '', '', # Y = recur tax exempt
2291 'source', 'varchar', 'NULL', $char_d, '', '',
2292 'charge_prediscount', 'char', 'NULL', 1, '', '', # Y = charge this tax pre discount
2294 'primary_key' => 'taxnum',
2296 # 'unique' => [ ['taxnum'], ['state', 'county'] ],
2297 'index' => [ [ 'district' ], [ 'city' ], [ 'county' ], [ 'state' ],
2305 'taxnum', 'serial', '', '', '', '',
2306 'geocode', 'varchar', 'NULL', $char_d, '', '',#cch provides 10 char
2307 'data_vendor', 'varchar', 'NULL', $char_d, '', '',#auto update source
2308 'location', 'varchar', 'NULL', $char_d, '', '',#provided by tax authority
2309 'taxclassnum', 'int', 'NULL', '', '', '',
2310 'effective_date', @date_type, '', '',
2311 'tax', @taxrate_type, '', '', # tax %
2312 'excessrate', @taxrate_typen, '', '', # second tax %
2313 'taxbase', @money_typen, '', '', # amount at first tax rate
2314 'taxmax', @money_typen, '', '', # maximum about at both rates
2315 'usetax', @taxrate_typen, '', '', # tax % when non-local
2316 'useexcessrate', @taxrate_typen, '', '', # second tax % when non-local
2317 'unittype', 'int', 'NULL', '', '', '', # for fee
2318 'fee', @taxrate_typen, '', '', # amount tax per unit
2319 'excessfee', @taxrate_typen, '', '', # second amount tax per unit
2320 'feebase', @taxrate_typen, '', '', # units taxed at first rate
2321 'feemax', @taxrate_typen, '', '', # maximum number of unit taxed
2322 'maxtype', 'int', 'NULL', '', '', '', # indicator of how thresholds accumulate
2323 'taxname', 'varchar', 'NULL', $char_d, '', '', # may appear on invoice
2324 'taxauth', 'int', 'NULL', '', '', '', # tax authority
2325 'basetype', 'int', 'NULL', '', '', '', # indicator of basis for tax
2326 'passtype', 'int', 'NULL', '', '', '', # indicator declaring how item should be shown
2327 'passflag', 'char', 'NULL', 1, '', '', # Y = required to list as line item, N = Prohibited
2328 'setuptax', 'char', 'NULL', 1, '', '', # Y = setup tax exempt
2329 'recurtax', 'char', 'NULL', 1, '', '', # Y = recur tax exempt
2330 'inoutcity', 'char', 'NULL', 1, '', '', # '', 'I', or 'O'
2331 'inoutlocal', 'char', 'NULL', 1, '', '', # '', 'I', or 'O'
2332 'manual', 'char', 'NULL', 1, '', '', # Y = manually edited
2333 'disabled', 'char', 'NULL', 1, '', '', # Y = tax disabled
2335 'primary_key' => 'taxnum',
2337 'index' => [ ['taxclassnum'], ['data_vendor', 'geocode'] ],
2339 { columns => [ 'taxclassnum' ],
2340 table => 'tax_class',
2345 'tax_rate_location' => {
2347 'taxratelocationnum', 'serial', '', '', '', '',
2348 'data_vendor', 'varchar', 'NULL', $char_d, '', '',
2349 'geocode', 'varchar', '', 20, '', '',
2350 'district', 'varchar', 'NULL', $char_d, '', '',
2351 'city', 'varchar', 'NULL', $char_d, '', '',
2352 'county', 'varchar', 'NULL', $char_d, '', '',
2353 'state', 'char', 'NULL', 2, '', '',
2354 'country', 'char', 'NULL', 2, '', '',
2355 'disabled', 'char', 'NULL', 1, '', '',
2357 'primary_key' => 'taxratelocationnum',
2359 'index' => [ [ 'data_vendor', 'geocode', 'disabled' ] ],
2362 'cust_tax_location' => {
2364 'custlocationnum', 'serial', '', '', '', '',
2365 'data_vendor', 'varchar', 'NULL', $char_d, '', '', # update source
2366 'city', 'varchar', 'NULL', $char_d, '', '',
2367 'postalcity', 'varchar', 'NULL', $char_d, '', '',
2368 'county', 'varchar', 'NULL', $char_d, '', '',
2369 'zip', 'char', 'NULL', 5, '', '',
2370 'state', 'char', '', 2, '', '',
2371 'country', 'char', 'NULL', 2, '', '', # should not actually be NULL, but cch...
2372 'ziphi', 'char', 'NULL', 10, '', '',
2373 'ziplo', 'char', 'NULL', 10, '', '',
2374 'plus4hi', 'char', 'NULL', 4, '', '',
2375 'plus4lo', 'char', 'NULL', 4, '', '',
2376 'default_location','char', 'NULL', 1, '', '', # Y = default for zip
2377 'cityflag', 'char', 'NULL', 1, '', '', # I(n)/O(out)/B(oth)/NULL
2378 'geocode', 'varchar', '', 20, '', '',
2380 'primary_key' => 'custlocationnum',
2382 'index' => [ [ 'zip', 'plus4lo', 'plus4hi', 'ziphi', 'ziplo' ] ],
2387 'taxclassnum', 'serial', '', '', '', '',
2388 'data_vendor', 'varchar', 'NULL', $char_d, '', '',
2389 'taxclass', 'varchar', '', $char_d, '', '',
2390 'description', 'varchar', '', 2*$char_d, '', '',
2392 'primary_key' => 'taxclassnum',
2393 'unique' => [ [ 'data_vendor', 'taxclass' ] ],
2399 'taxstatusnum', 'serial', '', '', '', '',
2400 'data_vendor', 'varchar', 'NULL', $char_d, '', '',
2401 'taxstatus', 'varchar', '', $char_d, '', '',
2402 'description', 'varchar', '', $char_d, '', '',
2404 'primary_key' => 'taxstatusnum',
2405 'unique' => [ [ 'data_vendor', 'taxstatus' ] ],
2409 'cust_pay_pending' => {
2411 'paypendingnum', 'serial', '', '', '', '',
2412 'custnum', 'int', 'NULL', '', '', '',
2413 'paid', @money_type, '', '',
2414 'currency', 'char', 'NULL', 3, '', '',
2415 '_date', @date_type, '', '',
2416 'payby', 'char', '', 4, '', '',
2417 'payinfo', 'varchar', 'NULL', 512, '', '',
2418 'paymask', 'varchar', 'NULL', $char_d, '', '',
2419 'paydate', 'varchar', 'NULL', 10, '', '',
2420 'recurring_billing', 'varchar', 'NULL', $char_d, '', '',
2421 'payunique', 'varchar', 'NULL', $char_d, '', '', #separate paybatch "unique" functions from current usage
2423 'pkgnum', 'int', 'NULL', '', '', '', #desired pkgnum for pkg-balances
2424 'status', 'varchar', '', $char_d, '', '',
2425 'session_id', 'varchar', 'NULL', 1024, '', '', # SHA-512-hex
2426 'statustext', 'text', 'NULL', '', '', '',
2427 'gatewaynum', 'int', 'NULL', '', '', '',
2428 #'cust_balance', @money_type, '', '',
2429 'paynum', 'int', 'NULL', '', '', '',
2430 'void_paynum', 'int', 'NULL', '', '', '',
2431 'jobnum', 'bigint', 'NULL', '', '', '',
2432 'invnum', 'int', 'NULL', '', '', '',
2433 'manual', 'char', 'NULL', 1, '', '',
2434 'discount_term','int', 'NULL', '', '', '',
2435 'failure_status','varchar','NULL', 16, '', '',
2436 'is_tokenized', 'char', 'NULL', 1, '', '',
2438 'primary_key' => 'paypendingnum',
2439 'unique' => [ [ 'payunique' ] ],
2440 'index' => [ [ 'custnum' ], [ 'status' ],
2441 ['paynum'], ['void_paynum'], ['jobnum'], ['invnum'],
2445 { columns => [ 'custnum' ],
2446 table => 'cust_main',
2448 { columns => [ 'pkgnum' ],
2449 table => 'cust_pkg',
2451 { columns => [ 'gatewaynum' ],
2452 table => 'payment_gateway',
2454 { columns => [ 'paynum' ],
2455 table => 'cust_pay',
2457 { columns => [ 'void_paynum' ],
2458 table => 'cust_pay_void',
2459 references => [ 'paynum' ],
2461 { columns => [ 'jobnum' ],
2464 { columns => [ 'invnum' ],
2465 table => 'cust_bill',
2472 'paynum', 'serial', '', '', '', '',
2473 'custnum', 'int', '', '', '', '',
2474 '_date', @date_type, '', '',
2475 'paid', @money_type, '', '',
2476 'currency', 'char', 'NULL', 3, '', '',
2477 'otaker', 'varchar', 'NULL', 32, '', '',
2478 'usernum', 'int', 'NULL', '', '', '',
2479 'payby', 'char', '', 4, '', '',
2480 'payinfo', 'varchar', 'NULL', 512, '', '',
2481 'paycardtype', 'varchar', 'NULL', $char_d, '', '',
2482 'paymask', 'varchar', 'NULL', $char_d, '', '',
2483 'paydate', 'varchar', 'NULL', 10, '', '',
2484 'paybatch', 'varchar', 'NULL', $char_d, '', '',#for auditing purposes
2485 'payunique', 'varchar', 'NULL', $char_d, '', '',#separate paybatch "unique" functions from current usage
2486 'closed', 'char', 'NULL', 1, '', '',
2487 'pkgnum', 'int', 'NULL', '', '', '', #desired pkgnum for pkg-balances
2488 'no_auto_apply', 'char', 'NULL', 1, '', '',
2489 'is_tokenized', 'char', 'NULL', 1, '', '',
2491 # cash/check deposit info fields
2492 'bank', 'varchar', 'NULL', $char_d, '', '',
2493 'depositor', 'varchar', 'NULL', $char_d, '', '',
2494 'account', 'varchar', 'NULL', 20, '', '',
2495 'teller', 'varchar', 'NULL', 20, '', '',
2497 'batchnum', 'int', 'NULL', '', '', '',#pay_batch foreign key
2499 # credit card/EFT fields (formerly in paybatch)
2500 'gatewaynum', 'int', 'NULL', '', '', '', # payment_gateway FK
2501 'processor', 'varchar', 'NULL', $char_d, '', '', # module name
2502 'auth', 'varchar', 'NULL', 16, '', '', # CC auth number
2503 'order_number','varchar', 'NULL', 256, '', '', # transaction number
2505 'primary_key' => 'paynum',
2506 #i guess not now, with cust_pay_pending, if we actually make it here, we _do_ want to record it# 'unique' => [ [ 'payunique' ] ],
2507 'index' => [ ['custnum'], ['paybatch'], ['payby'], ['_date'],
2508 ['usernum'], ['is_tokenized'],
2511 { columns => [ 'custnum' ],
2512 table => 'cust_main',
2514 { columns => [ 'usernum' ],
2515 table => 'access_user',
2517 { columns => [ 'pkgnum' ],
2518 table => 'cust_pkg',
2520 { columns => [ 'batchnum' ],
2521 table => 'pay_batch',
2523 { columns => [ 'gatewaynum' ],
2524 table => 'payment_gateway',
2529 'cust_pay_void' => {
2531 'paynum', 'int', '', '', '', '',
2532 'custnum', 'int', '', '', '', '',
2533 '_date', @date_type, '', '',
2534 'paid', @money_type, '', '',
2535 'currency', 'char', 'NULL', 3, '', '',
2536 'otaker', 'varchar', 'NULL', 32, '', '',
2537 'usernum', 'int', 'NULL', '', '', '',
2538 'payby', 'char', '', 4, '', '',
2539 'payinfo', 'varchar', 'NULL', 512, '', '',
2540 'paycardtype', 'varchar', 'NULL', $char_d, '', '',
2541 'paymask', 'varchar', 'NULL', $char_d, '', '',
2543 'paybatch', 'varchar', 'NULL', $char_d, '', '', #for auditing purposes.
2544 'closed', 'char', 'NULL', 1, '', '',
2545 'pkgnum', 'int', 'NULL', '', '', '', #desired pkgnum for pkg-balances
2546 'is_tokenized', 'char', 'NULL', 1, '', '',
2548 # cash/check deposit info fields
2549 'bank', 'varchar', 'NULL', $char_d, '', '',
2550 'depositor', 'varchar', 'NULL', $char_d, '', '',
2551 'account', 'varchar', 'NULL', 20, '', '',
2552 'teller', 'varchar', 'NULL', 20, '', '',
2553 'batchnum', 'int', 'NULL', '', '', '', #pay_batch foreign key
2555 # credit card/EFT fields (formerly in paybatch)
2556 'gatewaynum', 'int', 'NULL', '', '', '', # payment_gateway FK
2557 'processor', 'varchar', 'NULL', $char_d, '', '', # module name
2558 'auth', 'varchar', 'NULL', 16, '', '', # CC auth number
2559 'order_number','varchar', 'NULL', 256, '', '', # transaction number
2562 'void_date', @date_type, '', '',
2563 'reason', 'varchar', 'NULL', $char_d, '', '',
2564 'reasonnum', 'int', 'NULL', '', '', '',
2565 'void_usernum', 'int', 'NULL', '', '', '',
2567 'primary_key' => 'paynum',
2569 'index' => [ ['custnum'], ['usernum'], ['void_usernum'],
2573 { columns => [ 'custnum' ],
2574 table => 'cust_main',
2576 { columns => [ 'usernum' ],
2577 table => 'access_user',
2579 { columns => [ 'pkgnum' ],
2580 table => 'cust_pkg',
2582 { columns => [ 'batchnum' ],
2583 table => 'pay_batch',
2585 { columns => [ 'gatewaynum' ],
2586 table => 'payment_gateway',
2588 { columns => [ 'reasonnum' ],
2591 { columns => [ 'void_usernum' ],
2592 table => 'access_user',
2593 references => [ 'usernum' ],
2598 'cust_bill_pay' => {
2600 'billpaynum', 'serial', '', '', '', '',
2601 'invnum', 'int', '', '', '', '',
2602 'paynum', 'int', '', '', '', '',
2603 'amount', @money_type, '', '',
2604 '_date', @date_type, '', '',
2605 'pkgnum', 'int', 'NULL', '', '', '', #desired pkgnum for pkg-balances
2607 'primary_key' => 'billpaynum',
2609 'index' => [ [ 'paynum' ], [ 'invnum' ] ],
2611 { columns => [ 'invnum' ],
2612 table => 'cust_bill',
2614 { columns => [ 'paynum' ],
2615 table => 'cust_pay',
2617 { columns => [ 'pkgnum' ],
2618 table => 'cust_pkg',
2623 'cust_bill_pay_batch' => {
2625 'billpaynum', 'serial', '', '', '', '',
2626 'invnum', 'int', '', '', '', '',
2627 'paybatchnum', 'int', '', '', '', '',
2628 'amount', @money_type, '', '',
2629 '_date', @date_type, '', '',
2631 'primary_key' => 'billpaynum',
2633 'index' => [ [ 'paybatchnum' ], [ 'invnum' ] ],
2635 { columns => [ 'invnum' ],
2636 table => 'cust_bill',
2638 { columns => [ 'paybatchnum' ],
2639 table => 'cust_pay_batch',
2644 'cust_bill_pay_pkg' => {
2646 'billpaypkgnum', 'serial', '', '', '', '',
2647 'billpaynum', 'int', '', '', '', '',
2648 'billpkgnum', 'int', '', '', '', '',
2649 'billpkgtaxlocationnum', 'int', 'NULL', '', '', '',
2650 'billpkgtaxratelocationnum', 'int', 'NULL', '', '', '',
2651 'amount', @money_type, '', '',
2652 'setuprecur', 'varchar', '', $char_d, '', '',
2653 'sdate', @date_type, '', '',
2654 'edate', @date_type, '', '',
2656 'primary_key' => 'billpaypkgnum',
2658 'index' => [ [ 'billpaynum' ], [ 'billpkgnum' ], ],
2660 { columns => [ 'billpaynum' ],
2661 table => 'cust_bill_pay',
2663 { columns => [ 'billpkgnum' ],
2664 table => 'cust_bill_pkg',
2666 { columns => [ 'billpkgtaxlocationnum' ],
2667 table => 'cust_bill_pkg_tax_location',
2669 { columns => [ 'billpkgtaxratelocationnum' ],
2670 table => 'cust_bill_pkg_tax_rate_location',
2675 'pay_batch' => { #batches of payments to an external processor
2677 'batchnum', 'serial', '', '', '', '',
2678 'agentnum', 'int', 'NULL', '', '', '',
2679 'payby', 'char', '', 4, '', '', # CARD/CHEK
2680 'status', 'char', 'NULL', 1, '', '',
2681 'download', @date_type, '', '',
2682 'upload', @date_type, '', '',
2683 'title', 'varchar', 'NULL',255, '', '',
2684 'processor_id', 'varchar', 'NULL',255, '', '',
2686 'primary_key' => 'batchnum',
2690 { columns => [ 'agentnum' ],
2696 'cust_pay_batch' => { #list of customers in current CARD/CHEK batch
2698 'paybatchnum', 'serial', '', '', '', '',
2699 'batchnum', 'int', '', '', '', '',
2700 'invnum', 'int', '', '', '', '',
2701 'custnum', 'int', '', '', '', '',
2702 'last', 'varchar', '', $char_d, '', '',
2703 'first', 'varchar', '', $char_d, '', '',
2704 'address1', 'varchar', '', $char_d, '', '',
2705 'address2', 'varchar', 'NULL', $char_d, '', '',
2706 'city', 'varchar', 'NULL', $char_d, '', '',
2707 'state', 'varchar', 'NULL', $char_d, '', '',
2708 'zip', 'varchar', 'NULL', 10, '', '',
2709 'country', 'char', '', 2, '', '',
2710 'payby', 'char', '', 4, '', '',
2711 'payinfo', 'varchar', 'NULL', 512, '', '',
2712 #'exp', @date_type, '', '',
2713 'exp', 'varchar', 'NULL', 11, '', '',
2714 'payname', 'varchar', 'NULL', $char_d, '', '',
2715 'paytype', 'varchar', 'NULL', $char_d, '', '',
2716 'amount', @money_type, '', '',
2717 'currency', 'char', 'NULL', 3, '', '',
2718 'status', 'varchar', 'NULL', $char_d, '', '',
2719 'failure_status','varchar', 'NULL', 16, '', '',
2720 'error_message', 'varchar', 'NULL', $char_d, '', '',
2721 'paycode', 'varchar', 'NULL', $char_d, '', '',
2723 'primary_key' => 'paybatchnum',
2725 'index' => [ ['batchnum'], ['invnum'], ['custnum'],['status'] ],
2727 { columns => [ 'batchnum' ],
2728 table => 'pay_batch',
2730 #{ columns => [ 'invnum' ],
2731 # table => 'cust_bill',
2733 { columns => [ 'custnum' ],
2734 table => 'cust_main',
2741 'formkey', 'varchar', '', 255, '', '',
2742 'formvalue', 'text', 'NULL', '', '', '',
2744 'primary_key' => 'formkey',
2751 'pkgnum', 'serial', '', '', '', '',
2752 'custnum', 'int', '', '', '', '',
2753 'pkgpart', 'int', '', '', '', '',
2754 'pkgbatch', 'varchar', 'NULL', $char_d, '', '',
2755 'contactnum', 'int', 'NULL', '', '', '',
2756 'locationnum', 'int', 'NULL', '', '', '',
2757 'otaker', 'varchar', 'NULL', 32, '', '',
2758 'usernum', 'int', 'NULL', '', '', '',
2759 'salesnum', 'int', 'NULL', '', '', '',
2760 'order_date', @date_type, '', '',
2761 'start_date', @date_type, '', '',
2762 'setup', @date_type, '', '',
2763 'bill', @date_type, '', '',
2764 'last_bill', @date_type, '', '',
2765 'susp', @date_type, '', '',
2766 'adjourn', @date_type, '', '',
2767 'resume', @date_type, '', '',
2768 'cancel', @date_type, '', '',
2769 'uncancel', @date_type, '', '',
2770 'uncancel_pkgnum', 'int', 'NULL', '', '', '',
2771 'expire', @date_type, '', '',
2772 'contract_end', @date_type, '', '',
2773 'dundate', @date_type, '', '',
2774 'change_date', @date_type, '', '',
2775 'change_pkgnum', 'int', 'NULL', '', '', '',
2776 'change_pkgpart', 'int', 'NULL', '', '', '',
2777 'change_locationnum', 'int', 'NULL', '', '', '',
2778 'change_custnum', 'int', 'NULL', '', '', '',
2779 'main_pkgnum', 'int', 'NULL', '', '', '',
2780 'pkglinknum', 'int', 'NULL', '', '', '',
2781 'manual_flag', 'char', 'NULL', 1, '', '',
2782 'no_auto', 'char', 'NULL', 1, '', '',
2783 'quantity', 'int', 'NULL', '', '', '',
2784 'agent_pkgid', 'varchar', 'NULL', $char_d, '', '',
2785 'waive_setup', 'char', 'NULL', 1, '', '',
2786 'recur_show_zero', 'char', 'NULL', 1, '', '',
2787 'setup_show_zero', 'char', 'NULL', 1, '', '',
2788 'change_to_pkgnum', 'int', 'NULL', '', '', '',
2789 'separate_bill', 'char', 'NULL', 1, '', '',
2791 'primary_key' => 'pkgnum',
2793 'index' => [ ['custnum'], ['pkgpart'], ['pkgbatch'],
2794 ['locationnum'], ['usernum'], ['agent_pkgid'],
2795 ['order_date'], [ 'start_date' ], ['setup'], ['bill'],
2796 ['last_bill'], ['susp'], ['adjourn'], ['resume'],
2797 ['cancel'], ['expire'], ['contract_end'],
2802 #['uncancel_pkgnum'],
2803 #['change_pkgnum'], ['change_locationnum'],
2804 #['change_custnum'],
2806 #['pkglinknum'], ['change_to_pkgnum'],
2809 { columns => [ 'custnum' ],
2810 table => 'cust_main',
2812 { columns => [ 'pkgpart' ],
2813 table => 'part_pkg',
2815 { columns => [ 'contactnum' ],
2818 { columns => [ 'locationnum' ],
2819 table => 'cust_location',
2821 { columns => [ 'usernum' ],
2822 table => 'access_user',
2824 { columns => [ 'salesnum' ],
2827 { columns => [ 'uncancel_pkgnum' ],
2828 table => 'cust_pkg',
2829 references => [ 'pkgnum' ],
2831 { columns => [ 'change_pkgnum' ],
2832 table => 'cust_pkg',
2833 references => [ 'pkgnum' ],
2835 { columns => [ 'change_pkgpart' ],
2836 table => 'part_pkg',
2837 references => [ 'pkgpart' ],
2839 { columns => [ 'change_locationnum' ],
2840 table => 'cust_location',
2841 references => [ 'locationnum' ],
2843 { columns => [ 'change_custnum' ],
2844 table => 'cust_main',
2845 references => [ 'custnum' ],
2847 { columns => [ 'main_pkgnum' ],
2848 table => 'cust_pkg',
2849 references => [ 'pkgnum' ],
2851 { columns => [ 'pkglinknum' ],
2852 table => 'part_pkg_link',
2854 { columns => [ 'change_to_pkgnum' ],
2855 table => 'cust_pkg',
2856 references => [ 'pkgnum' ],
2861 'cust_pkg_option' => {
2863 'optionnum', 'serial', '', '', '', '',
2864 'pkgnum', 'int', '', '', '', '',
2865 'optionname', 'varchar', '', $char_d, '', '',
2866 'optionvalue', 'text', 'NULL', '', '', '',
2868 'primary_key' => 'optionnum',
2870 'index' => [ [ 'pkgnum' ], [ 'optionname' ] ],
2872 { columns => [ 'pkgnum' ],
2873 table => 'cust_pkg',
2878 'cust_pkg_detail' => {
2880 'pkgdetailnum', 'serial', '', '', '', '',
2881 'pkgnum', 'int', '', '', '', '',
2882 'detail', 'varchar', '', 2*$char_d, '', '',
2883 'detailtype', 'char', '', 1, '', '', #"I"nvoice or "C"omment
2884 'weight', 'int', '', '', '', '',
2886 'primary_key' => 'pkgdetailnum',
2888 'index' => [ [ 'pkgnum', 'detailtype' ] ],
2890 { columns => [ 'pkgnum' ],
2891 table => 'cust_pkg',
2896 'cust_pkg_reason' => {
2898 'num', 'serial', '', '', '', '',
2899 'pkgnum', 'int', '', '', '', '',
2900 'reasonnum','int', '', '', '', '',
2901 'action', 'char', 'NULL', 1, '', '', #should not be nullable
2902 'otaker', 'varchar', 'NULL', 32, '', '',
2903 'usernum', 'int', 'NULL', '', '', '',
2904 'date', @date_type, '', '',
2906 'primary_key' => 'num',
2908 'index' => [ ['pkgnum'], ['reasonnum'], ['action'], ['usernum'], ],
2910 { columns => [ 'pkgnum' ],
2911 table => 'cust_pkg',
2913 { columns => [ 'reasonnum' ],
2916 { columns => [ 'usernum' ],
2917 table => 'access_user',
2922 'cust_pkg_reason_fee' => {
2924 'pkgreasonfeenum', 'serial', '', '', '', '',
2925 'pkgreasonnum', 'int', '', '', '', '',
2926 'billpkgnum', 'int', 'NULL', '', '', '',
2927 'feepart', 'int', '', '', '', '',
2928 'nextbill', 'char', 'NULL', 1, '', '',
2930 'primary_key' => 'pkgreasonfeenum',
2931 'unique' => [ [ 'billpkgnum' ], [ 'pkgreasonnum' ] ], # one-to-one link
2932 'index' => [ [ 'feepart' ] ],
2934 { columns => [ 'pkgreasonnum' ],
2935 table => 'cust_pkg_reason',
2936 references => [ 'num' ],
2938 { columns => [ 'feepart' ],
2939 table => 'part_fee',
2941 # can't link billpkgnum, because of voids
2945 'cust_pkg_discount' => {
2947 'pkgdiscountnum', 'serial', '', '', '', '',
2948 'pkgnum', 'int', '', '', '', '',
2949 'discountnum', 'int', '', '', '', '',
2950 'months_used', 'decimal', 'NULL', '7,4', '', '',
2951 'end_date', @date_type, '', '',
2952 'otaker', 'varchar', 'NULL', 32, '', '',
2953 'usernum', 'int', 'NULL', '', '', '',
2954 'disabled', 'char', 'NULL', 1, '', '',
2955 'setuprecur', 'char', 'NULL', 5, '', '',
2957 'primary_key' => 'pkgdiscountnum',
2959 'index' => [ [ 'pkgnum' ], [ 'discountnum' ], [ 'usernum' ], ],
2961 { columns => [ 'pkgnum' ],
2962 table => 'cust_pkg',
2964 { columns => [ 'discountnum' ],
2965 table => 'discount',
2967 { columns => [ 'usernum' ],
2968 table => 'access_user',
2973 'cust_pkg_usage' => {
2975 'pkgusagenum', 'serial', '', '', '', '',
2976 'pkgnum', 'int', '', '', '', '',
2977 'minutes', 'double precision', '', '', '', '',
2978 'pkgusagepart', 'int', '', '', '', '',
2980 'primary_key' => 'pkgusagenum',
2982 'index' => [ [ 'pkgnum' ], [ 'pkgusagepart' ] ],
2984 { columns => [ 'pkgnum' ],
2985 table => 'cust_pkg',
2987 { columns => [ 'pkgusagepart' ],
2988 table => 'part_pkg_usage',
2993 'cdr_cust_pkg_usage' => {
2995 'cdrusagenum', 'bigserial', '', '', '', '',
2996 'acctid', 'bigint', '', '', '', '',
2997 'pkgusagenum', 'int', '', '', '', '',
2998 'minutes', 'double precision', '', '', '', '',
3000 'primary_key' => 'cdrusagenum',
3002 'index' => [ [ 'pkgusagenum' ], [ 'acctid' ] ],
3004 { columns => [ 'acctid' ],
3007 { columns => [ 'pkgusagenum' ],
3008 table => 'cust_pkg_usage',
3013 'cust_bill_pkg_discount' => {
3015 'billpkgdiscountnum', 'serial', '', '', '', '',
3016 'billpkgnum', 'int', '', '', '', '',
3017 'pkgdiscountnum', 'int', '', '', '', '',
3018 'amount', @money_type, '', '',
3019 'months', 'decimal', 'NULL', '7,4', '', '',
3021 'primary_key' => 'billpkgdiscountnum',
3023 'index' => [ [ 'billpkgnum' ], [ 'pkgdiscountnum' ] ],
3025 { columns => [ 'billpkgnum' ],
3026 table => 'cust_bill_pkg',
3028 { columns => [ 'pkgdiscountnum' ],
3029 table => 'cust_pkg_discount',
3034 'cust_bill_pkg_discount_void' => {
3036 'billpkgdiscountnum', 'int', '', '', '', '',
3037 'billpkgnum', 'int', '', '', '', '',
3038 'pkgdiscountnum', 'int', '', '', '', '',
3039 'amount', @money_type, '', '',
3040 'months', 'decimal', 'NULL', '7,4', '', '',
3042 'primary_key' => 'billpkgdiscountnum',
3044 'index' => [ [ 'billpkgnum' ], [ 'pkgdiscountnum' ] ],
3046 { columns => [ 'billpkgnum' ],
3047 table => 'cust_bill_pkg_void',
3049 { columns => [ 'pkgdiscountnum' ],
3050 table => 'cust_pkg_discount',
3057 'discountnum', 'serial', '', '', '', '',
3058 #'agentnum', 'int', 'NULL', '', '', '',
3059 'classnum', 'int', 'NULL', '', '', '',
3060 'name', 'varchar', 'NULL', $char_d, '', '',
3061 'amount', @money_type, '', '',
3062 'percent', 'decimal', '', '7,4', '', '',
3063 'months', 'decimal', 'NULL', '7,4', '', '',
3064 'disabled', 'char', 'NULL', 1, '', '',
3065 'setup', 'char', 'NULL', 1, '', '',
3066 #'linked', 'char', 'NULL', 1, '', '',
3068 'primary_key' => 'discountnum',
3070 'index' => [], # [ 'agentnum' ], ],
3072 { columns => [ 'classnum' ],
3073 table => 'discount_class',
3078 'discount_class' => {
3080 'classnum', 'serial', '', '', '', '',
3081 'classname', 'varchar', '', $char_d, '', '',
3082 #'categorynum', 'int', 'NULL', '', '', '',
3083 'disabled', 'char', 'NULL', 1, '', '',
3085 'primary_key' => 'classnum',
3087 'index' => [ ['disabled'] ],
3092 'refundnum', 'serial', '', '', '', '',
3093 'custnum', 'int', '', '', '', '',
3094 '_date', @date_type, '', '',
3095 'refund', @money_type, '', '',
3096 'currency', 'char', 'NULL', 3, '', '',
3097 'otaker', 'varchar', 'NULL', 32, '', '',
3098 'usernum', 'int', 'NULL', '', '', '',
3099 'reason', 'varchar', 'NULL', $char_d, '', '',
3100 'reasonnum', 'int', 'NULL', '', '', '',
3101 'payby', 'char', '', 4, '', '', # CARD/BILL/COMP, should
3102 # be index into payby
3104 'payinfo', 'varchar', 'NULL', 512, '', '', #see cust_main above
3105 'paycardtype', 'varchar', 'NULL', $char_d, '', '',
3106 'paymask', 'varchar', 'NULL', $char_d, '', '',
3107 'paybatch', 'varchar', 'NULL', $char_d, '', '',
3108 'closed', 'char', 'NULL', 1, '', '',
3109 'source_paynum', 'int', 'NULL', '', '', '', # link to cust_payby, to prevent unapply of gateway-generated refunds
3110 # credit card/EFT fields (formerly in paybatch)
3111 'gatewaynum', 'int', 'NULL', '', '', '', # payment_gateway FK
3112 'processor', 'varchar', 'NULL', $char_d, '', '', # module name
3113 'auth', 'varchar','NULL',16, '', '', # CC auth number
3114 'order_number', 'varchar','NULL',$char_d, '', '', # transaction number
3115 'is_tokenized', 'char', 'NULL', 1, '', '',
3117 'primary_key' => 'refundnum',
3119 'index' => [ ['custnum'], ['_date'], [ 'usernum' ], ['is_tokenized'] ],
3121 { columns => [ 'custnum' ],
3122 table => 'cust_main',
3124 { columns => [ 'usernum' ],
3125 table => 'access_user',
3127 { columns => [ 'reasonnum' ],
3130 { columns => [ 'gatewaynum' ],
3131 table => 'payment_gateway',
3133 { columns => [ 'source_paynum' ],
3134 table => 'cust_pay',
3135 references => [ 'paynum' ],
3140 'cust_credit_refund' => {
3142 'creditrefundnum', 'serial', '', '', '', '',
3143 'crednum', 'int', '', '', '', '',
3144 'refundnum', 'int', '', '', '', '',
3145 'amount', @money_type, '', '',
3146 '_date', @date_type, '', '',
3148 'primary_key' => 'creditrefundnum',
3150 'index' => [ ['crednum'], ['refundnum'] ],
3152 { columns => [ 'crednum' ],
3153 table => 'cust_credit',
3155 { columns => [ 'refundnum' ],
3156 table => 'cust_refund',
3164 'svcnum', 'serial', '', '', '', '',
3165 'pkgnum', 'int', 'NULL', '', '', '',
3166 'svcpart', 'int', '', '', '', '',
3167 'agent_svcid', 'int', 'NULL', '', '', '',
3168 'overlimit', @date_type, '', '',
3170 'primary_key' => 'svcnum',
3172 'index' => [ ['svcnum'], ['pkgnum'], ['svcpart'],
3176 { columns => [ 'pkgnum' ],
3177 table => 'cust_pkg',
3179 { columns => [ 'svcpart' ],
3180 table => 'part_svc',
3185 'cust_svc_option' => {
3187 'optionnum', 'serial', '', '', '', '',
3188 'svcnum', 'int', '', '', '', '',
3189 'optionname', 'varchar', '', $char_d, '', '',
3190 'optionvalue', 'text', 'NULL', '', '', '',
3192 'primary_key' => 'optionnum',
3194 'index' => [ [ 'svcnum' ], [ 'optionname' ] ],
3196 { columns => [ 'svcnum' ],
3197 table => 'cust_svc',
3202 'svc_export_machine' => {
3204 'svcexportmachinenum', 'serial', '', '', '', '',
3205 'svcnum', 'int', '', '', '', '',
3206 'exportnum', 'int', '', '', '', '',
3207 'machinenum', 'int', '', '', '', '',
3209 'primary_key' => 'svcexportmachinenum',
3210 'unique' => [ ['svcnum', 'exportnum'] ],
3213 { columns => [ 'svcnum' ],
3214 table => 'cust_svc',
3216 { columns => [ 'exportnum' ],
3217 table => 'part_export',
3219 { columns => [ 'machinenum' ],
3220 table => 'part_export_machine',
3225 'part_export_machine' => {
3227 'machinenum', 'serial', '', '', '', '',
3228 'exportnum', 'int', '', '', '', '',
3229 'machine', 'varchar', 'NULL', $char_d, '', '',
3230 'disabled', 'char', 'NULL', 1, '', '',
3232 'primary_key' => 'machinenum',
3233 'unique' => [ [ 'exportnum', 'machine' ] ],
3234 'index' => [ [ 'exportnum' ] ],
3236 { columns => [ 'exportnum' ],
3237 table => 'part_export',
3244 'pkgpart', 'serial', '', '', '', '',
3245 'pkgpartbatch', 'varchar', 'NULL', $char_d, '', '',
3246 'pkg', 'varchar', '', 104, '', '',
3247 'comment', 'varchar', 'NULL', 2*$char_d, '', '',
3248 'promo_code', 'varchar', 'NULL', $char_d, '', '',
3249 'freq', 'varchar', '', $char_d, '', '', #billing frequency
3250 'setuptax', 'char', 'NULL', 1, '', '',
3251 'recurtax', 'char', 'NULL', 1, '', '',
3252 'plan', 'varchar', 'NULL', $char_d, '', '',
3253 'disabled', 'char', 'NULL', 1, '', '',
3254 'custom', 'char', 'NULL', 1, '', '',
3255 'taxclass', 'varchar', 'NULL', $char_d, '', '',
3256 'classnum', 'int', 'NULL', '', '', '',
3257 'addon_classnum','int', 'NULL', '', '', '',
3258 'taxproductnum', 'int', 'NULL', '', '', '',
3259 'setup_cost', @money_typen, '', '',
3260 'recur_cost', @money_typen, '', '',
3261 'pay_weight', 'real', 'NULL', '', '', '',
3262 'credit_weight', 'real', 'NULL', '', '', '',
3263 'agentnum', 'int', 'NULL', '', '', '',
3264 'fcc_ds0s', 'int', 'NULL', '', '', '',
3265 'fcc_voip_class','char', 'NULL', 1, '', '',
3266 'no_auto', 'char', 'NULL', 1, '', '',
3267 'recur_show_zero', 'char', 'NULL', 1, '', '',
3268 'setup_show_zero', 'char', 'NULL', 1, '', '',
3269 'successor', 'int', 'NULL', '', '', '',
3270 'family_pkgpart','int', 'NULL', '', '', '',
3271 'delay_start', 'int', 'NULL', '', '', '',
3272 'start_on_hold', 'char', 'NULL', 1, '', '',
3273 'agent_pkgpartid', 'varchar', 'NULL', 20, '', '',
3274 'expire_months', 'int', 'NULL', '', '', '',
3275 'adjourn_months', 'int', 'NULL', '', '', '',
3276 'contract_end_months','int','NULL', '', '', '',
3277 'change_to_pkgpart', 'int', 'NULL', '', '', '',
3279 'primary_key' => 'pkgpart',
3281 'index' => [ [ 'promo_code' ], [ 'disabled' ], [ 'classnum' ],
3282 [ 'agentnum' ], ['no_auto'], ['agent_pkgpartid'],
3285 { columns => [ 'classnum' ],
3286 table => 'pkg_class',
3288 { columns => [ 'addon_classnum' ],
3289 table => 'pkg_class',
3290 references => [ 'classnum' ],
3292 { columns => [ 'taxproductnum' ],
3293 table => 'part_pkg_taxproduct',
3295 { columns => [ 'agentnum' ],
3298 { columns => [ 'successor' ],
3299 table => 'part_pkg',
3300 references => [ 'pkgpart' ],
3302 { columns => [ 'family_pkgpart' ],
3303 table => 'part_pkg',
3304 references => [ 'pkgpart' ],
3306 { columns => [ 'change_to_pkgpart' ],
3307 table => 'part_pkg',
3308 references => [ 'pkgpart' ],
3313 'part_pkg_msgcat' => {
3315 'pkgpartmsgnum', 'serial', '', '', '', '',
3316 'pkgpart', 'int', '', '', '', '',
3317 'locale', 'varchar', '', 16, '', '',
3318 'pkg', 'varchar', '', $char_d, '', '', #longer/no limit?
3319 'comment', 'varchar', 'NULL', 2*$char_d, '', '', #longer/no limit?
3321 'primary_key' => 'pkgpartmsgnum',
3322 'unique' => [ [ 'pkgpart', 'locale' ] ],
3325 { columns => [ 'pkgpart' ],
3326 table => 'part_pkg',
3331 'part_pkg_currency' => {
3333 'pkgcurrencynum', 'serial', '', '', '', '',
3334 'pkgpart', 'int', '', '', '', '',
3335 'currency', 'char', '', 3, '', '',
3336 'optionname', 'varchar', '', $char_d, '', '',
3337 'optionvalue', 'text', '', '', '', '',
3339 'primary_key' => 'pkgcurrencynum',
3340 'unique' => [ [ 'pkgpart', 'currency', 'optionname' ] ],
3341 'index' => [ ['pkgpart'] ],
3343 { columns => [ 'pkgpart' ],
3344 table => 'part_pkg',
3349 'currency_exchange' => {
3351 'currencyratenum', 'serial', '', '', '', '',
3352 'from_currency', 'char', '', 3, '', '',
3353 'to_currency', 'char', '', 3, '', '',
3354 'rate', 'decimal', '', '7,6', '', '',
3356 'primary_key' => 'currencyratenum',
3357 'unique' => [ [ 'from_currency', 'to_currency' ] ],
3361 'part_pkg_usageprice' => {
3363 'usagepricepart', 'serial', '', '', '', '',
3364 'pkgpart', 'int', '', '', '', '',
3365 'price', @money_type, '', '',
3366 'currency', 'char', 'NULL', 3, '', '',
3367 'action', 'varchar', '', $char_d, '', '',
3368 'target', 'varchar', '', $char_d, '', '',
3369 'amount', 'varchar', '', $char_d, '', '',
3371 'primary_key' => 'usagepricepart',
3372 'unique' => [ [ 'pkgpart', 'currency', 'target' ] ],
3373 'index' => [ [ 'pkgpart' ] ],
3375 { columns => [ 'pkgpart' ],
3376 table => 'part_pkg',
3381 'cust_pkg_usageprice' => {
3383 'usagepricenum', 'serial', '', '', '', '',
3384 'pkgnum', 'int', '', '', '', '',
3385 'usagepricepart', 'int', '', '', '', '',
3386 'quantity', 'int', '', '', '', '',
3388 'primary_key' => 'usagepricenum',
3389 'unique' => [ [ 'pkgnum', 'usagepricepart' ] ],
3390 'index' => [ [ 'pkgnum' ] ],
3392 { columns => [ 'pkgnum' ],
3393 table => 'cust_pkg',
3395 { columns => [ 'usagepricepart' ],
3396 table => 'part_pkg_usageprice',
3403 'feepart', 'serial', '', '', '', '',
3404 'itemdesc', 'varchar', '', $char_d, '', '',
3405 'comment', 'varchar', 'NULL', 2*$char_d, '', '',
3406 'disabled', 'char', 'NULL', 1, '', '',
3407 'classnum', 'int', 'NULL', '', '', '',
3408 'taxclass', 'varchar', 'NULL', $char_d, '', '',
3409 'taxproductnum', 'int', 'NULL', '', '', '',
3410 'pay_weight', 'real', 'NULL', '', '', '',
3411 'credit_weight', 'real', 'NULL', '', '', '',
3412 'agentnum', 'int', 'NULL', '', '', '',
3413 'amount', @money_type, '', '',
3414 'percent', 'decimal', '', '7,4', '', '',
3415 'basis', 'varchar', '', 16, '', '',
3416 'minimum', @money_typen, '', '',
3417 'maximum', @money_typen, '', '',
3418 'limit_credit', 'char', 'NULL', 1, '', '',
3419 'setuprecur', 'char', '', 5, '', '',
3420 'taxable', 'char', 'NULL', 1, '', '',
3422 'primary_key' => 'feepart',
3424 'index' => [ [ 'disabled' ], [ 'classnum' ], [ 'agentnum' ]
3427 { columns => [ 'classnum' ],
3428 table => 'pkg_class',
3430 { columns => [ 'taxproductnum' ],
3431 table => 'part_pkg_taxproduct',
3433 { columns => [ 'agentnum' ],
3439 'part_fee_msgcat' => {
3441 'feepartmsgnum', 'serial', '', '', '', '',
3442 'feepart', 'int', '', '', '', '',
3443 'locale', 'varchar', '', 16, '', '',
3444 'itemdesc', 'varchar', '', $char_d, '', '', #longer/no limit?
3445 'comment', 'varchar', 'NULL', 2*$char_d, '', '', #longer/no limit?
3447 'primary_key' => 'feepartmsgnum',
3448 'unique' => [ [ 'feepart', 'locale' ] ],
3451 { columns => [ 'feepart' ],
3452 table => 'part_fee',
3457 'part_fee_usage' => {
3459 'feepartusagenum','serial', '', '', '', '',
3460 'feepart', 'int', '', '', '', '',
3461 'classnum', 'int', '', '', '', '',
3462 'amount', @money_type, '', '',
3463 'percent', 'decimal', '', '7,4', '', '',
3465 'primary_key' => 'feepartusagenum',
3466 'unique' => [ [ 'feepart', 'classnum' ] ],
3469 { columns => [ 'feepart' ],
3470 table => 'part_fee',
3472 { columns => [ 'classnum' ],
3473 table => 'usage_class',
3478 'part_pkg_link' => {
3480 'pkglinknum', 'serial', '', '', '', '',
3481 'src_pkgpart', 'int', '', '', '', '',
3482 'dst_pkgpart', 'int', '', '', '', '',
3483 'link_type', 'varchar', '', $char_d, '', '',
3484 'hidden', 'char', 'NULL', 1, '', '',
3486 'primary_key' => 'pkglinknum',
3487 'unique' => [ ['src_pkgpart','dst_pkgpart','link_type','hidden'] ],
3488 'index' => [ [ 'src_pkgpart' ] ],
3490 { columns => [ 'src_pkgpart' ],
3491 table => 'part_pkg',
3492 references => [ 'pkgpart' ]
3494 { columns => [ 'dst_pkgpart' ],
3495 table => 'part_pkg',
3496 references => [ 'pkgpart' ]
3500 # XXX somewhat borked unique: we don't really want a hidden and unhidden
3501 # it turns out we'd prefer to use svc, bill, and invisibill (or something)
3503 'part_pkg_discount' => {
3505 'pkgdiscountnum', 'serial', '', '', '', '',
3506 'pkgpart', 'int', '', '', '', '',
3507 'discountnum', 'int', '', '', '', '',
3509 'primary_key' => 'pkgdiscountnum',
3510 'unique' => [ [ 'pkgpart', 'discountnum' ] ],
3513 { columns => [ 'pkgpart' ],
3514 table => 'part_pkg',
3516 { columns => [ 'discountnum' ],
3517 table => 'discount',
3522 'part_pkg_taxclass' => {
3524 'taxclassnum', 'serial', '', '', '', '',
3525 'taxclass', 'varchar', '', $char_d, '', '',
3526 'disabled', 'char', 'NULL', 1, '', '',
3528 'primary_key' => 'taxclassnum',
3529 'unique' => [ [ 'taxclass' ] ],
3530 'index' => [ [ 'disabled' ] ],
3533 'part_pkg_taxproduct' => {
3535 'taxproductnum', 'serial', '', '', '', '',
3536 'data_vendor', 'varchar', 'NULL', $char_d, '', '',
3537 'taxproduct', 'varchar', '', $char_d, '', '',
3538 'description', 'varchar', '', 3*$char_d, '', '',
3539 'note', 'text', 'NULL', '', '', '',
3541 'primary_key' => 'taxproductnum',
3542 'unique' => [ [ 'data_vendor', 'taxproduct' ] ],
3546 'part_pkg_taxrate' => {
3548 'pkgtaxratenum', 'serial', '', '', '', '',
3549 'data_vendor', 'varchar', 'NULL', $char_d, '', '', # update source
3550 'geocode', 'varchar', 'NULL', $char_d, '', '', # cch provides 10
3551 'taxproductnum', 'int', '', '', '', '',
3552 'city', 'varchar', 'NULL', $char_d, '', '', # tax_location?
3553 'county', 'varchar', 'NULL', $char_d, '', '',
3554 'state', 'varchar', 'NULL', $char_d, '', '',
3555 'local', 'varchar', 'NULL', $char_d, '', '',
3556 'country', 'char', 'NULL', 2, '', '',
3557 'taxclassnumtaxed', 'int', 'NULL', '', '', '',
3558 'taxcattaxed', 'varchar', 'NULL', $char_d, '', '',
3559 'taxclassnum', 'int', 'NULL', '', '', '',
3560 'effdate', @date_type, '', '',
3561 'taxable', 'char', 'NULL', 1, '', '',
3563 'primary_key' => 'pkgtaxratenum',
3565 'index' => [ [ 'data_vendor', 'geocode', 'taxproductnum' ] ],
3567 { columns => [ 'taxproductnum' ],
3568 table => 'part_pkg_taxproduct',
3570 { columns => [ 'taxclassnumtaxed' ],
3571 table => 'tax_class',
3572 references => [ 'taxclassnum' ],
3574 { columns => [ 'taxclassnum' ],
3575 table => 'tax_class',
3580 'part_pkg_taxoverride' => {
3582 'taxoverridenum', 'serial', '', '', '', '',
3583 'pkgpart', 'int', '', '', '', '',
3584 'taxclassnum', 'int', '', '', '', '',
3585 'usage_class', 'varchar', 'NULL', $char_d, '', '',
3587 'primary_key' => 'taxoverridenum',
3589 'index' => [ [ 'pkgpart' ], [ 'taxclassnum' ] ],
3591 { columns => [ 'pkgpart' ],
3592 table => 'part_pkg',
3594 { columns => [ 'taxclassnum' ],
3595 table => 'tax_class',
3602 # 'titlenum', 'int', '', '',
3603 # 'title', 'varchar', '', $char_d,
3605 # 'primary_key' => 'titlenum',
3606 # 'unique' => [ [] ],
3607 # 'index' => [ [] ],
3612 'pkgsvcnum', 'serial', '', '', '', '',
3613 'pkgpart', 'int', '', '', '', '',
3614 'svcpart', 'int', '', '', '', '',
3615 'quantity', 'int', '', '', '', '',
3616 'primary_svc', 'char', 'NULL', 1, '', '',
3617 'hidden', 'char', 'NULL', 1, '', '',
3618 'bulk_skip', 'char', 'NULL', 1, '', '',
3619 'provision_hold', 'char', 'NULL', 1, '', '',
3621 'primary_key' => 'pkgsvcnum',
3622 'unique' => [ ['pkgpart', 'svcpart'] ],
3623 'index' => [ ['pkgpart'], ['quantity'] ],
3625 { columns => [ 'pkgpart' ],
3626 table => 'part_pkg',
3628 { columns => [ 'svcpart' ],
3629 table => 'part_svc',
3634 'part_referral' => {
3636 'refnum', 'serial', '', '', '', '',
3637 'referral', 'varchar', '', $char_d, '', '',
3638 'disabled', 'char', 'NULL', 1, '', '',
3639 'agentnum', 'int', 'NULL', '', '', '',
3640 'title', 'varchar', 'NULL', $char_d, '', '',
3642 'primary_key' => 'refnum',
3643 'unique' => [ ['agentnum', 'title'] ],
3644 'index' => [ ['disabled'], ['agentnum'], ],
3646 { columns => [ 'agentnum' ],
3654 'svcpart', 'serial', '', '', '', '',
3655 'svc', 'varchar', '', $char_d, '', '',
3656 'svcdb', 'varchar', '', $char_d, '', '',
3657 'disabled', 'char', 'NULL', 1, '', '',
3658 'preserve', 'char', 'NULL', 1, '', '',
3659 'selfservice_access', 'varchar', 'NULL', $char_d, '', '',
3660 'classnum', 'int', 'NULL', '', '', '',
3661 'restrict_edit_password','char', 'NULL', 1, '', '',
3662 'has_router', 'char', 'NULL', 1, '', '',
3664 'primary_key' => 'svcpart',
3666 'index' => [ [ 'disabled' ] ],
3668 { columns => [ 'classnum' ],
3669 table => 'part_svc_class',
3674 'part_svc_column' => {
3676 'columnnum', 'serial', '', '', '', '',
3677 'svcpart', 'int', '', '', '', '',
3678 'columnname', 'varchar', '', 64, '', '',
3679 'columnlabel', 'varchar', 'NULL', $char_d, '', '',
3680 'columnvalue', 'varchar', 'NULL', 512, '', '',
3681 'columnflag', 'char', 'NULL', 1, '', '',
3682 'required', 'char', 'NULL', 1, '', '',
3684 'primary_key' => 'columnnum',
3685 'unique' => [ [ 'svcpart', 'columnname' ] ],
3686 'index' => [ [ 'svcpart' ] ],
3688 { columns => [ 'svcpart' ],
3689 table => 'part_svc',
3694 'part_svc_class' => {
3696 'classnum', 'serial', '', '', '', '',
3697 'classname', 'varchar', '', $char_d, '', '',
3698 'disabled', 'char', 'NULL', 1, '', '',
3700 'primary_key' => 'classnum',
3702 'index' => [ ['disabled'] ],
3705 'part_svc_link' => {
3707 'svclinknum', 'serial', '', '', '', '',
3708 #'linkname', 'varchar', 'NULL', $char_d, '', '',
3709 'agentnum', 'int', 'NULL', '', '', '',
3710 'src_svcpart', 'int', '', '', '', '',
3711 'dst_svcpart', 'int', '', '', '', '',
3712 'link_type', 'varchar', '', $char_d, '', '',
3713 'disabled', 'char', 'NULL', 1, '', '',
3715 'primary_key' => 'svclinknum',
3716 'unique' => [ ['agentnum','src_svcpart','dst_svcpart','link_type'] ],
3717 'index' => [ [ 'src_svcpart' ], [ 'src_svcpart', 'link_type' ], [ 'disabled' ] ],
3719 { columns => [ 'src_svcpart' ],
3720 table => 'part_svc',
3721 references => [ 'svcpart' ]
3723 { columns => [ 'dst_svcpart' ],
3724 table => 'part_svc',
3725 references => [ 'svcpart' ]
3730 'part_svc_msgcat' => {
3732 'svcpartmsgnum', 'serial', '', '', '', '',
3733 'svcpart', 'int', '', '', '', '',
3734 'locale', 'varchar', '', 16, '', '',
3735 'svc', 'varchar', '', $char_d, '', '',
3737 'primary_key' => 'svcpartmsgnum',
3738 'unique' => [ [ 'svcpart', 'locale' ] ],
3741 { columns => [ 'svcpart' ],
3742 table => 'part_svc',
3748 #(this should be renamed to part_pop)
3751 'popnum', 'serial', '', '', '', '',
3752 'city', 'varchar', '', $char_d, '', '',
3753 'state', 'varchar', '', $char_d, '', '',
3754 'ac', 'char', '', 3, '', '',
3755 'exch', 'char', '', 3, '', '',
3756 'loc', 'char', 'NULL', 4, '', '', #NULL for legacy purposes
3758 'primary_key' => 'popnum',
3760 'index' => [ [ 'state' ] ],
3763 'part_pop_local' => {
3765 'localnum', 'serial', '', '', '', '',
3766 'popnum', 'int', '', '', '', '',
3767 'city', 'varchar', 'NULL', $char_d, '', '',
3768 'state', 'char', 'NULL', 2, '', '',
3769 'npa', 'char', '', 3, '', '',
3770 'nxx', 'char', '', 3, '', '',
3772 'primary_key' => 'localnum',
3774 'index' => [ [ 'npa', 'nxx' ], [ 'popnum' ] ],
3776 { columns => [ 'popnum' ],
3777 table => 'svc_acct_pop',
3784 'qualnum', 'serial', '', '', '', '',
3785 'custnum', 'int', 'NULL', '', '', '',
3786 'prospectnum', 'int', 'NULL', '', '', '',
3787 'locationnum', 'int', 'NULL', '', '', '',
3788 'phonenum', 'varchar', 'NULL', 24, '', '',
3789 'exportnum', 'int', 'NULL', '', '', '',
3790 'vendor_qual_id', 'varchar', 'NULL', $char_d, '', '',
3791 'status', 'char', '', 1, '', '',
3793 'primary_key' => 'qualnum',
3795 'index' => [ ['locationnum'], ['custnum'], ['prospectnum'],
3796 ['phonenum'], ['vendor_qual_id'],
3799 { columns => [ 'custnum' ],
3800 table => 'cust_main',
3802 { columns => [ 'prospectnum' ],
3803 table => 'prospect_main',
3805 { columns => [ 'locationnum' ],
3806 table => 'cust_location',
3808 { columns => [ 'exportnum' ],
3809 table => 'part_export',
3816 'optionnum', 'serial', '', '', '', '',
3817 'qualnum', 'int', '', '', '', '',
3818 'optionname', 'varchar', '', $char_d, '', '',
3819 'optionvalue', 'text', 'NULL', '', '', '',
3821 'primary_key' => 'optionnum',
3825 { columns => [ 'qualnum' ],
3833 'svcnum', 'int', '', '', '', '',
3834 'username', 'varchar', '', $username_len, '', '',
3835 '_password', 'varchar', 'NULL', 512, '', '',
3836 '_password_encoding', 'varchar', 'NULL', $char_d, '', '',
3837 'sec_phrase', 'varchar', 'NULL', $char_d, '', '',
3838 'popnum', 'int', 'NULL', '', '', '',
3839 'sectornum', 'int', 'NULL', '', '', '',
3840 'uid', 'int', 'NULL', '', '', '',
3841 'gid', 'int', 'NULL', '', '', '',
3842 'finger', 'varchar', 'NULL', 2*$char_d, '', '',
3843 'dir', 'varchar', 'NULL', $char_d, '', '',
3844 'shell', 'varchar', 'NULL', $char_d, '', '',
3845 'quota', 'varchar', 'NULL', $char_d, '', '',
3846 'slipip', 'varchar', 'NULL', 15, '', '', #four TINYINTs, bah.
3848 'routernum', 'int', 'NULL', '', '', '',
3849 'blocknum', 'int', 'NULL', '', '', '',
3850 'seconds', 'int', 'NULL', '', '', '', #uhhhh
3851 'seconds_threshold', 'int', 'NULL', '', '', '',
3852 'upbytes', 'bigint', 'NULL', '', '', '',
3853 'upbytes_threshold', 'bigint', 'NULL', '', '', '',
3854 'downbytes', 'bigint', 'NULL', '', '', '',
3855 'downbytes_threshold', 'bigint', 'NULL', '', '', '',
3856 'totalbytes','bigint', 'NULL', '', '', '',
3857 'totalbytes_threshold', 'bigint', 'NULL', '', '', '',
3858 'domsvc', 'int', '', '', '', '',
3859 'pbxsvc', 'int', 'NULL', '', '', '',
3860 'last_login', @date_type, '', '',
3861 'last_logout', @date_type, '', '',
3862 #cardfortress field(s)
3863 'cf_privatekey', 'text', 'NULL', '', '', '',
3864 #communigate pro fields (quota = MaxAccountSize)
3865 'cgp_aliases', 'varchar', 'NULL', 255, '', '',
3867 'cgp_type', 'varchar', 'NULL', $char_d, '', '', #AccountType
3868 'file_quota', 'varchar', 'NULL', $char_d, '', '', #MaxWebSize
3869 'file_maxnum', 'varchar', 'NULL', $char_d, '', '', #MaxWebFiles
3870 'file_maxsize', 'varchar', 'NULL', $char_d, '', '', #MaxFileSize
3871 'cgp_accessmodes', 'varchar', 'NULL', 255, '', '', #AccessModes
3872 'password_selfchange','char', 'NULL', 1, '', '', #PWDAllowed
3873 'password_recover', 'char', 'NULL', 1, 'Y','', #PasswordRecovery
3874 'cgp_rulesallowed','varchar', 'NULL', $char_d, '', '', #RulesAllowed
3875 'cgp_rpopallowed', 'char', 'NULL', 1, '', '', #RPOPAllowed
3876 'cgp_mailtoall', 'char', 'NULL', 1, '', '', #MailToAll
3877 'cgp_addmailtrailer', 'char', 'NULL', 1, '', '', #AddMailTrailer
3878 'cgp_archiveafter', 'int', 'NULL', '', '', '', #ArchiveMessagesAfter
3881 'cgp_deletemode', 'varchar', 'NULL', $char_d, '', '',#DeleteMode
3882 'cgp_emptytrash', 'varchar', 'NULL', $char_d, '', '',#EmptyTrash
3883 'cgp_language', 'varchar', 'NULL', $char_d, '', '',#Language
3884 'cgp_timezone', 'varchar', 'NULL', $char_d, '', '',#TimeZone
3885 'cgp_skinname', 'varchar', 'NULL', $char_d, '', '',#SkinName
3886 'cgp_prontoskinname', 'varchar', 'NULL', $char_d, '', '',#ProntoSkinName
3887 'cgp_sendmdnmode', 'varchar', 'NULL', $char_d, '', '',#SendMDNMode
3892 'primary_key' => 'svcnum',
3893 #'unique' => [ [ 'username', 'domsvc' ] ],
3895 'index' => [ ['username'], ['domsvc'], ['pbxsvc'] ],
3897 { columns => [ 'svcnum' ],
3898 table => 'cust_svc',
3900 { columns => [ 'popnum' ],
3901 table => 'svc_acct_pop',
3903 { columns => [ 'sectornum' ],
3904 table => 'tower_sector',
3906 { columns => [ 'routernum' ],
3909 { columns => [ 'blocknum' ],
3910 table => 'addr_block',
3912 { columns => [ 'domsvc' ],
3913 table => 'svc_domain', #'cust_svc',
3914 references => [ 'svcnum' ],
3916 { columns => [ 'pbxsvc' ],
3917 table => 'svc_pbx', #'cust_svc',
3918 references => [ 'svcnum' ],
3923 'acct_rt_transaction' => {
3925 'svcrtid', 'int', '', '', '', '', #why am i not a serial
3926 'svcnum', 'int', '', '', '', '',
3927 'transaction_id', 'int', '', '', '', '',
3928 '_date', @date_type, '', '',
3929 'seconds', 'int', '', '', '', '', #uhhhh
3930 'support', 'int', '', '', '', '',
3932 'primary_key' => 'svcrtid',
3934 'index' => [ ['svcnum', 'transaction_id'] ],
3936 # problems w/deleted services, and as per below, this
3937 # is our internal hack, not a customer-facing feature
3938 #{ columns => [ 'svcnum' ],
3939 # table => 'svc_acct', #'cust_svc',
3942 # 1. RT tables aren't part of our data structure, so
3943 # we can't make sure Queue is created already
3944 # 2. This is our internal hack for time tracking, not
3945 # a user-facing feature
3946 #{ columns => [ 'transaction_id' ],
3947 # table => 'Transaction',
3948 # references => [ 'id' ],
3955 # 'svcnum', 'int', '', '',
3956 # 'amount', @money_type,
3958 # 'primary_key' => 'svcnum',
3959 # 'unique' => [ [] ],
3960 # 'index' => [ [] ],
3965 'svcnum', 'int', '', '', '', '',
3966 'domain', 'varchar', '', $char_d, '', '',
3967 'suffix', 'varchar', 'NULL', $char_d, '', '',
3968 'catchall', 'int', 'NULL', '', '', '',
3969 'parent_svcnum', 'int', 'NULL', '', '', '',
3970 'quota', 'varchar', 'NULL', $char_d, '', '',
3973 'registrarnum', 'int', 'NULL', '', '', '',
3974 'registrarkey', 'varchar', 'NULL', 512, '', '',
3975 'setup_date', @date_type, '', '',
3976 'renewal_interval', 'int', 'NULL', '', '', '',
3977 'expiration_date', @date_type, '', '',
3979 #some weird shit australia-specific shit? yuck.. seems totally unused
3980 'au_registrant_name', 'varchar', 'NULL', $char_d, '', '',
3981 'au_eligibility_type', 'varchar', 'NULL', $char_d, '', '',
3983 #communigate pro fields (quota = MaxAccountSize)
3984 'max_accounts', 'int', 'NULL', '', '', '',
3985 'trailer', 'text', 'NULL', '', '', '',
3986 'cgp_aliases', 'varchar', 'NULL', 255, '', '',
3987 'cgp_accessmodes','varchar','NULL', 255, '', '', #DomainAccessModes
3988 'cgp_certificatetype','varchar','NULL', $char_d, '', '',
3990 #(account default) settings
3991 'acct_def_password_selfchange', 'char', 'NULL', 1, '', '',
3992 'acct_def_password_recover', 'char', 'NULL', 1, 'Y', '',
3993 'acct_def_cgp_accessmodes', 'varchar', 'NULL', 255, '', '',
3994 'acct_def_quota', 'varchar', 'NULL', $char_d, '', '',
3995 'acct_def_file_quota', 'varchar', 'NULL', $char_d, '', '',
3996 'acct_def_file_maxnum', 'varchar', 'NULL', $char_d, '', '',
3997 'acct_def_file_maxsize', 'varchar', 'NULL', $char_d, '', '',
3998 'acct_def_cgp_rulesallowed', 'varchar', 'NULL', $char_d, '', '',
3999 'acct_def_cgp_rpopallowed', 'char', 'NULL', 1, '', '',
4000 'acct_def_cgp_mailtoall', 'char', 'NULL', 1, '', '',
4001 'acct_def_cgp_addmailtrailer', 'char', 'NULL', 1, '', '',
4002 'acct_def_cgp_archiveafter', 'int', 'NULL', '', '', '',
4004 #(account default) preferences
4005 'acct_def_cgp_deletemode', 'varchar', 'NULL', $char_d, '', '',
4006 'acct_def_cgp_emptytrash', 'varchar', 'NULL', $char_d, '', '',
4007 'acct_def_cgp_language', 'varchar', 'NULL', $char_d, '', '',
4008 'acct_def_cgp_timezone', 'varchar', 'NULL', $char_d, '', '',
4009 'acct_def_cgp_skinname', 'varchar', 'NULL', $char_d, '', '',
4010 'acct_def_cgp_prontoskinname', 'varchar', 'NULL', $char_d, '', '',
4011 'acct_def_cgp_sendmdnmode', 'varchar', 'NULL', $char_d, '', '',
4013 'primary_key' => 'svcnum',
4015 'index' => [ ['domain'] ],
4017 { columns => [ 'svcnum' ],
4018 table => 'cust_svc',
4020 { columns => [ 'catchall' ],
4021 table => 'svc_acct',
4022 references => [ 'svcnum' ],
4024 { columns => [ 'parent_svcnum' ],
4025 table => 'cust_svc',
4026 references => [ 'svcnum' ],
4028 { columns => [ 'registrarnum' ],
4029 table => 'registrar',
4036 'svcnum', 'int', '', '', '', '',
4037 'pushed', 'int', 'NULL', '', '', '',
4038 'desired_due_date', 'int', 'NULL', '', '', '',
4039 'due_date', 'int', 'NULL', '', '', '',
4040 'vendor_order_id', 'varchar', 'NULL', $char_d, '', '',
4041 'vendor_qual_id', 'varchar', 'NULL', $char_d, '', '',
4042 'vendor_order_type', 'varchar', 'NULL', $char_d, '', '',
4043 'vendor_order_status', 'varchar', 'NULL', $char_d, '', '',
4044 'first', 'varchar', 'NULL', $char_d, '', '',
4045 'last', 'varchar', 'NULL', $char_d, '', '',
4046 'company', 'varchar', 'NULL', $char_d, '', '',
4047 'phonenum', 'varchar', 'NULL', 24, '', '',
4048 'gateway_access_number', 'varchar', 'NULL', 24, '', '',
4049 'loop_type', 'char', 'NULL', 1, '', '',
4050 'local_voice_provider', 'varchar', 'NULL', $char_d, '', '',
4051 'circuitnum', 'varchar', 'NULL', $char_d, '', '',
4052 'rate_band', 'varchar', 'NULL', $char_d, '', '',
4053 'vpi', 'int', 'NULL', '', '', '',
4054 'vci', 'int', 'NULL', '', '', '',
4055 'isp_chg', 'char', 'NULL', 1, '', '',
4056 'isp_prev', 'varchar', 'NULL', $char_d, '', '',
4057 'username', 'varchar', 'NULL', $char_d, '', '',
4058 'password', 'varchar', 'NULL', $char_d, '', '',
4059 'staticips', 'text', 'NULL', '', '', '',
4060 'monitored', 'char', 'NULL', 1, '', '',
4061 'last_pull', 'int', 'NULL', '', '', '',
4063 'primary_key' => 'svcnum',
4065 'index' => [ ['phonenum'], ['vendor_order_id'] ],
4067 { columns => [ 'svcnum' ],
4068 table => 'cust_svc',
4075 'devicenum', 'serial', '', '', '', '',
4076 #part_device? or our own part_dsl_device?
4077 #'devicepart', 'int', '', '', '', '',
4078 'svcnum', 'int', '', '', '', '',
4079 'mac_addr', 'varchar', '', 12, '', '',
4081 'primary_key' => 'devicenum',
4082 'unique' => [ [ 'mac_addr' ], ],
4083 'index' => [ [ 'svcnum' ], ], # [ 'devicepart' ] ],
4085 { columns => [ 'svcnum' ],
4093 'notenum', 'serial', '', '', '', '',
4094 'svcnum', 'int', '', '', '', '',
4095 'author', 'varchar', 'NULL', $char_d, '', '',
4096 'priority', 'char', 'NULL', 1, '', '',
4097 '_date', 'int', 'NULL', '', '', '',
4098 'note', 'text', '', '', '', '',
4100 'primary_key' => 'notenum',
4102 'index' => [ ['svcnum'] ],
4104 { columns => [ 'svcnum' ],
4112 'svcnum', 'int', '', '', '', '',
4113 'acctnum', 'varchar', '', 16, '', '',
4114 'installdate', @date_type, '', '',
4115 'note', 'text', 'NULL', '', '', '',
4117 'primary_key' => 'svcnum',
4121 { columns => [ 'svcnum' ],
4122 table => 'cust_svc',
4129 'svcnum', 'int', '', '', '', '',
4130 'typenum', 'int', '', '', '', '',
4131 'serial', 'varchar', 'NULL', $char_d, '', '',
4132 'ip_addr', 'varchar', 'NULL', 40, '', '',
4133 'hw_addr', 'varchar', 'NULL', 12, '', '',
4134 'smartcard','varchar', 'NULL', 30, '', '',
4135 'statusnum','int', 'NULL', '', '', '',
4136 'note', 'text', 'NULL', '', '', '',
4138 'primary_key' => 'svcnum',
4139 'unique' => [ ['typenum', 'serial'], ['ip_addr'], ['hw_addr'] ],
4142 { columns => [ 'svcnum' ],
4143 table => 'cust_svc',
4145 { columns => [ 'typenum' ],
4146 table => 'hardware_type',
4148 { columns => [ 'statusnum' ],
4149 table => 'hardware_status',
4154 'hardware_class' => {
4156 'classnum', 'serial', '', '', '', '',
4157 'classname', 'varchar', '', $char_d, '', '',
4159 'primary_key' => 'classnum',
4164 'hardware_type' => {
4166 'typenum', 'serial', '', '', '', '',
4167 'classnum', 'int', '', '', '', '',
4168 'model', 'varchar', '', $char_d, '', '',
4169 'revision','varchar', 'NULL', $char_d, '', '',
4171 'primary_key' => 'typenum',
4172 'unique' => [ [ 'classnum', 'model', 'revision' ] ],
4175 { columns => [ 'classnum' ],
4176 table => 'hardware_class',
4181 'hardware_status' => {
4183 'statusnum', 'serial', '', '', '', '',
4184 'label' ,'varchar', '', $char_d, '', '',
4185 'disabled', 'char', 'NULL', 1, '', '',
4187 'primary_key' => 'statusnum',
4192 'domain_record' => {
4194 'recnum', 'serial', '', '', '', '',
4195 'svcnum', 'int', '', '', '', '',
4196 'reczone', 'varchar', '', 255, '', '',
4197 'recaf', 'char', '', 2, '', '',
4198 'rectype', 'varchar', '', 5, '', '',
4199 'recdata', 'varchar', '', 255, '', '',
4200 'ttl', 'int', 'NULL', '', '', '',
4202 'primary_key' => 'recnum',
4204 'index' => [ ['svcnum'] ],
4206 { columns => [ 'svcnum' ],
4207 table => 'svc_domain',
4214 'registrarnum', 'serial', '', '', '', '',
4215 'registrarname', 'varchar', '', $char_d, '', '',
4217 'primary_key' => 'registrarnum',
4224 'rulenum', 'serial', '', '', '', '',
4225 'name', 'varchar', '', $char_d, '', '',
4226 'comment', 'varchar', 'NULL', $char_d, '', '',
4227 'svcnum', 'int', '', '', '', '',
4228 'priority', 'int', '', '', '', '',
4230 'primary_key' => 'rulenum',
4231 'unique' => [ [ 'svcnum', 'name' ] ],
4232 'index' => [ [ 'svcnum' ] ],
4234 { columns => [ 'svcnum' ],
4235 table => 'cust_svc', #svc_acct / svc_domain
4240 'cgp_rule_condition' => {
4242 'ruleconditionnum', 'serial', '', '', '', '',
4243 'conditionname', 'varchar', '', $char_d, '', '',
4244 'op', 'varchar', 'NULL', $char_d, '', '',
4245 'params', 'varchar', 'NULL', 255, '', '',
4246 'rulenum', 'int', '', '', '', '',
4248 'primary_key' => 'ruleconditionnum',
4250 'index' => [ [ 'rulenum' ] ],
4252 { columns => [ 'rulenum' ],
4253 table => 'cgp_rule',
4258 'cgp_rule_action' => {
4260 'ruleactionnum', 'serial', '', '', '', '',
4261 'action', 'varchar', '', $char_d, '', '',
4262 'params', 'varchar', 'NULL', 255, '', '',
4263 'rulenum', 'int', '', '', '', '',
4265 'primary_key' => 'ruleactionnum',
4267 'index' => [ [ 'rulenum' ] ],
4269 { columns => [ 'rulenum' ],
4270 table => 'cgp_rule',
4277 'svcnum', 'int', '', '', '', '',
4278 'srcsvc', 'int', 'NULL', '', '', '',
4279 'src', 'varchar', 'NULL', 255, '', '',
4280 'dstsvc', 'int', 'NULL', '', '', '',
4281 'dst', 'varchar', 'NULL', 255, '', '',
4283 'primary_key' => 'svcnum',
4285 'index' => [ ['srcsvc'], ['dstsvc'] ],
4287 { columns => [ 'svcnum' ],
4288 table => 'cust_svc',
4290 { columns => [ 'srcsvc' ],
4291 table => 'svc_acct',
4292 references => [ 'svcnum' ]
4294 { columns => [ 'dstsvc' ],
4295 table => 'svc_acct',
4296 references => [ 'svcnum' ]
4303 'svcnum', 'int', '', '', '', '',
4304 'recnum', 'int', '', '', '', '',
4305 'usersvc', 'int', 'NULL', '', '', '',
4306 'config', 'text', 'NULL', '', '', '',
4308 'primary_key' => 'svcnum',
4312 { columns => [ 'svcnum' ],
4313 table => 'cust_svc',
4315 { columns => [ 'recnum' ],
4316 table => 'domain_record',
4318 { columns => [ 'usersvc' ],
4319 table => 'svc_acct',
4320 references => [ 'svcnum' ]
4327 # 'svcnum', 'int', '', '',
4328 # 'svcnum', 'int', '', '',
4329 # 'svcnum', 'int', '', '',
4330 # 'worker', 'varchar', '', $char_d,
4331 # '_date', @date_type,
4333 # 'primary_key' => 'svcnum',
4334 # 'unique' => [ [] ],
4335 # 'index' => [ [] ],
4338 'prepay_credit' => {
4340 'prepaynum', 'serial', '', '', '', '',
4341 'identifier', 'varchar', '', $char_d, '', '',
4342 'amount', @money_type, '', '',
4343 'seconds', 'int', 'NULL', '', '', '',
4344 'upbytes', 'bigint', 'NULL', '', '', '',
4345 'downbytes', 'bigint', 'NULL', '', '', '',
4346 'totalbytes', 'bigint', 'NULL', '', '', '',
4347 'agentnum', 'int', 'NULL', '', '', '',
4349 'primary_key' => 'prepaynum',
4350 'unique' => [ ['identifier'] ],
4351 'index' => [ ['agentnum'] ],
4353 { columns => [ 'agentnum' ],
4361 'portnum', 'serial', '', '', '', '',
4362 'ip', 'varchar', 'NULL', 15, '', '',
4363 'nasport', 'int', 'NULL', '', '', '',
4364 'nasnum', 'int', '', '', '', '',
4366 'primary_key' => 'portnum',
4370 { columns => [ 'nasnum' ],
4378 'nasnum', 'serial', '', '', '', '',
4379 'nasname', 'varchar', '', 128, '', '',
4380 'shortname', 'varchar', 'NULL', 32, '', '',
4381 'type', 'varchar', '', 30, 'other', '',
4382 'ports', 'int', 'NULL', '', '', '',
4383 'secret', 'varchar', '', 60, 'secret', '',
4384 'server', 'varchar', 'NULL', 64, '', '',
4385 'community', 'varchar', 'NULL', 50, '', '',
4386 'description', 'varchar', '', 200, 'RADIUS Client', '',
4387 'svcnum', 'int', 'NULL', '', '', '',
4389 'primary_key' => 'nasnum',
4390 'unique' => [ [ 'nasname' ], ],
4393 { columns => [ 'svcnum' ],
4394 table => 'svc_broadband',#no? could be _acct?
4395 #remove or cust_svc?
4402 'exportnasnum', 'serial', '', '', '', '',
4403 'exportnum', 'int', '', '', '', '',
4404 'nasnum', 'int', '', '', '', '',
4406 'primary_key' => 'exportnasnum',
4407 'unique' => [ [ 'exportnum', 'nasnum' ] ],
4408 'index' => [ [ 'exportnum' ], [ 'nasnum' ] ],
4410 { columns => [ 'exportnum' ],
4411 table => 'part_export',
4413 { columns => [ 'nasnum' ],
4421 'jobnum', 'bigserial', '', '', '', '',
4422 'job', 'varchar', '', 512, '', '',
4423 '_date', 'int', '', '', '', '',
4424 'status', 'varchar', '', $char_d, '', '',
4425 'statustext', 'text', 'NULL', '', '', '',
4426 'svcnum', 'int', 'NULL', '', '', '',
4427 'custnum', 'int', 'NULL', '', '', '',
4428 'secure', 'char', 'NULL', 1, '', '',
4429 'priority', 'int', 'NULL', '', '', '',
4430 'usernum', 'int', 'NULL', '', '', '',
4432 'primary_key' => 'jobnum',
4434 'index' => [ [ 'secure' ], [ 'priority' ],
4435 [ 'job' ], [ 'svcnum' ], [ 'custnum' ], [ 'status' ],
4438 # { columns => [ 'svcnum' ],
4439 # table => 'cust_svc',
4441 { columns => [ 'custnum' ],
4442 table => 'cust_main',
4444 { columns => [ 'usernum' ],
4445 table => 'access_user',
4452 'argnum', 'bigserial', '', '', '', '',
4453 'jobnum', 'bigint', '', '', '', '',
4454 'frozen', 'char', 'NULL', 1, '', '',
4455 'arg', 'text', 'NULL', '', '', '',
4457 'primary_key' => 'argnum',
4459 'index' => [ [ 'jobnum' ] ],
4461 { columns => [ 'jobnum' ],
4463 on_delete => 'CASCADE',
4470 'dependnum', 'bigserial', '', '', '', '',
4471 'jobnum', 'bigint', '', '', '', '',
4472 'depend_jobnum', 'bigint', '', '', '', '',
4474 'primary_key' => 'dependnum',
4476 'index' => [ [ 'jobnum' ], [ 'depend_jobnum' ] ],
4478 { columns => [ 'jobnum' ],
4481 { columns => [ 'depend_jobnum' ],
4483 references => [ 'jobnum' ],
4484 on_delete => 'CASCADE',
4491 'statnum', 'bigserial', '', '', '', '',
4492 'jobnum', 'bigint', '', '', '', '',
4493 'job', 'varchar', '', 512, '', '',
4494 'custnum', 'int', 'NULL', '', '', '',
4495 'insert_date', @date_type, '', '',
4496 'start_date', @date_type, '', '',
4497 'end_date', @date_type, '', '',
4499 'primary_key' => 'statnum',
4500 'unique' => [], #[ ['jobnum'] ],
4506 'exportsvcnum' => 'serial', '', '', '', '',
4507 'exportnum' => 'int', '', '', '', '',
4508 'svcpart' => 'int', '', '', '', '',
4509 'role' => 'varchar', 'NULL', 16, '', '',
4511 'primary_key' => 'exportsvcnum',
4512 'unique' => [ [ 'exportnum', 'svcpart' ] ],
4513 'index' => [ [ 'exportnum' ], [ 'svcpart' ] ],
4515 { columns => [ 'exportnum' ],
4516 table => 'part_export',
4518 { columns => [ 'svcpart' ],
4519 table => 'part_svc',
4524 'export_cust_svc' => {
4526 'exportcustsvcnum', 'serial', '', '', '', '',
4527 'exportnum', 'int', '', '', '', '',
4528 'svcnum', 'int', '', '', '', '',
4529 'remoteid', 'varchar', '', 512, '', '',
4531 'primary_key' => 'exportcustsvcnum',
4532 'unique' => [ [ 'exportnum', 'svcnum' ] ],
4533 'index' => [ [ 'exportnum', 'svcnum' ] ],
4535 { columns => [ 'exportnum' ],
4536 table => 'part_export',
4538 { columns => [ 'svcnum' ],
4539 table => 'cust_svc',
4544 'export_device' => {
4546 'exportdevicenum' => 'serial', '', '', '', '',
4547 'exportnum' => 'int', '', '', '', '',
4548 'devicepart' => 'int', '', '', '', '',
4550 'primary_key' => 'exportdevicenum',
4551 'unique' => [ [ 'exportnum', 'devicepart' ] ],
4552 'index' => [ [ 'exportnum' ], [ 'devicepart' ] ],
4554 { columns => [ 'exportnum' ],
4555 table => 'part_export',
4557 { columns => [ 'devicepart' ],
4558 table => 'part_device',
4565 'exportnum', 'serial', '', '', '', '',
4566 'exportname', 'varchar', 'NULL', $char_d, '', '',
4567 'machine', 'varchar', 'NULL', $char_d, '', '',
4568 'exporttype', 'varchar', '', $char_d, '', '',
4569 'nodomain', 'char', 'NULL', 1, '', '',
4570 'default_machine','int', 'NULL', '', '', '',
4571 'no_suspend', 'char', 'NULL', 1, '', '',
4572 # could also have 'no_insert', 'no_replace', etc.
4574 'primary_key' => 'exportnum',
4576 'index' => [ [ 'machine' ], [ 'exporttype' ] ],
4578 { columns => [ 'default_machine' ],
4579 table => 'part_export_machine',
4580 references => [ 'machinenum' ]
4585 'part_export_option' => {
4587 'optionnum', 'serial', '', '', '', '',
4588 'exportnum', 'int', '', '', '', '',
4589 'optionname', 'varchar', '', $char_d, '', '',
4590 'optionvalue', 'text', 'NULL', '', '', '',
4592 'primary_key' => 'optionnum',
4594 'index' => [ [ 'exportnum' ], [ 'optionname' ] ],
4596 { columns => [ 'exportnum' ],
4597 table => 'part_export',
4602 'radius_usergroup' => {
4604 'usergroupnum', 'serial', '', '', '', '',
4605 'svcnum', 'int', '', '', '', '',
4606 'groupname', 'varchar', 'NULL', $char_d, '', '', #deprecated
4607 'groupnum', 'int', 'NULL', '', '', '',
4609 'primary_key' => 'usergroupnum',
4611 'index' => [ [ 'svcnum' ], [ 'groupname' ] ],
4613 { columns => [ 'svcnum' ],
4614 table => 'cust_svc', #svc_acct / svc_broadband
4616 { columns => [ 'groupnum' ],
4617 table => 'radius_group',
4624 'groupnum', 'serial', '', '', '', '',
4625 'groupname', 'varchar', '', $char_d, '', '',
4626 'description', 'varchar', 'NULL', $char_d, '', '',
4627 'priority', 'int', '', '', '1', '',
4628 'speed_up', 'int', 'NULL', '', '', '',
4629 'speed_down', 'int', 'NULL', '', '', '',
4631 'primary_key' => 'groupnum',
4632 'unique' => [ ['groupname'] ],
4638 'attrnum', 'serial', '', '', '', '',
4639 'groupnum', 'int', '', '', '', '',
4640 'attrname', 'varchar', '', $char_d, '', '',
4641 'value', 'varchar', '', 255, '', '',
4642 'attrtype', 'char', '', 1, '', '',
4643 'op', 'char', '', 2, '', '',
4645 'primary_key' => 'attrnum',
4647 'index' => [ ['groupnum'], ],
4649 { columns => [ 'groupnum' ],
4650 table => 'radius_group',
4657 'msgnum', 'serial', '', '', '', '',
4658 'msgcode', 'varchar', '', 255, '', '',
4659 'locale', 'varchar', '', 16, '', '',
4660 'msg', 'text', '', '', '', '',
4662 'primary_key' => 'msgnum',
4663 'unique' => [ [ 'msgcode', 'locale' ] ],
4667 'cust_tax_exempt' => {
4669 'exemptnum', 'serial', '', '', '', '',
4670 'custnum', 'int', '', '', '', '',
4671 'taxnum', 'int', '', '', '', '',
4672 'year', 'int', '', '', '', '',
4673 'month', 'int', '', '', '', '',
4674 'amount', @money_type, '', '',
4676 'primary_key' => 'exemptnum',
4677 'unique' => [ [ 'custnum', 'taxnum', 'year', 'month' ] ],
4680 { columns => [ 'custnum' ],
4681 table => 'cust_main',
4683 { columns => [ 'taxnum' ],
4684 table => 'cust_main_county',
4689 'cust_tax_exempt_pkg' => {
4691 'exemptpkgnum', 'serial', '', '', '', '',
4692 #'custnum', 'int', '', '', '', ''
4693 'billpkgnum', 'int', '', '', '', '',
4694 'taxnum', 'int', '', '', '', '',
4695 'taxtype', 'varchar', 'NULL', $char_d, '', '',
4696 'year', 'int', 'NULL', '', '', '',
4697 'month', 'int', 'NULL', '', '', '',
4698 'creditbillpkgnum', 'int', 'NULL', '', '', '',
4699 'amount', @money_type, '', '',
4700 # exemption type flags
4701 'exempt_cust', 'char', 'NULL', 1, '', '',
4702 'exempt_setup', 'char', 'NULL', 1, '', '',
4703 'exempt_recur', 'char', 'NULL', 1, '', '',
4704 'exempt_cust_taxname', 'char', 'NULL', 1, '', '',
4705 'exempt_monthly', 'char', 'NULL', 1, '', '',
4707 'primary_key' => 'exemptpkgnum',
4709 'index' => [ [ 'taxnum', 'year', 'month' ],
4711 [ 'taxnum', 'taxtype' ],
4712 [ 'creditbillpkgnum' ],
4715 { columns => [ 'billpkgnum' ],
4716 table => 'cust_bill_pkg',
4718 { columns => [ 'creditbillpkgnum' ],
4719 table => 'cust_credit_bill_pkg',
4724 'cust_tax_exempt_pkg_void' => {
4726 'exemptpkgnum', 'int', '', '', '', '',
4727 #'custnum', 'int', '', '', '', ''
4728 'billpkgnum', 'int', '', '', '', '',
4729 'taxnum', 'int', '', '', '', '',
4730 'taxtype', 'varchar', 'NULL', $char_d, '', '',
4731 'year', 'int', 'NULL', '', '', '',
4732 'month', 'int', 'NULL', '', '', '',
4733 'creditbillpkgnum', 'int', 'NULL', '', '', '',
4734 'amount', @money_type, '', '',
4735 # exemption type flags
4736 'exempt_cust', 'char', 'NULL', 1, '', '',
4737 'exempt_setup', 'char', 'NULL', 1, '', '',
4738 'exempt_recur', 'char', 'NULL', 1, '', '',
4739 'exempt_cust_taxname', 'char', 'NULL', 1, '', '',
4740 'exempt_monthly', 'char', 'NULL', 1, '', '',
4742 'primary_key' => 'exemptpkgnum',
4744 'index' => [ [ 'taxnum', 'year', 'month' ],
4746 [ 'taxnum', 'taxtype' ],
4747 [ 'creditbillpkgnum' ],
4750 { columns => [ 'billpkgnum' ],
4751 table => 'cust_bill_pkg_void',
4753 { columns => [ 'taxnum' ],
4754 table => 'cust_main_county',
4756 { columns => [ 'creditbillpkgnum' ],
4757 table => 'cust_credit_bill_pkg',
4764 'routernum', 'serial', '', '', '', '',
4765 'routername', 'varchar', '', $char_d, '', '',
4766 'svcnum', 'int', 'NULL', '', '', '',
4767 'agentnum', 'int', 'NULL', '', '', '',
4768 'manual_addr', 'char', 'NULL', 1, '', '',
4770 'primary_key' => 'routernum',
4774 { columns => [ 'svcnum' ],
4775 table => 'cust_svc', #svc_acct / svc_broadband
4777 { columns => [ 'agentnum' ],
4783 'part_svc_router' => {
4785 'svcrouternum', 'serial', '', '', '', '',
4786 'svcpart', 'int', '', '', '', '',
4787 'routernum', 'int', '', '', '', '',
4789 'primary_key' => 'svcrouternum',
4793 { columns => [ 'svcpart' ],
4794 table => 'part_svc',
4796 { columns => [ 'routernum' ],
4804 'blocknum', 'serial', '', '', '', '',
4805 'routernum', 'int', '', '', '', '',
4806 'ip_gateway', 'varchar', '', 15, '', '',
4807 'ip_netmask', 'int', '', '', '', '',
4808 'agentnum', 'int', 'NULL', '', '', '',
4809 'manual_flag', 'char', 'NULL', 1, '', '',
4811 'primary_key' => 'blocknum',
4812 'unique' => [ [ 'blocknum', 'routernum' ] ],
4815 #{ columns => [ 'routernum' ],
4816 # table => 'router',
4818 { columns => [ 'agentnum' ],
4826 'rangenum', 'serial', '', '', '', '',
4827 'start', 'varchar', '', 15, '', '',
4828 'length', 'int', '', '', '', '',
4829 'status', 'varchar', 'NULL', 32, '', '',
4831 'primary_key' => 'rangenum',
4836 'svc_broadband' => {
4838 'svcnum', 'int', '', '', '', '',
4839 'description', 'varchar', 'NULL', $char_d, '', '',
4840 'routernum', 'int', 'NULL', '', '', '',
4841 'blocknum', 'int', 'NULL', '', '', '',
4842 'sectornum', 'int', 'NULL', '', '', '',
4843 'speed_up', 'int', 'NULL', '', '', '',
4844 'speed_down', 'int', 'NULL', '', '', '',
4845 'ip_addr', 'varchar', 'NULL', 15, '', '',
4846 'mac_addr', 'varchar', 'NULL', 12, '', '',
4847 'authkey', 'varchar', 'NULL', 32, '', '',
4848 'latitude', 'decimal', 'NULL', '10,7', '', '',
4849 'longitude', 'decimal', 'NULL', '10,7', '', '',
4850 'altitude', 'decimal', 'NULL', '', '', '',
4851 'vlan_profile', 'varchar', 'NULL', $char_d, '', '',
4852 'performance_profile', 'varchar', 'NULL', $char_d, '', '',
4853 'plan_id', 'varchar', 'NULL', $char_d, '', '',
4854 'radio_serialnum', 'varchar', 'NULL', $char_d, '', '',
4855 'radio_location', 'varchar', 'NULL', 2*$char_d, '', '',
4856 'poe_location', 'varchar', 'NULL', 2*$char_d, '', '',
4857 'rssi', 'int', 'NULL', '', '', '',
4858 'suid', 'int', 'NULL', '', '', '',
4859 'shared_svcnum', 'int', 'NULL', '', '', '',
4860 'serviceid', 'varchar', 'NULL', 64, '', '',#srvexport/reportfields
4861 'speed_test_up', 'int', 'NULL', '', '', '',
4862 'speed_test_down', 'int', 'NULL', '', '', '',
4863 'speed_test_latency', 'int', 'NULL', '', '', '',
4865 'primary_key' => 'svcnum',
4866 'unique' => [ [ 'ip_addr' ], [ 'mac_addr' ] ],
4869 { columns => [ 'svcnum' ],
4870 table => 'cust_svc',
4872 { columns => [ 'routernum' ],
4875 { columns => [ 'blocknum' ],
4876 table => 'addr_block',
4878 { columns => [ 'sectornum' ],
4879 table => 'tower_sector',
4881 { columns => [ 'shared_svcnum' ],
4882 table => 'svc_broadband',
4883 references => [ 'svcnum' ],
4890 'towernum', 'serial', '', '', '', '',
4891 #'agentnum', 'int', 'NULL', '', '', '',
4892 'towername', 'varchar', '', $char_d, '', '',
4893 'disabled', 'char', 'NULL', 1, '', '',
4894 'latitude', 'decimal', 'NULL', '10,7', '', '',
4895 'longitude', 'decimal', 'NULL', '10,7', '', '',
4896 'coord_auto', 'char', 'NULL', 1, '', '',
4897 'altitude', 'decimal', 'NULL', '', '', '',
4898 'height', 'decimal', 'NULL', '', '', '',
4899 'veg_height', 'decimal', 'NULL', '', '', '',
4900 'color', 'varchar', 'NULL', 6, '', '',
4901 'up_rate_limit', 'int', 'NULL', '', '', '',
4902 'down_rate_limit', 'int', 'NULL', '', '', '',
4904 'primary_key' => 'towernum',
4905 'unique' => [ [ 'towername' ] ], # , 'agentnum' ] ],
4911 'sectornum', 'serial', '', '', '', '',
4912 'towernum', 'int', '', '', '', '',
4913 'sectorname', 'varchar', '', $char_d, '', '',
4914 'ip_addr', 'varchar', 'NULL', 15, '', '',
4915 'height', 'decimal', 'NULL', '', '', '',
4916 'freq_mhz', 'int', 'NULL', '', '', '',
4917 'direction', 'int', 'NULL', '', '', '',
4918 'width', 'int', 'NULL', '', '', '',
4919 'sector_range', 'decimal', 'NULL', '', '', '', #?
4920 'downtilt', 'decimal', 'NULL', '', '', '',
4921 'v_width', 'int', 'NULL', '', '', '',
4922 'margin', 'decimal', 'NULL', '', '', '',
4923 'image', 'blob', 'NULL', '', '', '',
4924 'west', 'decimal', 'NULL', '10,7', '', '',
4925 'east', 'decimal', 'NULL', '10,7', '', '',
4926 'south', 'decimal', 'NULL', '10,7', '', '',
4927 'north', 'decimal', 'NULL', '10,7', '', '',
4928 'title', 'varchar', 'NULL', $char_d,'', '',
4929 'up_rate_limit', 'int', 'NULL', '', '', '',
4930 'down_rate_limit', 'int', 'NULL', '', '', '',
4932 'primary_key' => 'sectornum',
4933 'unique' => [ [ 'towernum', 'sectorname' ], [ 'ip_addr' ], ],
4934 'index' => [ [ 'towernum' ] ],
4936 { columns => [ 'towernum' ],
4942 'part_virtual_field' => {
4944 'vfieldpart', 'serial', '', '', '', '',
4945 'dbtable', 'varchar', '', 32, '', '',
4946 'name', 'varchar', '', 32, '', '',
4947 'length', 'int', 'NULL', '', '', '',
4948 'label', 'varchar', 'NULL', 80, '', '',
4950 'primary_key' => 'vfieldpart',
4955 'virtual_field' => {
4957 'vfieldnum', 'serial', '', '', '', '',
4958 'recnum', 'int', '', '', '', '',
4959 'vfieldpart', 'int', '', '', '', '',
4960 'value', 'varchar', '', 128, '', '',
4962 'primary_key' => 'vfieldnum',
4963 'unique' => [ [ 'vfieldpart', 'recnum' ] ],
4966 { columns => [ 'vfieldpart' ],
4967 table => 'part_virtual_field',
4974 'snarfnum', 'serial', '', '', '', '',
4975 'snarfname', 'varchar', 'NULL', $char_d, '', '',
4976 'svcnum', 'int', '', '', '', '',
4977 'machine', 'varchar', '', 255, '', '',
4978 'protocol', 'varchar', '', $char_d, '', '',
4979 'username', 'varchar', '', $char_d, '', '',
4980 '_password', 'varchar', '', $char_d, '', '',
4981 'check_freq', 'int', 'NULL', '', '', '',
4982 'leavemail', 'char', 'NULL', 1, '', '',
4983 'apop', 'char', 'NULL', 1, '', '',
4984 'tls', 'char', 'NULL', 1, '', '',
4985 'mailbox', 'varchar', 'NULL', $char_d, '', '',
4987 'primary_key' => 'snarfnum',
4989 'index' => [ [ 'svcnum' ] ],
4991 { columns => [ 'svcnum' ],
4992 table => 'svc_acct',
4999 'svcnum', 'int', '', '', '', '',
5000 'id', 'bigint', 'NULL', '', '', '',
5001 'title', 'varchar', 'NULL', $char_d, '', '',
5003 'primary_key' => 'svcnum',
5007 { columns => [ 'svcnum' ],
5008 table => 'cust_svc',
5013 'cust_pay_refund' => {
5015 'payrefundnum', 'serial', '', '', '', '',
5016 'paynum', 'int', '', '', '', '',
5017 'refundnum', 'int', '', '', '', '',
5018 '_date', @date_type, '', '',
5019 'amount', @money_type, '', '',
5021 'primary_key' => 'payrefundnum',
5023 'index' => [ ['paynum'], ['refundnum'] ],
5025 { columns => [ 'paynum' ],
5026 table => 'cust_pay',
5028 { columns => [ 'refundnum' ],
5029 table => 'cust_refund',
5034 'part_pkg_option' => {
5036 'optionnum', 'serial', '', '', '', '',
5037 'pkgpart', 'int', '', '', '', '',
5038 'optionname', 'varchar', '', $char_d, '', '',
5039 'optionvalue', 'text', 'NULL', '', '', '',
5041 'primary_key' => 'optionnum',
5043 'index' => [ [ 'pkgpart' ], [ 'optionname' ] ],
5045 { columns => [ 'pkgpart' ],
5046 table => 'part_pkg',
5051 'part_pkg_vendor' => {
5053 'num', 'serial', '', '', '', '',
5054 'pkgpart', 'int', '', '', '', '',
5055 'exportnum', 'int', '', '', '', '',
5056 'vendor_pkg_id', 'varchar', '', $char_d, '', '',
5058 'primary_key' => 'num',
5059 'unique' => [ [ 'pkgpart', 'exportnum' ] ],
5060 'index' => [ [ 'pkgpart' ] ],
5062 { columns => [ 'pkgpart' ],
5063 table => 'part_pkg',
5065 { columns => [ 'exportnum' ],
5066 table => 'part_export',
5071 'part_pkg_report_option' => {
5073 'num', 'serial', '', '', '', '',
5074 'name', 'varchar', '', $char_d, '', '',
5075 'disabled', 'char', 'NULL', 1, '', '',
5077 'primary_key' => 'num',
5078 'unique' => [ [ 'name' ] ],
5079 'index' => [ [ 'disabled' ] ],
5082 'part_pkg_usage' => {
5084 'pkgusagepart', 'serial', '', '', '', '',
5085 'pkgpart', 'int', '', '', '', '',
5086 'minutes', 'double precision', '', '', '', '',
5087 'priority', 'int', 'NULL', '', '', '',
5088 'shared', 'char', 'NULL', 1, '', '',
5089 'rollover', 'char', 'NULL', 1, '', '',
5090 'description', 'varchar', 'NULL', $char_d, '', '',
5092 'primary_key' => 'pkgusagepart',
5094 'index' => [ [ 'pkgpart' ] ],
5096 { columns => [ 'pkgpart' ],
5097 table => 'part_pkg',
5102 'part_pkg_usage_class' => {
5104 'num', 'serial', '', '', '', '',
5105 'pkgusagepart', 'int', '', '', '', '',
5106 'classnum', 'int','NULL', '', '', '',
5108 'primary_key' => 'num',
5109 'unique' => [ [ 'pkgusagepart', 'classnum' ] ],
5112 { columns => [ 'pkgusagepart' ],
5113 table => 'part_pkg_usage',
5115 { columns => [ 'classnum' ],
5116 table => 'usage_class',
5121 'part_pkg_fcc_option' => {
5123 'num', 'serial', '', '', '', '',
5124 'fccoptionname', 'varchar', '', $char_d, '', '',
5125 'pkgpart', 'int', '', '', '', '',
5126 'optionvalue', 'varchar', 'NULL', $char_d, '', '',
5128 'primary_key' => 'num',
5129 'unique' => [ [ 'fccoptionname', 'pkgpart' ] ],
5135 'ratenum', 'serial', '', '', '', '',
5136 'ratename', 'varchar', '',$char_d, '', '',
5137 'agentnum', 'int', 'NULL', '', '', '',
5138 'default_detailnum', 'int', 'NULL', '', '', '',
5140 'primary_key' => 'ratenum',
5144 { columns => [ 'agentnum' ],
5152 'ratedetailnum', 'serial', '', '', '', '',
5153 'ratenum', 'int', '', '', '', '',
5154 'orig_regionnum', 'int', 'NULL', '', '', '',
5155 'dest_regionnum', 'int', 'NULL', '', '', '',
5156 'min_included', 'int', '', '', '', '',
5157 'conn_charge', 'decimal', '', '10,4', '0.0000', '',
5158 'conn_cost', 'decimal', '', '10,4', '0.0000', '',
5159 'conn_sec', 'int', '', '', '0', '',
5160 'min_charge', 'decimal', '', '10,5', '', '',
5161 'min_cost', 'decimal', '', '10,5','0.00000', '',
5162 'sec_granularity', 'int', '', '', '', '',
5163 'ratetimenum', 'int', 'NULL', '', '', '',
5164 'classnum', 'int', 'NULL', '', '', '',
5165 'cdrtypenum', 'int', 'NULL', '', '', '',
5166 'region_group', 'char', 'NULL', 1, '', '',
5167 'upstream_mult_charge', 'decimal', '', '10,4', '0.0000', '',
5168 'upstream_mult_cost', 'decimal', '', '10,4', '0.0000', '',
5170 'primary_key' => 'ratedetailnum',
5171 'unique' => [ [ 'ratenum', 'orig_regionnum', 'dest_regionnum' ] ],
5172 'index' => [ [ 'ratenum', 'dest_regionnum' ],
5173 [ 'ratenum', 'ratetimenum' ]
5176 { columns => [ 'ratenum' ],
5179 { columns => [ 'orig_regionnum' ],
5180 table => 'rate_region',
5181 references => [ 'regionnum' ],
5183 { columns => [ 'dest_regionnum' ],
5184 table => 'rate_region',
5185 references => [ 'regionnum' ],
5187 { columns => [ 'ratetimenum' ],
5188 table => 'rate_time',
5190 { columns => [ 'classnum' ],
5191 table => 'usage_class',
5193 { columns => [ 'cdrtypenum' ],
5194 table => 'cdr_type',
5201 'regionnum', 'serial', '', '', '', '',
5202 'regionname', 'varchar', '', $char_d, '', '',
5203 'exact_match', 'char', 'NULL', 1, '', '',
5205 'primary_key' => 'regionnum',
5212 'prefixnum', 'serial', '', '', '', '',
5213 'regionnum', 'int', '', '', '', '',
5214 'countrycode', 'varchar', '', 3, '', '',
5215 'npa', 'varchar', 'NULL', 10, '', '', #actually the whole prefix
5216 'nxx', 'varchar', 'NULL', 3, '', '', #actually not used
5217 'latanum', 'int', 'NULL', '', '', '',
5218 'state', 'char', 'NULL', 2, '', '',
5219 'ocn', 'char', 'NULL', 4, '', '',
5221 'primary_key' => 'prefixnum',
5222 'unique' => [ [ 'countrycode', 'npa', 'nxx' ] ],
5223 'index' => [ [ 'countrycode' ], [ 'npa' ], [ 'regionnum' ] ],
5225 { columns => [ 'regionnum' ],
5226 table => 'rate_region',
5228 { columns => [ 'latanum' ],
5236 'ratetimenum', 'serial', '', '', '', '',
5237 'ratetimename', 'varchar', '', $char_d, '', '',
5239 'primary_key' => 'ratetimenum',
5244 'rate_time_interval' => {
5246 'intervalnum', 'serial', '', '', '', '',
5247 'stime', 'int', '', '', '', '',
5248 'etime', 'int', '', '', '', '',
5249 'ratetimenum', 'int', '', '', '', '',
5251 'primary_key' => 'intervalnum',
5255 { columns => [ 'ratetimenum' ],
5256 table => 'rate_time',
5261 #not really part of the above rate_ stuff (used with flat rate rather than
5262 # rated billing), but could be eventually, and its a rate
5265 'tiernum', 'serial', '', '', '', '',
5266 'tiername', 'varchar', '', $char_d, '', '',
5268 'primary_key' => 'tiernum',
5269 'unique' => [ [ 'tiername'], ],
5273 'rate_tier_detail' => {
5275 'tierdetailnum', 'serial', '', '', '', '',
5276 'tiernum', 'int', '', '', '', '',
5277 'min_quan', 'int', '', '', '', '',
5278 'min_charge', 'decimal', '', '10,4', '', '',
5280 'primary_key' => 'tierdetailnum',
5282 'index' => [ ['tiernum'], ],
5284 { columns => [ 'tiernum' ],
5285 table => 'rate_tier',
5292 'classnum', 'serial', '', '', '', '',
5293 'weight', 'int', 'NULL', '', '', '',
5294 'classname', 'varchar', '', $char_d, '', '',
5295 'format', 'varchar', 'NULL', $char_d, '', '',
5296 'disabled', 'char', 'NULL', 1, '', '',
5298 'primary_key' => 'classnum',
5300 'index' => [ ['disabled'] ],
5305 'codenum', 'serial', '', '', '', '',
5306 'code', 'varchar', '', $char_d, '', '',
5307 'agentnum', 'int', '', '', '', '',
5309 'primary_key' => 'codenum',
5310 'unique' => [ [ 'agentnum', 'code' ] ],
5311 'index' => [ [ 'agentnum' ] ],
5313 { columns => [ 'agentnum' ],
5321 'codepkgnum', 'serial', '', '', '', '',
5322 'codenum', 'int', '', '', '', '',
5323 'pkgpart', 'int', '', '', '', '',
5325 'primary_key' => 'codepkgnum',
5326 'unique' => [ [ 'codenum', 'pkgpart' ] ],
5327 'index' => [ [ 'codenum' ] ],
5329 { columns => [ 'codenum' ],
5330 table => 'reg_code',
5332 { columns => [ 'pkgpart' ],
5333 table => 'part_pkg',
5338 'clientapi_session' => {
5340 'sessionnum', 'serial', '', '', '', '',
5341 'sessionid', 'varchar', '', $char_d, '', '',
5342 'namespace', 'varchar', '', $char_d, '', '',
5344 'primary_key' => 'sessionnum',
5345 'unique' => [ [ 'sessionid', 'namespace' ] ],
5349 'clientapi_session_field' => {
5351 'fieldnum', 'serial', '', '', '', '',
5352 'sessionnum', 'int', '', '', '', '',
5353 'fieldname', 'varchar', '', $char_d, '', '',
5354 'fieldvalue', 'text', 'NULL', '', '', '',
5356 'primary_key' => 'fieldnum',
5357 'unique' => [ [ 'sessionnum', 'fieldname' ] ],
5360 { columns => [ 'sessionnum' ],
5361 table => 'clientapi_session',
5366 'payment_gateway' => {
5368 'gatewaynum', 'serial', '', '', '', '',
5369 'gateway_namespace','varchar', 'NULL', $char_d, '', '',
5370 'gateway_module', 'varchar', '', $char_d, '', '',
5371 'gateway_username', 'varchar', 'NULL', $char_d, '', '',
5372 'gateway_password', 'varchar', 'NULL', $char_d, '', '',
5373 'gateway_action', 'varchar', 'NULL', $char_d, '', '',
5374 'gateway_callback_url', 'varchar', 'NULL', 255, '', '',
5375 'gateway_cancel_url', 'varchar', 'NULL', 255, '', '',
5376 'disabled', 'char', 'NULL', 1, '', '',
5378 'primary_key' => 'gatewaynum',
5380 'index' => [ [ 'disabled' ] ],
5383 'payment_gateway_option' => {
5385 'optionnum', 'serial', '', '', '', '',
5386 'gatewaynum', 'int', '', '', '', '',
5387 'optionname', 'varchar', '', $char_d, '', '',
5388 'optionvalue', 'text', 'NULL', '', '', '',
5390 'primary_key' => 'optionnum',
5392 'index' => [ [ 'gatewaynum' ], [ 'optionname' ] ],
5394 { columns => [ 'gatewaynum' ],
5395 table => 'payment_gateway',
5400 'agent_payment_gateway' => {
5402 'agentgatewaynum', 'serial', '', '', '', '',
5403 'agentnum', 'int', '', '', '', '',
5404 'gatewaynum', 'int', '', '', '', '',
5405 'cardtype', 'varchar', 'NULL', $char_d, '', '',
5406 'taxclass', 'varchar', 'NULL', $char_d, '', '',
5408 'primary_key' => 'agentgatewaynum',
5410 'index' => [ [ 'agentnum', 'cardtype' ], ],
5414 { columns => [ 'agentnum' ],
5417 { columns => [ 'gatewaynum' ],
5418 table => 'payment_gateway',
5425 'bannum', 'serial', '', '', '', '',
5426 'payby', 'char', '', 4, '', '',
5427 'payinfo', 'varchar', '', 128, '', '', #say, a 512-big digest _hex encoded
5428 'payinfo_hash', 'varchar', 'NULL', 32, '', '',
5429 #'paymask', 'varchar', 'NULL', $char_d, '', ''
5430 '_date', @date_type, '', '',
5431 'end_date', @date_type, '', '',
5432 'otaker', 'varchar', 'NULL', 32, '', '',
5433 'usernum', 'int', 'NULL', '', '', '',
5434 'bantype', 'varchar', 'NULL', $char_d, '', '',
5435 'reason', 'varchar', 'NULL', $char_d, '', '',
5437 'primary_key' => 'bannum',
5439 'index' => [ [ 'payby', 'payinfo' ], [ 'usernum' ], ],
5441 { columns => [ 'usernum' ],
5442 table => 'access_user',
5449 'categorynum', 'serial', '', '', '', '',
5450 'categoryname', 'varchar', '', $char_d, '', '',
5451 'weight', 'int', 'NULL', '', '', '',
5452 'ticketing_queueid', 'int', 'NULL', '', '', '',
5453 'condense', 'char', 'NULL', 1, '', '',
5454 'disabled', 'char', 'NULL', 1, '', '',
5456 'primary_key' => 'categorynum',
5458 'index' => [ ['disabled'] ],
5463 'classnum', 'serial', '', '', '', '',
5464 'classname', 'varchar', '', $char_d, '', '',
5465 'categorynum', 'int', 'NULL', '', '', '',
5466 'disabled', 'char', 'NULL', 1, '', '',
5467 'fcc_ds0s', 'int', 'NULL', '', '', '',
5469 'primary_key' => 'classnum',
5471 'index' => [ ['disabled'] ],
5473 { columns => [ 'categorynum' ],
5474 table => 'pkg_category',
5481 # qw( name type null length default local );
5487 'acctid', 'bigserial', '', '', '', '',
5488 #'calldate', 'TIMESTAMP with time zone', '', '', \'now()', '',
5489 'calldate', 'timestamp', '', '', \'now()', '',
5490 'clid', 'varchar', '', $char_d, \"''", '',
5491 'src', 'varchar', '', $char_d, \"''", '',
5492 'dst', 'varchar', '', $char_d, \"''", '',
5493 'dcontext', 'varchar', '', $char_d, \"''", '',
5494 'channel', 'varchar', '', $char_d, \"''", '',
5495 'dstchannel', 'varchar', '', $char_d, \"''", '',
5496 'lastapp', 'varchar', '', $char_d, \"''", '',
5497 'lastdata', 'varchar', '', 255, \"''", '',
5499 #currently only opensips & voipswitch
5500 'src_ip_addr', 'varchar', 'NULL', 15, '', '',
5502 #currently only opensips
5503 'dst_ip_addr', 'varchar', 'NULL', 15, '', '',
5506 # terminating number (as opposed to dialed destination)
5507 'dst_term', 'varchar', 'NULL', $char_d, '', '',
5509 #these don't seem to be logged by most of the SQL cdr_* modules
5510 #except tds under sql-illegal names, so;
5511 # ... don't rely on them for rating?
5512 # and, what they hey, i went ahead and changed the names and data types
5513 # to freeside-style dates...
5514 #'start', 'timestamp', 'NULL', '', '', '',
5515 #'answer', 'timestamp', 'NULL', '', '', '',
5516 #'end', 'timestamp', 'NULL', '', '', '',
5517 'startdate', @date_type, '', '',
5518 'answerdate', @date_type, '', '',
5519 'enddate', @date_type, '', '',
5522 'duration', 'int', '', '', 0, '',
5523 'billsec', 'int', '', '', 0, '',
5524 'disposition', 'varchar', '', 45, \"''", '',
5525 'amaflags', 'int', '', '', 0, '',
5526 'accountcode', 'varchar', '', 32, \"''", '',
5527 'uniqueid', 'varchar', '', $char_d, \"''", '',
5528 'userfield', 'varchar', '', 512, \"''", '',
5530 'max_callers', 'int', 'NULL', '', '', '',
5533 # old fields for unitel/RSLCOM/convergent that don't map to asterisk
5534 # ones we adoped moved to "own fields" section below
5535 # charged_party, upstream_price, rated_price, carrierid, cdrtypenum
5538 'upstream_currency', 'char', 'NULL', 3, '', '',
5539 'upstream_rateplanid', 'int', 'NULL', '', '', '', #?
5541 # how it was rated internally...
5542 'ratedetailnum', 'int', 'NULL', '', '', '',
5544 'distance', 'decimal', 'NULL', '', '', '',
5545 'islocal', 'int', 'NULL', '', '', '', # '', '', 0, '' instead?
5547 #cdr_calltype: the big list in appendix 2
5548 'calltypenum', 'int', 'NULL', '', '', '',
5550 'description', 'varchar', 'NULL', $char_d, '', '',
5551 'quantity', 'int', 'NULL', '', '', '',
5553 'upstream_rateid', 'int', 'NULL', '', '', '',
5556 # more fields, for GSM imports
5558 'servicecode', 'int', 'NULL', '', '', '',
5559 'quantity_able', 'int', 'NULL', '', '', '',
5562 #and now for our own fields
5565 'cdrtypenum', 'int', 'NULL', '', '', '',
5567 'charged_party', 'varchar', 'NULL', $char_d, '', '',
5568 'charged_party_imsi', 'varchar', 'NULL', $char_d, '', '',
5570 'upstream_price', 'decimal', 'NULL', '10,5', '', '',
5572 #currently only voipswitch
5573 #'upstream_rate', 'decimal', 'NULL', '10,5', '', '',
5575 'upstream_src_regionname', 'varchar', 'NULL', $char_d, '', '',
5576 'upstream_dst_regionname', 'varchar', 'NULL', $char_d, '', '',
5578 # how it was rated internally...
5579 'rated_pretty_dst', 'varchar', 'NULL', $char_d, '', '',
5580 'rated_regionname', 'varchar', 'NULL', $char_d, '', '',
5581 'rated_price', 'decimal', 'NULL', '10,4', '', '',
5582 'rated_seconds', 'int', 'NULL', '', '', '',
5583 'rated_minutes', 'double precision', 'NULL', '', '', '',
5584 'rated_granularity', 'int', 'NULL', '', '', '',
5585 'rated_ratedetailnum', 'int', 'NULL', '', '', '',
5586 'rated_classnum', 'int', 'NULL', '', '', '',
5587 'rated_ratename', 'varchar', 'NULL', $char_d, '', '',
5588 'rated_cost', 'decimal', 'NULL', '10,4', '', '',
5590 # real endpoints of the call
5591 'src_lrn', 'varchar', 'NULL', '15', '', '',
5592 'dst_lrn', 'varchar', 'NULL', '15', '', '',
5594 'carrierid', 'bigint', 'NULL', '', '', '',
5596 # service it was matched to
5597 'svcnum', 'int', 'NULL', '', '', '',
5599 #NULL, done (or something)
5600 'freesidestatus', 'varchar', 'NULL', 32, '', '',
5602 #additional status info (i.e. reason for "skipped" freesidestatus)
5603 'freesidestatustext', 'text', 'NULL', '', '', '',
5605 #NULL, done (or something)
5606 'freesiderewritestatus', 'varchar', 'NULL', 32, '', '',
5608 #an indexed place to put big numbers
5609 'cdrid', 'bigint', 'NULL', '', '', '',
5611 #for taqua accountcode rewriting, for starters
5612 'sessionnum', 'int', 'NULL', '', '', '',
5613 'subscriber', 'varchar', 'NULL', $char_d, '', '',
5616 'cdrbatch', 'varchar', 'NULL', 255, '', '',
5618 'cdrbatchnum', 'int', 'NULL', '', '', '',
5620 # FK to cust_bill_pkg_detail; having a value here absolutely means
5621 # that the CDR appears on an invoice
5622 'detailnum', 'bigint', 'NULL', '', '', '',
5624 'primary_key' => 'acctid',
5626 'index' => [ [ 'calldate' ],
5627 [ 'src' ], [ 'dst' ], [ 'dcontext' ], [ 'charged_party' ],
5628 [ 'startdate' ], [ 'duration' ],
5629 [ 'cdrtypenum' ], [ 'calltypenum' ],
5631 ['accountcode'], ['uniqueid'], ['carrierid'], ['cdrid'],
5632 [ 'sessionnum' ], [ 'subscriber' ],
5633 [ 'freesidestatus' ], [ 'freesiderewritestatus' ],
5634 [ 'cdrbatch' ], [ 'cdrbatchnum' ],
5635 [ 'src_ip_addr' ], [ 'dst_ip_addr' ], [ 'dst_term' ],
5638 #no FKs on cdr table... choosing not to throw errors no matter what's
5639 # thrown in here. better to have the data.
5644 'cdrbatchnum', 'serial', '', '', '', '',
5645 'cdrbatch', 'varchar', 'NULL', 255, '', '',
5646 '_date', @date_type, '', '',
5648 'primary_key' => 'cdrbatchnum',
5649 'unique' => [ [ 'cdrbatch' ] ],
5653 'cdr_termination' => {
5655 'cdrtermnum', 'bigserial', '', '', '', '',
5656 'acctid', 'bigint', '', '', '', '',
5657 'termpart', 'int', '', '', '', '',#future use see below
5658 'rated_price', 'decimal', 'NULL', '10,4', '', '',
5659 'rated_seconds', 'int', 'NULL', '', '', '',
5660 'rated_minutes', 'double precision', 'NULL', '', '', '',
5661 'rated_granularity','int', 'NULL', '', '', '',
5662 'status', 'varchar', 'NULL', 32, '', '',
5663 'svcnum', 'int', 'NULL', '', '', '',
5665 'primary_key' => 'cdrtermnum',
5666 'unique' => [ [ 'acctid', 'termpart' ] ],
5667 'index' => [ [ 'acctid' ], [ 'status' ], ],
5669 { columns => [ 'acctid' ],
5672 { columns => [ 'svcnum' ],
5673 table => 'cust_svc',
5678 #to handle multiple termination/settlement passes...
5679 # 'part_termination' => {
5681 # 'termpart', 'int', '', '', '', '',
5682 # 'termname', 'varchar', '', $char_d, '', '',
5683 # 'cdr_column', 'varchar', '', $char_d, '', '', #maybe set it here instead of in the price plan?
5685 # 'primary_key' => 'termpart',
5690 #the remaining cdr_ tables are not really used
5693 'calltypenum', 'serial', '', '', '', '',
5694 'calltypename', 'varchar', '', $char_d, '', '',
5696 'primary_key' => 'calltypenum',
5703 'cdrtypenum' => 'serial', '', '', '', '',
5704 'cdrtypename' => 'varchar', '', $char_d, '', '',
5706 'primary_key' => 'cdrtypenum',
5713 'carrierid' => 'serial', '', '', '', '',
5714 'carriername' => 'varchar', '', $char_d, '', '',
5715 'disabled' => 'char', 'NULL', 1, '', '',
5717 'primary_key' => 'carrierid',
5724 # 'filenum', 'serial', '', '', '', '',
5725 # 'filename', 'varchar', '', '', '', '',
5726 # 'status', 'varchar', 'NULL', '', '', '',
5728 # 'primary_key' => 'filenum',
5729 # 'unique' => [ [ 'filename' ], ], #just change the index if we need to
5730 # # agent-virtualize or have a customer
5731 # # with dup-filename needs or something
5732 # # (only used by cdr.http_and_import for
5737 'inventory_item' => {
5739 'itemnum', 'serial', '', '', '', '',
5740 'classnum', 'int', '', '', '', '',
5741 'agentnum', 'int', 'NULL', '', '', '',
5742 'item', 'varchar', '', $char_d, '', '',
5743 'svcnum', 'int', 'NULL', '', '', '',
5744 'svc_field', 'varchar', 'NULL', $char_d, '', '',
5746 'primary_key' => 'itemnum',
5747 'unique' => [ [ 'classnum', 'item' ] ],
5748 'index' => [ [ 'classnum' ], [ 'agentnum' ], [ 'svcnum' ] ],
5750 { columns => [ 'classnum' ],
5751 table => 'inventory_class',
5753 { columns => [ 'agentnum' ],
5756 { columns => [ 'svcnum' ],
5757 table => 'cust_svc',
5762 'inventory_class' => {
5764 'classnum', 'serial', '', '', '', '',
5765 'classname', 'varchar', '', $char_d, '', '',
5767 'primary_key' => 'classnum',
5772 'access_user_session' => {
5774 'sessionnum', 'serial', '', '', '', '',
5775 'sessionkey', 'varchar', '', $char_d, '', '',
5776 'usernum', 'int', '', '', '', '',
5777 'start_date', @date_type, '', '',
5778 'last_date', @date_type, '', '',
5780 'primary_key' => 'sessionnum',
5781 'unique' => [ [ 'sessionkey' ] ],
5784 { columns => [ 'usernum' ],
5785 table => 'access_user',
5790 'access_user_session_log' => {
5792 'sessionlognum', 'serial', '', '', '', '',
5793 'usernum', 'int', '', '', '', '',
5794 'start_date', @date_type, '', '',
5795 'last_date', @date_type, '', '',
5796 'logout_date', @date_type, '', '',
5797 'logout_type', 'varchar', '', $char_d, '', '',
5799 'primary_key' => 'sessionlognum',
5803 { columns => [ 'usernum' ],
5804 table => 'access_user',
5811 'usernum', 'serial', '', '', '', '',
5812 'username', 'varchar', '', $char_d, '', '',
5813 '_password', 'varchar', 'NULL', $char_d, '', '',
5814 '_password_encoding', 'varchar', 'NULL', $char_d, '', '',
5815 'last', 'varchar', 'NULL', $char_d, '', '',
5816 'first', 'varchar', 'NULL', $char_d, '', '',
5817 'user_custnum', 'int', 'NULL', '', '', '',
5818 'report_salesnum', 'int', 'NULL', '', '', '',
5819 'disabled', 'char', 'NULL', 1, '', '',
5821 'primary_key' => 'usernum',
5822 'unique' => [ [ 'username' ] ],
5823 'index' => [ [ 'user_custnum' ] ],
5825 { columns => [ 'user_custnum' ],
5826 table => 'cust_main',
5827 references => [ 'custnum' ],
5829 { columns => [ 'report_salesnum' ],
5831 references => [ 'salesnum' ],
5836 'access_user_pref' => {
5838 'prefnum', 'serial', '', '', '', '',
5839 'usernum', 'int', '', '', '', '',
5840 'prefname', 'varchar', '', $char_d, '', '',
5841 'prefvalue', 'text', 'NULL', '', '', '',
5842 'expiration', @date_type, '', '',
5844 'primary_key' => 'prefnum',
5846 'index' => [ [ 'usernum' ] ],
5848 { columns => [ 'usernum' ],
5849 table => 'access_user',
5856 'groupnum', 'serial', '', '', '', '',
5857 'groupname', 'varchar', '', $char_d, '', '',
5858 'session_timeout', 'int', 'NULL', '', '', '',
5860 'primary_key' => 'groupnum',
5861 'unique' => [ [ 'groupname' ] ],
5865 'access_usergroup' => {
5867 'usergroupnum', 'serial', '', '', '', '',
5868 'usernum', 'int', '', '', '', '',
5869 'groupnum', 'int', '', '', '', '',
5871 'primary_key' => 'usergroupnum',
5872 'unique' => [ [ 'usernum', 'groupnum' ] ],
5873 'index' => [ [ 'usernum' ] ],
5875 { columns => [ 'usernum' ],
5876 table => 'access_user',
5878 { columns => [ 'groupnum' ],
5879 table => 'access_group',
5884 'access_groupagent' => {
5886 'groupagentnum', 'serial', '', '', '', '',
5887 'groupnum', 'int', '', '', '', '',
5888 'agentnum', 'int', '', '', '', '',
5890 'primary_key' => 'groupagentnum',
5891 'unique' => [ [ 'groupnum', 'agentnum' ] ],
5892 'index' => [ [ 'groupnum' ] ],
5894 { columns => [ 'groupnum' ],
5895 table => 'access_group',
5897 { columns => [ 'agentnum' ],
5905 'rightnum', 'serial', '', '', '', '',
5906 'righttype', 'varchar', '', $char_d, '', '',
5907 'rightobjnum', 'int', '', '', '', '',
5908 'rightname', 'varchar', '', $char_d, '', '',
5910 'primary_key' => 'rightnum',
5911 'unique' => [ [ 'righttype', 'rightobjnum', 'rightname' ] ],
5915 'access_user_log' => {
5917 'lognum', 'serial', '', '', '', '',
5918 'usernum', 'int', '', '', '', '',
5919 'path', 'varchar', '', 2*$char_d, '', '',
5920 '_date', @date_type, '', '',
5921 'render_seconds', 'int', 'NULL', '', '', '',
5922 'pid', 'int', 'NULL', '', '', '',
5924 'primary_key' => 'lognum',
5926 'index' => [ ['usernum'], ['path'], ['_date'] ],
5929 'access_user_page_pref' => {
5931 'prefnum' => 'serial', '', '', '', '',
5932 'usernum' => 'int', '', '', '', '',
5933 'path' => 'text', '', '', '', '',
5934 'tablenum' => 'int', 'NULL', '', '', '',
5935 '_date' => @date_type, '', '',
5936 'prefname' => 'varchar', '', $char_d, '', '',
5937 'prefvalue' => 'text', '', '', '', '',
5939 'primary_key' => 'prefnum',
5940 'unique' => [ [ 'usernum', 'path', 'tablenum', 'prefname' ] ],
5943 { columns => [ 'usernum' ],
5944 table => 'access_user'
5951 'itemnum', 'serial', '', '', '', '',
5952 'usernum', 'int', 'NULL', '', '', '',
5953 #'itemname', 'varchar', $char_d, '', '', '',
5954 'disabled', 'char', 'NULL', 1, '', '',
5956 'primary_key' => 'itemnum',
5957 'unique' => [ [ 'usernum' ] ],
5960 { columns => [ 'usernum' ],
5961 table => 'access_user',
5970 'availnum', 'serial', '', '', '', '',
5971 'itemnum', 'int', '', '', '', '',
5972 'wday', 'int', '', '', '', '',
5973 'stime', 'int', '', '', '', '',
5974 'etime', 'int', '', '', '', '',
5975 'override_date', @date_type, '', '',
5977 'primary_key' => 'availnum',
5981 { columns => [ 'itemnum' ],
5982 table => 'sched_item',
5989 'svcnum', 'int', '', '', '', '',
5990 'countrycode', 'varchar', '', 3, '', '',
5991 'phonenum', 'varchar', '', 25, '', '', #12 ?
5992 'sim_imsi', 'varchar', 'NULL', 15, '', '',
5993 'pin', 'varchar', 'NULL', $char_d, '', '',
5994 'sip_password', 'varchar', 'NULL', $char_d, '', '',
5995 'phone_name', 'varchar', 'NULL', $char_d, '', '',
5996 'pbxsvc', 'int', 'NULL', '', '', '',
5997 'domsvc', 'int', 'NULL', '', '', '',
5998 'locationnum', 'int', 'NULL', '', '', '',
5999 'forward_svcnum', 'int', 'NULL', '', '', '',
6000 'forwarddst', 'varchar', 'NULL', 15, '', '',
6001 'email', 'varchar', 'NULL', 255, '', '',
6002 'lnp_status', 'varchar', 'NULL', $char_d, '', '',
6003 'portable', 'char', 'NULL', 1, '', '',
6004 'lrn', 'char', 'NULL', 10, '', '',
6005 'lnp_desired_due_date', 'int', 'NULL', '', '', '',
6006 'lnp_due_date', 'int', 'NULL', '', '', '',
6007 'lnp_other_provider', 'varchar', 'NULL', $char_d, '', '',
6008 'lnp_other_provider_account', 'varchar', 'NULL', $char_d, '', '',
6009 'lnp_reject_reason', 'varchar', 'NULL', $char_d, '', '',
6010 'lnp_portid', 'varchar', 'NULL', $char_d, '', '',
6011 'lnp_signature', 'char', 'NULL', 1, '', '',
6012 'lnp_bill', 'char', 'NULL', 1, '', '',
6013 'sms_carrierid', 'int', 'NULL', '', '', '',
6014 'sms_account', 'varchar', 'NULL', $char_d, '', '',
6015 'max_simultaneous', 'int', 'NULL', '', '', '',
6016 'e911_class', 'char', 'NULL', 1, '', '',
6017 'e911_type', 'char', 'NULL', 1, '', '',
6018 'circuit_svcnum', 'int', 'NULL', '', '', '',
6019 'sip_server', 'varchar', 'NULL', $char_d, '', '',
6021 'primary_key' => 'svcnum',
6022 'unique' => [ [ 'sms_carrierid', 'sms_account'] ],
6023 'index' => [ ['countrycode', 'phonenum'], ['pbxsvc'], ['domsvc'],
6024 ['locationnum'], ['sms_carrierid'],
6027 { columns => [ 'svcnum' ],
6028 table => 'cust_svc',
6030 { columns => [ 'pbxsvc' ],
6031 table => 'svc_pbx', #'cust_svc',
6032 references => [ 'svcnum' ],
6034 { columns => [ 'domsvc' ],
6035 table => 'svc_domain', #'cust_svc',
6036 references => [ 'svcnum' ],
6038 { columns => [ 'locationnum' ],
6039 table => 'cust_location',
6041 { columns => [ 'sms_carrierid' ],
6042 table => 'cdr_carrier',
6043 references => [ 'carrierid' ],
6045 { columns => [ 'circuit_svcnum' ],
6046 table => 'svc_circuit',
6047 references => [ 'svcnum' ],
6054 'devicenum', 'serial', '', '', '', '',
6055 'devicepart', 'int', '', '', '', '',
6056 'svcnum', 'int', '', '', '', '',
6057 'mac_addr', 'varchar', 'NULL', 12, '', '',
6059 'primary_key' => 'devicenum',
6060 'unique' => [ [ 'mac_addr' ], ],
6061 'index' => [ [ 'devicepart' ], [ 'svcnum' ], ],
6063 { columns => [ 'devicepart' ],
6064 table => 'part_device',
6066 { columns => [ 'svcnum' ],
6067 table => 'svc_phone',
6074 'devicepart', 'serial', '', '', '', '',
6075 'devicename', 'varchar', '', $char_d, '', '',
6076 'inventory_classnum', 'int', 'NULL', '', '', '',
6077 'title', 'varchar', 'NULL', $char_d, '', '',
6079 'primary_key' => 'devicepart',
6080 'unique' => [ [ 'devicename' ] ], #?
6083 { columns => [ 'inventory_classnum' ],
6084 table => 'inventory_class',
6085 references => [ 'classnum' ],
6092 'availnum', 'serial', '', '', '', '',
6093 'exportnum', 'int', '', '', '', '',
6094 'countrycode', 'varchar', '', 3, '', '',
6095 'state', 'char', 'NULL', 2, '', '',
6096 'npa', 'char', '', 3, '', '',
6097 'nxx', 'char', 'NULL', 3, '', '',
6098 'station', 'char', 'NULL', 4, '', '',
6099 'name', 'varchar', 'NULL', $char_d, '', '',
6100 'rate_center_abbrev', 'varchar', 'NULL', $char_d, '', '',
6101 'latanum', 'int', 'NULL', '', '', '',
6102 'msanum', 'int', 'NULL', '', '', '',
6103 'ordernum', 'int', 'NULL', '', '', '',
6104 'svcnum', 'int', 'NULL', '', '', '',
6105 'availbatch', 'varchar', 'NULL', $char_d, '', '',
6107 'primary_key' => 'availnum',
6109 'index' => [ ['exportnum','countrycode','state'], #npa search
6110 ['exportnum','countrycode','npa'], #nxx search
6111 ['exportnum','countrycode','npa','nxx'],#station srch
6112 [ 'exportnum','countrycode','npa','nxx','station'], #
6118 { columns => [ 'exportnum' ],
6119 table => 'part_export',
6121 { columns => [ 'latanum' ],
6124 { columns => [ 'msanum' ],
6127 { columns => [ 'ordernum' ],
6128 table => 'did_order',
6130 { columns => [ 'svcnum' ],
6131 table => 'svc_phone',
6138 'latanum', 'int', '', '', '', '',
6139 'description', 'varchar', '', $char_d, '', '',
6140 'have_usage', 'int', 'NULL', '', '', '',
6142 'primary_key' => 'latanum',
6149 'msanum', 'int', '', '', '', '',
6150 'description', 'varchar', '', $char_d, '', '',
6152 'primary_key' => 'msanum',
6159 'ratecenternum', 'serial', '', '', '', '',
6160 'description', 'varchar', '', $char_d, '', '',
6162 'primary_key' => 'ratecenternum',
6169 'vendornum', 'serial', '', '', '', '',
6170 'vendorname', 'varchar', '', $char_d, '', '',
6172 'primary_key' => 'vendornum',
6177 'did_order_item' => {
6179 'orderitemnum', 'serial', '', '', '', '',
6180 'ordernum', 'int', '', '', '', '',
6181 'msanum', 'int', 'NULL', '', '', '',
6182 'npa', 'int', 'NULL', '', '', '',
6183 'latanum', 'int', 'NULL', '', '', '',
6184 'ratecenternum', 'int', 'NULL', '', '', '',
6185 'state', 'char', 'NULL', 2, '', '',
6186 'quantity', 'int', '', '', '', '',
6187 'custnum', 'int', 'NULL', '', '', '',
6189 'primary_key' => 'orderitemnum',
6193 { columns => [ 'ordernum' ],
6194 table => 'did_order',
6196 { columns => [ 'msanum' ],
6199 { columns => [ 'latanum' ],
6202 { columns => [ 'ratecenternum' ],
6203 table => 'rate_center',
6205 { columns => [ 'custnum' ],
6206 table => 'cust_main',
6213 'ordernum', 'serial', '', '', '', '',
6214 'vendornum', 'int', '', '', '', '',
6215 'vendor_order_id', 'varchar', 'NULL', $char_d, '', '',
6216 'custnum', 'int', 'NULL', '', '', '',
6217 'submitted', 'int', '', '', '', '',
6218 'confirmed', 'int', 'NULL', '', '', '',
6219 'received', 'int', 'NULL', '', '', '',
6221 'primary_key' => 'ordernum',
6222 'unique' => [ [ 'vendornum', 'vendor_order_id' ] ],
6225 { columns => [ 'vendornum' ],
6226 table => 'did_vendor',
6228 { columns => [ 'custnum' ],
6229 table => 'cust_main',
6236 'typenum', 'serial', '', '', '', '',
6237 'class', 'char', '', 1, '', '',
6238 'type', 'varchar', '', $char_d, '', '',
6240 'primary_key' => 'typenum',
6247 'reasonnum', 'serial', '', '', '', '',
6248 'reason_type', 'int', '', '', '', '',
6249 'reason', 'text', '', '', '', '',
6250 'disabled', 'char', 'NULL', 1, '', '',
6251 'unsuspend_pkgpart', 'int', 'NULL', '', '', '',
6252 'unsuspend_hold','char', 'NULL', 1, '', '',
6253 'unused_credit', 'char', 'NULL', 1, '', '',
6254 'feepart', 'int', 'NULL', '', '', '',
6255 'fee_on_unsuspend','char', 'NULL', 1, '', '',
6256 'fee_hold', 'char', 'NULL', 1, '', '',
6258 'primary_key' => 'reasonnum',
6262 { columns => [ 'reason_type' ],
6263 table => 'reason_type',
6264 references => [ 'typenum' ],
6266 { columns => [ 'unsuspend_pkgpart' ],
6267 table => 'part_pkg',
6268 references => [ 'pkgpart' ],
6275 'confnum', 'serial', '', '', '', '',
6276 'agentnum', 'int', 'NULL', '', '', '',
6277 'locale', 'varchar','NULL', 16, '', '',
6278 'name', 'varchar', '', $char_d, '', '',
6279 'value', 'text', 'NULL', '', '', '',
6281 'primary_key' => 'confnum',
6282 'unique' => [ [ 'agentnum', 'locale', 'name' ] ],
6285 { columns => [ 'agentnum' ],
6293 'pkgrefnum', 'serial', '', '', '', '',
6294 'pkgnum', 'int', '', '', '', '',
6295 'refnum', 'int', '', '', '', '',
6297 'primary_key' => 'pkgrefnum',
6298 'unique' => [ [ 'pkgnum', 'refnum' ] ],
6299 'index' => [ [ 'pkgnum' ], [ 'refnum' ] ],
6301 { columns => [ 'pkgnum' ],
6302 table => 'cust_pkg',
6304 { columns => [ 'refnum' ],
6305 table => 'part_referral',
6312 'svcnum', 'int', '', '', '', '',
6313 'id', 'int', 'NULL', '', '', '',
6314 'uuid', 'char', 'NULL', 36, '', '',
6315 'title', 'varchar', 'NULL', $char_d, '', '',
6316 'max_extensions', 'int', 'NULL', '', '', '',
6317 'max_simultaneous', 'int', 'NULL', '', '', '',
6318 'ip_addr', 'varchar', 'NULL', 40, '', '',
6320 'primary_key' => 'svcnum',
6322 'index' => [ [ 'id' ], [ 'uuid' ] ],
6324 { columns => [ 'svcnum' ],
6325 table => 'cust_svc',
6330 'pbx_extension' => {
6332 'extensionnum', 'serial', '', '', '', '',
6333 'svcnum', 'int', '', '', '', '',
6334 'extension', 'varchar', '', $char_d, '', '',
6335 'pin', 'varchar', 'NULL', $char_d, '', '',
6336 'sip_password', 'varchar', 'NULL', $char_d, '', '',
6337 'phone_name', 'varchar', 'NULL', $char_d, '', '',
6339 'primary_key' => 'extensionnum',
6340 'unique' => [ [ 'svcnum', 'extension' ] ],
6341 'index' => [ [ 'svcnum' ] ],
6343 { columns => [ 'svcnum' ],
6351 'devicenum', 'serial', '', '', '', '',
6352 'devicepart', 'int', '', '', '', '',
6353 'svcnum', 'int', '', '', '', '',
6354 'mac_addr', 'varchar', 'NULL', 12, '', '',
6356 'primary_key' => 'devicenum',
6357 'unique' => [ [ 'mac_addr' ], ],
6358 'index' => [ [ 'devicepart' ], [ 'svcnum' ], ],
6360 { columns => [ 'devicepart' ],
6361 table => 'part_device',
6363 { columns => [ 'svcnum' ],
6369 'extension_device' => {
6371 'extensiondevicenum', 'serial', '', '', '', '',
6372 'extensionnum', 'int', '', '', '', '',
6373 'devicenum', 'int', '', '', '', '',
6375 'primary_key' => 'extensiondevicenum',
6376 'unique' => [ [ 'extensionnum', 'devicenum' ] ],
6377 'index' => [],#both? which way do we need to query?
6379 { columns => [ 'extensionnum' ],
6380 table => 'pbx_extension',
6382 { columns => [ 'devicenum' ],
6383 table => 'pbx_device',
6388 'svc_mailinglist' => { #svc_group?
6390 'svcnum', 'int', '', '', '', '',
6391 'username', 'varchar', '', $username_len, '', '',
6392 'domsvc', 'int', '', '', '', '',
6393 'listnum', 'int', '', '', '', '',
6394 'reply_to', 'char', 'NULL', 1, '', '',#SetReplyTo
6395 'remove_from', 'char', 'NULL', 1, '', '',#RemoveAuthor
6396 'reject_auto', 'char', 'NULL', 1, '', '',#RejectAuto
6397 'remove_to_and_cc', 'char', 'NULL', 1, '', '',#RemoveToAndCc
6399 'primary_key' => 'svcnum',
6401 'index' => [ ['username'], ['domsvc'], ['listnum'] ],
6403 { columns => [ 'svcnum' ],
6404 table => 'cust_svc',
6406 { columns => [ 'domsvc' ],
6407 table => 'svc_domain', #'cust_svc',
6408 references => [ 'svcnum' ],
6410 { columns => [ 'listnum' ],
6411 table => 'mailinglist',
6418 'listnum', 'serial', '', '', '', '',
6419 'listname', 'varchar', '', $char_d, '', '',
6421 'primary_key' => 'listnum',
6426 'mailinglistmember' => {
6428 'membernum', 'serial', '', '', '', '',
6429 'listnum', 'int', '', '', '', '',
6430 'svcnum', 'int', 'NULL', '', '', '',
6431 'contactemailnum', 'int', 'NULL', '', '', '',
6432 'email', 'varchar', 'NULL', 255, '', '',
6434 'primary_key' => 'membernum',
6436 'index' => [['listnum'],['svcnum'],['contactemailnum'],['email']],
6438 { columns => [ 'listnum' ],
6439 table => 'mailinglist',
6441 { columns => [ 'svcnum' ],
6442 table => 'svc_acct',
6444 { columns => [ 'contactemailnum' ],
6445 table => 'contact_email',
6452 'batchnum', 'serial', '', '', '', '',
6453 'agentnum', 'int', 'NULL', '', '', '',
6454 'status', 'char', 'NULL', '1', '', '',
6455 'pdf', 'blob', 'NULL', '', '', '',
6457 'primary_key' => 'batchnum',
6459 'index' => [ ['agentnum'] ],
6461 { columns => [ 'agentnum' ],
6467 'cust_bill_batch' => {
6469 'billbatchnum', 'serial', '', '', '', '',
6470 'batchnum', 'int', '', '', '', '',
6471 'invnum', 'int', '', '', '', '',
6473 'primary_key' => 'billbatchnum',
6475 'index' => [ [ 'batchnum' ], [ 'invnum' ] ],
6477 { columns => [ 'batchnum' ],
6478 table => 'bill_batch',
6480 { columns => [ 'invnum' ],
6481 table => 'cust_bill',
6486 'cust_bill_batch_option' => {
6488 'optionnum', 'serial', '', '', '', '',
6489 'billbatchnum', 'int', '', '', '', '',
6490 'optionname', 'varchar', '', $char_d, '', '',
6491 'optionvalue', 'text', 'NULL', '', '', '',
6493 'primary_key' => 'optionnum',
6495 'index' => [ [ 'billbatchnum' ], [ 'optionname' ] ],
6497 { columns => [ 'billbatchnum' ],
6498 table => 'cust_bill_batch',
6505 'msgnum', 'serial', '', '', '', '',
6506 'msgname', 'varchar', '', $char_d, '', '',
6507 'agentnum', 'int', 'NULL', '', '', '',
6508 'subject', 'varchar', 'NULL', 512, '', '',
6509 'mime_type', 'varchar', '', $char_d, '', '',
6510 'body', 'blob', 'NULL', '', '', '',
6511 'disabled', 'char', 'NULL', 1, '', '',
6512 # migrate these to msg_template_email
6513 'from_addr', 'varchar', 'NULL', 255, '', '',
6514 'bcc_addr', 'varchar', 'NULL', 255, '', '',
6515 # change to not null on v5
6516 'msgclass', 'varchar', 'NULL', 16, '', '',
6518 'primary_key' => 'msgnum',
6520 'index' => [ ['agentnum'], ],
6522 { columns => [ 'agentnum' ],
6528 'msg_template_http' => {
6530 'num', 'serial', '', '', '', '',
6531 'msgnum', 'int', '', '', '', '',
6532 'prepare_url', 'varchar', 'NULL', 255, '', '',
6533 'send_url', 'varchar', 'NULL', 255, '', '',
6534 'username', 'varchar', 'NULL', $char_d, '', '',
6535 'password', 'varchar', 'NULL', $char_d, '', '',
6536 'content', 'text', 'NULL', '', '', '',
6538 'primary_key' => 'num',
6539 'unique' => [ [ 'msgnum' ], ],
6542 { columns => [ 'msgnum' ],
6543 table => 'msg_template',
6548 'template_content' => {
6550 'contentnum', 'serial', '', '', '', '',
6551 'msgnum', 'int', '', '', '', '',
6552 'locale', 'varchar', 'NULL', 16, '', '',
6553 'subject', 'varchar', 'NULL', 512, '', '',
6554 'body', 'text', 'NULL', '', '', '',
6556 'primary_key' => 'contentnum',
6557 'unique' => [ ['msgnum', 'locale'] ],
6560 { columns => [ 'msgnum' ],
6561 table => 'msg_template',
6566 'template_image' => {
6568 'imgnum', 'serial', '', '', '', '',
6569 'name', 'varchar', '', $char_d, '', '',
6570 'agentnum', 'int', 'NULL', '', '', '',
6571 'mime_type', 'varchar', '', $char_d, '', '',
6572 'base64', 'text', '', '', '', '',
6574 'primary_key' => 'imgnum',
6576 'index' => [ ['name'], ['agentnum'] ],
6581 'custmsgnum', 'serial', '', '', '', '',
6582 'custnum', 'int', 'NULL', '', '', '',
6583 'msgnum', 'int', 'NULL', '', '', '',
6584 '_date', @date_type, '', '',
6585 'env_from', 'varchar', 'NULL', 255, '', '',
6586 'env_to', 'varchar', 'NULL', 255, '', '',
6587 'header', 'blob', 'NULL', '', '', '',
6588 'body', 'blob', 'NULL', '', '', '',
6589 'error', 'varchar', 'NULL', 255, '', '',
6590 'status', 'varchar', '',$char_d, '', '',
6591 'msgtype', 'varchar', 'NULL', 16, '', '',
6592 'preview', 'text', 'NULL', '', '', '',
6594 'primary_key' => 'custmsgnum',
6596 'index' => [ ['custnum'], ],
6598 { columns => [ 'custnum' ],
6599 table => 'cust_main',
6601 { columns => [ 'msgnum' ],
6602 table => 'msg_template',
6609 'svcnum', 'int', '', '', '', '',
6610 'recnum', 'int', 'NULL', '', '', '',
6611 'privatekey', 'text', 'NULL', '', '', '',
6612 'csr', 'text', 'NULL', '', '', '',
6613 'certificate', 'text', 'NULL', '', '', '',
6614 'cacert', 'text', 'NULL', '', '', '',
6615 'common_name', 'varchar', 'NULL', $char_d, '', '',
6616 'organization', 'varchar', 'NULL', $char_d, '', '',
6617 'organization_unit', 'varchar', 'NULL', $char_d, '', '',
6618 'city', 'varchar', 'NULL', $char_d, '', '',
6619 'state', 'varchar', 'NULL', $char_d, '', '',
6620 'country', 'char', 'NULL', 2, '', '',
6621 'cert_contact', 'varchar', 'NULL', $char_d, '', '',
6623 'primary_key' => 'svcnum',
6625 'index' => [], #recnum
6627 { columns => [ 'svcnum' ],
6628 table => 'cust_svc',
6630 { columns => [ 'recnum' ],
6631 table => 'domain_record',
6638 'svcnum', 'int', '', '', '', '',
6639 'serviceid', 'varchar', '', 64, '', '', #srvexport / reportfields
6641 'primary_key' => 'svcnum',
6643 'index' => [], #recnum
6645 { columns => [ 'svcnum' ],
6646 table => 'cust_svc',
6653 'areanum', 'serial', '', '', '', '',
6654 'code', 'char', '', 3, '', '',
6655 'country', 'char', 'NULL', 2, '', '',
6656 'state', 'char', 'NULL', 2, '', '',
6657 'description','varchar', 'NULL', 255, '', '',
6659 'primary_key' => 'areanum',
6660 'unique' => [ [ 'areanum' ] ],
6664 'upgrade_journal' => {
6666 'upgradenum', 'serial', '', '', '', '',
6667 '_date', 'int', '', '', '', '',
6668 'upgrade', 'varchar', '', $char_d, '', '',
6669 'status', 'varchar', '', $char_d, '', '',
6670 'statustext', 'varchar', 'NULL', $char_d, '', '',
6672 'primary_key' => 'upgradenum',
6674 'index' => [ [ 'upgrade' ] ],
6677 'upload_target' => {
6679 'targetnum', 'serial', '', '', '', '',
6680 'agentnum', 'int', 'NULL', '', '', '',
6681 'protocol', 'varchar', '', 10, '', '',
6682 'hostname', 'varchar', '', $char_d, '', '',
6683 'port', 'int', 'NULL', '', '', '',
6684 'username', 'varchar', '', $char_d, '', '',
6685 'password', 'varchar', 'NULL', $char_d, '', '',
6686 'path', 'varchar', 'NULL', $char_d, '', '',
6687 'subject', 'varchar', 'NULL', '255', '', '',
6688 'handling', 'varchar', 'NULL', $char_d, '', '',
6690 'primary_key' => 'targetnum',
6691 'unique' => [ [ 'targetnum' ] ],
6694 { columns => [ 'agentnum' ],
6702 'lognum', 'serial', '', '', '', '',
6703 '_date', 'int', '', '', '', '',
6704 'agentnum', 'int', 'NULL', '', '', '',
6705 'tablename', 'varchar', 'NULL', $char_d, '', '',
6706 'tablenum', 'int', 'NULL', '', '', '',
6707 'level', 'int', '', '', '', '',
6708 'message', 'text', '', '', '', '',
6710 'primary_key' => 'lognum',
6712 'index' => [ ['_date'], ['level'] ],
6714 { columns => [ 'agentnum' ],
6722 'logcontextnum', 'serial', '', '', '', '',
6723 'lognum', 'int', '', '', '', '',
6724 'context', 'varchar', '', $char_d, '', '',
6726 'primary_key' => 'logcontextnum',
6727 'unique' => [ [ 'lognum', 'context' ] ],
6730 { columns => [ 'lognum' ],
6738 'logemailnum', 'serial', '', '', '', '',
6739 'context', 'varchar', 'NULL', $char_d, '', '',
6740 'min_level', 'int', 'NULL', '', '', '',
6741 'msgnum', 'int', '', '', '', '',
6742 'to_addr', 'varchar', 'NULL', 255, '', '',
6743 'context_height', 'int', 'NULL', '', '', '',
6745 'primary_key' => 'logemailnum',
6747 'index' => [ ['context'], ['min_level'] ],
6749 { columns => [ 'msgnum' ],
6750 table => 'msg_template',
6751 references => [ 'msgnum' ],
6758 # name type null length default local
6759 'svcnum', 'int', '', '', '', '',
6760 'alarmsystemnum', 'int', '', '', '', '',
6761 'alarmtypenum', 'int', '', '', '', '',
6762 'alarmstationnum', 'int', '', '', '', '',
6763 'acctnum', 'varchar', '', $char_d, '', '',
6764 '_password', 'varchar', '', $char_d, '', '',
6765 'location', 'varchar', 'NULL', $char_d, '', '',
6766 'cs_receiver', 'int', 'NULL', '', '', '',
6767 'cs_phonenum', 'varchar', 'NULL', $char_d, '', '',
6768 'serialnum', 'varchar', 'NULL', $char_d, '', '',
6771 'primary_key' => 'svcnum',
6775 { columns => [ 'svcnum' ],
6776 table => 'cust_svc',
6778 { columns => [ 'alarmsystemnum' ],
6779 table => 'alarm_system',
6781 { columns => [ 'alarmtypenum' ],
6782 table => 'alarm_type',
6784 { columns => [ 'alarmstationnum' ],
6785 table => 'alarm_station',
6790 'alarm_system' => { #vendors
6792 'alarmsystemnum', 'serial', '', '', '', '',
6793 'agentnum', 'int', 'NULL', '', '', '',
6794 'systemname', 'varchar', '', $char_d, '', '',
6795 'disabled', 'char', 'NULL', 1, '', '',
6797 'primary_key' => 'alarmsystemnum',
6798 'unique' => [ ['agentnum', 'systemname'] ],
6799 'index' => [ ['agentnum'], ['disabled'] ],
6801 { columns => [ 'agentnum' ],
6807 'alarm_type' => { #inputs and outputs
6809 'alarmtypenum', 'serial', '', '', '', '',
6810 'agentnum', 'int', 'NULL', '', '', '',
6811 'inputs', 'int', '', '', '', '',
6812 'outputs', 'int', '', '', '', '',
6813 'disabled', 'char', 'NULL', 1, '', '',
6815 'primary_key' => 'alarmtypenum',
6816 'unique' => [ ['agentnum', 'inputs', 'outputs'] ],
6817 'index' => [ ['agentnum'], ['disabled'] ],
6819 { columns => [ 'agentnum' ],
6825 'alarm_station' => { #central station (where the alarm reports to)
6827 'alarmstationnum', 'serial', '', '', '', '',
6828 'agentnum', 'int', 'NULL', '', '', '',
6829 'stationname', 'varchar', '', $char_d, '', '',
6830 'disabled', 'char', 'NULL', 1, '', '',
6832 'primary_key' => 'alarmstationnum',
6833 'unique' => [ ['agentnum', 'stationname'], ],
6834 'index' => [ ['agentnum'], ['disabled'] ],
6836 { columns => [ 'agentnum' ],
6844 'svcnum', 'int', '', '', '', '',
6845 'providernum', 'int', 'NULL', '', '', '',
6846 'ordernum', 'varchar', 'NULL', $char_d, '', '',
6847 'modelnum', 'int', 'NULL', '', '', '',
6848 'serialnum', 'varchar', 'NULL', $char_d, '', '',
6849 'mac_addr', 'varchar', 'NULL', 12, '', '',
6851 'primary_key' => 'svcnum',
6852 'unique' => [ ['modelnum', 'serialnum'] , ['mac_addr'] ],
6855 { columns => [ 'svcnum' ],
6856 table => 'cust_svc',
6858 { columns => [ 'providernum' ],
6859 table => 'cable_provider',
6861 { columns => [ 'modelnum' ],
6862 table => 'cable_model',
6869 'modelnum', 'serial', '', '', '', '',
6870 'model_name', 'varchar', '', $char_d, '', '',
6871 'disabled', 'char', 'NULL', 1, '', '',
6873 'primary_key' => 'modelnum',
6874 'unique' => [ [ 'model_name' ], ],
6878 'cable_provider' => {
6880 'providernum', 'serial', '', '', '', '',
6881 'provider', 'varchar', '', $char_d, '', '',
6882 'disabled', 'char', 'NULL', 1, '', '',
6884 'primary_key' => 'providernum',
6885 'unique' => [ [ 'provider' ], ],
6889 'svc_conferencing' => {
6891 'svcnum', 'int', '', '', '', '',
6892 'conf_id', 'int', 'NULL', '', '', '', #"system assigned"
6893 'conf_name', 'varchar', '', $char_d, '', '',
6894 'conf_password', 'varchar', '', $char_d, '', '',
6895 'access_code', 'varchar', '', 16, '', '',
6896 'duration', 'int', '', '', '', '',
6897 'participants', 'int', '', '', '', '',
6898 'conftypenum', 'int', '', '', '', '',
6899 'confqualitynum', 'int', '', '', '', '',
6900 'opt_recording', 'char', 'NULL', 1, '', '',
6901 'opt_sip', 'char', 'NULL', 1, '', '',
6902 'opt_phone', 'char', 'NULL', 1, '', '',
6904 'primary_key' => 'svcnum',
6908 { columns => [ 'svcnum' ],
6909 table => 'cust_svc',
6911 { columns => [ 'conftypenum' ],
6912 table => 'conferencing_type',
6914 { columns => [ 'confqualitynum' ],
6915 table => 'conferencing_quality',
6920 'conferencing_type' => {
6922 'conftypenum', 'int', '', '', '', '',
6923 'typeid' , 'int', '', '', '', '',
6924 'typename', 'varchar', '', $char_d, '', '',
6925 'disabled', 'char', 'NULL', 1, '', '',
6927 'primary_key' => 'conftypenum',
6928 'unique' => [ [ 'typeid', 'disabled' ], [ 'typename', 'disabled' ] ],
6932 'conferencing_quality' => {
6934 'confqualitynum', 'int', '', '', '', '',
6935 'qualityid' , 'int', '', '', '', '',
6936 'qualityname', 'varchar', '', $char_d, '', '',
6937 'disabled', 'char', 'NULL', 1, '', '',
6939 'primary_key' => 'confqualitynum',
6940 'unique' => [ [ 'qualityid', 'disabled' ], [ 'qualityname', 'disabled' ] ],
6946 'svcnum', 'int', '', '', '', '',
6947 'smartcard_num', 'varchar', '', 16, '', '',
6948 'mac_addr', 'varchar', '', 12, '', '',
6949 'duration', 'int', '', '', '', '',
6951 'primary_key' => 'svcnum',
6952 'unique' => [], # [ 'smartcard_num' ], [ 'mac_addr' ], ],
6955 { columns => [ 'svcnum' ],
6956 table => 'cust_svc',
6963 'typenum', 'serial', '', '', '', '',
6964 'typename', 'varchar', '', $char_d, '', '',
6965 'disabled', 'char', 'NULL', 1, '', '',
6966 # speed? number of voice lines? anything else?
6968 'primary_key' => 'typenum',
6969 'unique' => [ [ 'typename' ] ],
6973 'circuit_provider' => {
6975 'providernum', 'serial', '', '', '', '',
6976 'provider', 'varchar', '', $char_d, '', '',
6977 'disabled', 'char', 'NULL', 1, '', '',
6979 'primary_key' => 'providernum',
6980 'unique' => [ [ 'provider' ], ],
6984 'circuit_termination' => {
6986 'termnum', 'serial', '', '', '', '',
6987 'termination','varchar', '', $char_d, '', '',
6988 'disabled', 'char', 'NULL', 1, '', '',
6990 'primary_key' => 'termnum',
6991 'unique' => [ [ 'termination' ] ],
6997 'svcnum', 'int', '', '', '', '',
6998 'typenum', 'int', '', '', '', '',
6999 'providernum', 'int', '', '', '', '',
7000 'termnum', 'int', '', '', '', '',
7001 'circuit_id', 'varchar', '', 64, '', '',
7002 'desired_due_date', 'int', 'NULL', '', '', '',
7003 'due_date', 'int', 'NULL', '', '', '',
7004 'vendor_order_id', 'varchar', 'NULL', $char_d, '', '',
7005 'vendor_qual_id', 'varchar', 'NULL', $char_d, '', '',
7006 'vendor_order_type', 'varchar', 'NULL', $char_d, '', '',
7007 'vendor_order_status', 'varchar', 'NULL', $char_d, '', '',
7008 'endpoint_ip_addr', 'varchar', 'NULL', 40, '', '',
7009 'endpoint_mac_addr', 'varchar', 'NULL', 12, '', '',
7010 'internal_circuit_id', 'varchar', 'NULL', 64, '', '',
7012 'primary_key' => 'svcnum',
7014 'index' => [ [ 'providernum' ], [ 'typenum' ] ],
7016 { columns => [ 'svcnum' ],
7017 table => 'cust_svc',
7019 { columns => [ 'typenum' ],
7020 table => 'circuit_type',
7022 { columns => [ 'providernum' ],
7023 table => 'circuit_provider',
7025 { columns => [ 'termnum' ],
7026 table => 'circuit_termination',
7033 'svcnum', 'int', '', '', '', '',
7034 'oltnum', 'int', 'NULL', '', '', '',
7035 'shelf', 'int', 'NULL', '', '', '',
7036 'card', 'int', 'NULL', '', '', '',
7037 'olt_port', 'int', 'NULL', '', '', '',
7038 'ont_id', 'int', 'NULL', '', '', '',
7039 'ont_typenum', 'int', 'NULL', '', '', '',
7040 'ont_serial', 'varchar', 'NULL', $char_d, '', '',
7041 'ont_port', 'varchar', 'NULL', 16, '', '',
7042 'circuit_id', 'varchar', 'NULL', $char_d, '', '',
7043 'vlan', 'int', 'NULL', '', '', '',
7044 'signal', 'decimal', 'NULL', '10,2', '', '',
7045 'speed_up', 'int', 'NULL', '', '', '',
7046 'speed_down', 'int', 'NULL', '', '', '',
7047 'ont_install','varchar', 'NULL', $char_d, '', '',
7049 'primary_key' => 'svcnum',
7051 'index' => [ [ 'ont_serial' ] ],
7053 { columns => [ 'svcnum' ],
7054 table => 'cust_svc',
7056 { columns => [ 'oltnum' ],
7057 table => 'fiber_olt',
7059 { columns => [ 'ont_typenum' ],
7060 table => 'hardware_type',
7061 references => [ 'typenum' ],
7068 'oltnum', 'serial', '', '', '', '',
7069 'oltname', 'varchar', '', $char_d, '', '',
7070 'sitenum', 'int', 'NULL', '', '', '',
7071 'serial', 'varchar', '', $char_d, '', '',
7072 'disabled', 'char', 'NULL', 1, '', '',
7074 'primary_key' => 'oltnum',
7078 { columns => [ 'sitenum' ],
7079 table => 'olt_site',
7086 'sitenum', 'serial', '', '', '', '',
7087 'market', 'varchar', '', $char_d, '', '',
7088 'site', 'varchar', '', $char_d, '', '',
7090 'primary_key' => 'sitenum',
7091 'unique' => [ [ 'market', 'site' ] ],
7101 'vendnum', 'serial', '', '', '', '',
7102 'vendname', 'varchar', '', $char_d, '', '',
7103 'classnum', 'int', '', '', '', '',
7104 'disabled', 'char', 'NULL', 1, '', '',
7106 'primary_key' => 'vendnum',
7107 'unique' => [ ['vendname', 'disabled'] ],
7110 { columns => [ 'classnum' ],
7111 table => 'vend_class',
7118 'classnum', 'serial', '', '', '', '',
7119 'classname', 'varchar', '', $char_d, '', '',
7120 'disabled', 'char', 'NULL', 1, '', '',
7122 'primary_key' => 'classnum',
7124 'index' => [ ['disabled'] ],
7129 'vendbillnum', 'serial', '', '', '', '',
7130 'vendnum', 'int', '', '', '', '',
7131 #'_date', @date_type, '', '',
7132 '_date', 'int', '', '', '', '',
7133 'charged', @money_type, '', '',
7135 'primary_key' => 'vendbillnum',
7137 'index' => [ ['vendnum'], ['_date'], ],
7139 { columns => [ 'vendnum' ],
7140 table => 'vend_main',
7147 'vendpaynum', 'serial', '', '', '', '',
7148 'vendnum', 'int', '', '', '', '',
7149 #'_date', @date_type, '', '',
7150 '_date', 'int', '', '', '', '',
7151 'paid', @money_type, '', '',
7153 'primary_key' => 'vendpaynum',
7155 'index' => [ [ 'vendnum' ], [ '_date' ], ],
7157 { columns => [ 'vendnum' ],
7158 table => 'vend_main',
7163 'vend_bill_pay' => {
7165 'vendbillpaynum', 'serial', '', '', '', '',
7166 'vendbillnum', 'int', '', '', '', '',
7167 'vendpaynum', 'int', '', '', '', '',
7168 'amount', @money_type, '', '',
7169 #? '_date', @date_type, '', '',
7171 'primary_key' => 'vendbillpaynum',
7173 'index' => [ [ 'vendbillnum' ], [ 'vendpaynum' ] ],
7175 { columns => [ 'vendbillnum' ],
7176 table => 'vend_bill',
7178 { columns => [ 'vendpaynum' ],
7179 table => 'vend_pay',
7184 %{ tables_hashref_torrus() },
7186 # tables of ours for doing torrus virtual port combining
7187 'torrus_srvderive' => {
7189 'derivenum', 'serial', '', '', '', '',
7190 'serviceid', 'varchar', '', 64, '', '', #srvexport / reportfields
7191 'last_srv_date', 'date', 'NULL', '', '', '',
7193 'primary_key' => 'derivenum',
7194 'unique' => [ ['serviceid'] ],
7198 'torrus_srvderive_component' => {
7200 'componentnum', 'serial', '', '', '', '',
7201 'derivenum', 'int', '', '', '', '',
7202 'serviceid', 'varchar', '', 64, '', '', #srvexport / reportfields
7204 'primary_key' => 'componentnum',
7205 'unique' => [ [ 'derivenum', 'serviceid' ], ],
7206 'index' => [ [ 'derivenum', ], ],
7208 { columns => [ 'derivenum' ],
7209 table => 'torrus_srvderive',
7216 'modenum', 'serial', '', '', '', '',
7217 'agentnum', 'int', 'NULL', '', '', '',
7218 'modename', 'varchar', '', 32, '', '',
7220 'primary_key' => 'modenum',
7224 { columns => [ 'agentnum' ],
7232 'confnum', 'serial', '', '', '', '',
7233 'modenum', 'int', '', '', '', '',
7234 'locale', 'varchar', 'NULL', 16, '', '',
7235 'notice_name', 'varchar', 'NULL', 64, '', '',
7236 'subject', 'varchar', 'NULL', 64, '', '',
7237 'htmlnotes', 'text', 'NULL', '', '', '',
7238 'htmlfooter', 'text', 'NULL', '', '', '',
7239 'htmlsummary', 'text', 'NULL', '', '', '',
7240 'htmlreturnaddress', 'text', 'NULL', '', '', '',
7241 'latexnotes', 'text', 'NULL', '', '', '',
7242 'latexfooter', 'text', 'NULL', '', '', '',
7243 'latexsummary', 'text', 'NULL', '', '', '',
7244 'latexsmallfooter', 'text', 'NULL', '', '', '',
7245 'latexreturnaddress', 'text', 'NULL', '', '', '',
7246 'with_latexcoupon', 'char', 'NULL', '1', '', '',
7247 'htmlwatermark', 'text', 'NULL', '', '', '',
7248 'latexwatermark', 'text', 'NULL', '', '', '',
7249 'lpr', 'varchar', 'NULL', $char_d, '', '',
7251 'primary_key' => 'confnum',
7252 'unique' => [ [ 'modenum', 'locale' ] ],
7255 { columns => [ 'modenum' ],
7256 table => 'invoice_mode',
7263 'batchnum', 'serial', '', '', '', '',
7264 'exportnum', 'int', '', '', '', '',
7265 '_date', 'int', '', '', '', '',
7266 'status', 'varchar', 'NULL', 32, '', '',
7267 'statustext', 'text', 'NULL', '', '', '',
7269 'primary_key' => 'batchnum',
7271 'index' => [ [ 'exportnum' ], [ 'status' ] ],
7273 { columns => [ 'exportnum' ],
7274 table => 'part_export',
7275 references => [ 'exportnum' ]
7280 'export_batch_item' => {
7282 'itemnum', 'serial', '', '', '', '',
7283 'batchnum', 'int', '', '', '', '',
7284 'svcnum', 'int', '', '', '', '',
7285 'action', 'varchar', '', 32, '', '',
7286 'data', 'text', 'NULL', '', '', '',
7287 'frozen', 'char', 'NULL', 1, '', '',
7289 'primary_key' => 'itemnum',
7291 'index' => [ [ 'batchnum' ], [ 'svcnum' ] ],
7293 { columns => [ 'batchnum' ],
7294 table => 'export_batch',
7295 references => [ 'batchnum' ]
7300 # lookup table for states, similar to msa and lata
7303 'statenum', 'int', '', '', '', '',
7304 'country', 'char', '', 2, '', '',
7305 'state', 'char', '', $char_d, '', '',
7306 'fips', 'char', '', 3, '', '',
7308 'primary_key' => 'statenum',
7309 'unique' => [ [ 'country', 'state' ], ],
7313 # eventually link to tower/sector?
7316 'zonenum', 'serial', '', '', '', '',
7317 'description', 'char', 'NULL', $char_d, '', '',
7318 'agentnum', 'int', '', '', '', '',
7319 'censusyear', 'char', 'NULL', 4, '', '',
7320 'dbaname', 'char', 'NULL', $char_d, '', '',
7321 'zonetype', 'char', '', 1, '', '',
7322 'technology', 'int', '', '', '', '',
7323 'spectrum', 'int', 'NULL', '', '', '',
7324 'adv_speed_up', 'decimal', '', '10,3', '0', '',
7325 'adv_speed_down', 'decimal', '', '10,3', '0', '',
7326 'cir_speed_up', 'decimal', '', '10,3', '0', '',
7327 'cir_speed_down', 'decimal', '', '10,3', '0', '',
7328 'is_broadband', 'char', 'NULL', 1, '', '',
7329 'is_voice', 'char', 'NULL', 1, '', '',
7330 'is_consumer', 'char', 'NULL', 1, '', '',
7331 'is_business', 'char', 'NULL', 1, '', '',
7332 'active_date', @date_type, '', '',
7333 'expire_date', @date_type, '', '',
7335 'primary_key' => 'zonenum',
7337 'index' => [ [ 'agentnum' ] ],
7339 { columns => [ 'agentnum' ],
7341 references => [ 'agentnum' ],
7346 'deploy_zone_block' => {
7348 'blocknum', 'serial', '', '', '', '',
7349 'zonenum', 'int', '', '', '', '',
7350 'censusblock', 'char', '', 15, '', '',
7351 'censusyear', 'char','NULL', 4, '', '',
7353 'primary_key' => 'blocknum',
7355 'index' => [ [ 'zonenum' ] ],
7357 { columns => [ 'zonenum' ],
7358 table => 'deploy_zone',
7359 references => [ 'zonenum' ],
7364 'deploy_zone_vertex' => {
7366 'vertexnum', 'serial', '', '', '', '',
7367 'zonenum', 'int', '', '', '', '',
7368 'latitude', 'decimal', '', '10,7', '', '',
7369 'longitude', 'decimal', '', '10,7', '', '',
7371 'primary_key' => 'vertexnum',
7375 { columns => [ 'zonenum' ],
7376 table => 'deploy_zone',
7377 references => [ 'zonenum' ],
7384 'cacti_pagenum', 'serial', '', '', '', '',
7385 'exportnum', 'int', 'NULL', '', '', '',
7386 'svcnum', 'int', 'NULL', '', '', '',
7387 'graphnum', 'int', 'NULL', '', '', '',
7388 'imported', @date_type, '', '',
7389 'content', 'text', 'NULL', '', '', '',
7390 'thumbnail', 'text', 'NULL', '', '', '',
7392 'primary_key' => 'cacti_pagenum',
7394 'index' => [ ['svcnum'], ['imported'] ],
7396 { columns => [ 'svcnum' ],
7397 table => 'cust_svc',
7398 references => [ 'svcnum' ],
7400 { columns => [ 'exportnum' ],
7401 table => 'part_export',
7402 references => [ 'exportnum' ],
7409 'reportbatchnum', 'serial', '', '', '', '',
7410 'reportname', 'varchar', '', 255, '', '',
7411 'agentnum', 'int', 'NULL', '', '', '',
7412 'send_date', @date_type, '', '',
7413 'sdate', @date_type, '', '',
7414 'edate', @date_type, '', '',
7415 'usernum', 'int', 'NULL', '', '', '',
7416 'msgnum', 'int', 'NULL', '', '', '',
7417 # add report params here as necessary
7419 'primary_key' => 'reportbatchnum',
7423 { columns => [ 'agentnum' ],
7425 references => [ 'agentnum' ],
7427 { columns => [ 'usernum' ],
7428 table => 'access_user',
7429 references => [ 'usernum' ],
7431 { columns => [ 'msgnum' ],
7432 table => 'msg_template',
7433 references => [ 'msgnum' ],
7438 'password_history' => {
7440 'passwordnum', 'serial', '', '', '', '',
7441 '_password', 'varchar', 'NULL', $char_d, '', '',
7442 'encryption_method', 'varchar', 'NULL', $char_d, '', '',
7443 'created', @date_type, '', '',
7444 # each table that needs password history gets a column here, and
7445 # an entry in foreign_keys.
7446 'svc_acct__svcnum', 'int', 'NULL', '', '', '',
7447 'svc_dsl__svcnum', 'int', 'NULL', '', '', '',
7448 'svc_alarm__svcnum', 'int', 'NULL', '', '', '',
7449 'agent__agentnum', 'int', 'NULL', '', '', '',
7450 'contact__contactnum', 'int', 'NULL', '', '', '',
7451 'access_user__usernum', 'int', 'NULL', '', '', '',
7453 'primary_key' => 'passwordnum',
7457 { columns => [ 'svc_acct__svcnum' ],
7458 table => 'svc_acct',
7459 references => [ 'svcnum' ],
7461 { columns => [ 'svc_dsl__svcnum' ],
7463 references => [ 'svcnum' ],
7465 { columns => [ 'svc_alarm__svcnum' ],
7466 table => 'svc_alarm',
7467 references => [ 'svcnum' ],
7469 { columns => [ 'agent__agentnum' ],
7471 references => [ 'agentnum' ],
7473 { columns => [ 'contact__contactnum' ],
7475 references => [ 'contactnum' ],
7477 { columns => [ 'access_user__usernum' ],
7478 table => 'access_user',
7479 references => [ 'usernum' ],
7484 'webservice_log' => {
7486 'webservicelognum', 'serial', '', '', '', '', #big? hubrus
7487 'svcnum', 'int', 'NULL', '', '', '', #just in case
7488 'custnum', 'int', '', '', '', '',
7489 'method', 'varchar', '', $char_d, '', '',
7490 'quantity', 'int', '', '', '', '', #i.e. pages
7491 '_date', @date_type, '', '',
7492 'status', 'varchar', 'NULL', $char_d, '', '',
7493 'rated_price', 'decimal', 'NULL', '10,2', '', '',
7495 'primary_key' => 'webservicelognum',
7497 'index' => [ ['custnum'], ['status'] ],
7499 { columns => [ 'custnum' ],
7500 table => 'cust_main',
7502 #no FK on svcnum... we don't want to purge these on
7507 'rt_field_charge' => {
7509 'rtfieldchargenum', 'serial', '', '', '', '',
7510 'pkgnum', 'int', '', '', '', '',
7511 'ticketid', 'int', '', '', '', '',
7512 'rate', @money_type, '', '',
7513 'units', 'decimal', '', '10,4', '', '',
7514 'charge', @money_type, '', '',
7515 '_date', @date_type, '', '',
7517 'primary_key' => 'rtfieldchargenum',
7519 'index' => [ ['pkgnum', 'ticketid'] ],
7521 { columns => [ 'pkgnum' ],
7522 table => 'cust_pkg',
7529 'searchnum', 'serial', '', '', '', '',
7530 'usernum', 'int', 'NULL', '', '', '',
7531 'searchname', 'varchar', '', $char_d, '', '',
7532 'path', 'varchar', '', $char_d, '', '',
7533 'params', 'text', 'NULL', '', '', '',
7534 'disabled', 'char', 'NULL', 1, '', '',
7535 'freq', 'varchar', 'NULL', 16, '', '',
7536 'last_sent', 'int', 'NULL', '', '', '',
7537 'format', 'varchar', 'NULL', 32, '', '',
7539 'primary_key' => 'searchnum',
7543 { columns => [ 'usernum' ],
7544 table => 'access_user',
7551 'svcnum', 'int', '', '', '', '',
7552 'max_accounts', 'int', '', '', '', '',
7554 'primary_key' => 'svcnum',
7558 { columns => [ 'svcnum' ],
7559 table => 'cust_svc',
7565 # name type nullability length default local
7569 # 'num', 'serial', '', '', '', '',
7571 # 'primary_key' => 'num',