my $cust_main = $dbdef->table('cust_main');
unless ($ship) { #remove ship_ from cust_main
$cust_main->delcolumn($_) foreach ( grep /^ship_/, $cust_main->columns );
-} else { #add indices on ship_last and ship_company
- push @{$cust_main->index->lol_ref}, ( ['ship_last'], ['ship_company'] )
+} else { #add indices
+ push @{$cust_main->index->lol_ref},
+ map { [ "ship_$_" ] } qw( last company daytime night fax );
}
#add radius attributes to svc_acct
'default' => '',
'local' => '',
} ),
- map { $tableobj->column($_) } $tableobj->columns
+ map {
+ my $column = $tableobj->column($_);
+
+ #clone so as to not disturb the original
+ $column = DBIx::DBSchema::Column->new( {
+ map { $_ => $column->$_() }
+ qw( name type null length default local )
+ } );
+
+ $column->type('int')
+ if $column->type eq 'serial';
+ #$column->default('')
+ # if $column->default =~ /^nextval\(/i;
+ #( my $local = $column->local ) =~ s/AUTO_INCREMENT//i;
+ #$column->local($local);
+ $column;
+ } $tableobj->columns
],
} );
$dbdef->addtable($h_tableobj);
[ 'COMP', 'Comp invoice', '$cust_bill->comp();', 30, 'comp' ],
[ 'CARD', 'Batch card', '$cust_bill->batch_card();', 40, 'batch-card' ],
[ 'BILL', 'Send invoice', '$cust_bill->send();', 50, 'send' ],
+ [ 'DCRD', 'Send invoice', '$cust_bill->send();', 50, 'send' ],
+ [ 'DCHK', 'Send invoice', '$cust_bill->send();', 50, 'send' ],
) {
my $part_bill_event = new FS::part_bill_event({
],
'primary_key' => 'invnum',
'unique' => [],
- 'index' => [ ['custnum'] ],
+ 'index' => [ ['custnum'], ['_date'] ],
},
'cust_bill_event' => {
'recur', @money_type,
'sdate', @date_type,
'edate', @date_type,
+ 'itemdesc', 'varchar', 'NULL', $char_d,
],
'primary_key' => '',
- 'unique' => [ ['pkgnum', 'invnum'] ],
+ 'unique' => [],
'index' => [ ['invnum'] ],
},
+ 'cust_bill_pkg_detail' => {
+ 'columns' => [
+ 'detailnum', 'serial', '', '',
+ 'pkgnum', 'int', '', '',
+ 'invnum', 'int', '', '',
+ 'detail', 'varchar', '', $char_d,
+ ],
+ 'primary_key' => 'detailnum',
+ 'unique' => [],
+ 'index' => [ [ 'pkgnum', 'invnum' ] ],
+ },
+
'cust_credit' => {
'columns' => [
'crednum', 'serial', '', '',
'last', 'varchar', '', $char_d,
# 'middle', 'varchar', 'NULL', $char_d,
'first', 'varchar', '', $char_d,
- 'ss', 'char', 'NULL', 11,
+ 'ss', 'varchar', 'NULL', 11,
'company', 'varchar', 'NULL', $char_d,
'address1', 'varchar', '', $char_d,
'address2', 'varchar', 'NULL', $char_d,
'primary_key' => 'custnum',
'unique' => [],
#'index' => [ ['last'], ['company'] ],
- 'index' => [ ['last'], [ 'company' ], [ 'referral_custnum' ] ],
+ 'index' => [ ['last'], [ 'company' ], [ 'referral_custnum' ],
+ [ 'daytime' ], [ 'night' ], [ 'fax' ],
+ ],
},
'cust_main_invoice' => {
'taxclass', 'varchar', 'NULL', $char_d,
'exempt_amount', @money_type,
'tax', 'real', '', '', #tax %
+ 'taxname', 'varchar', 'NULL', $char_d,
],
'primary_key' => 'taxnum',
'unique' => [],
'_date', @date_type,
'payby', 'char', '', 4, # CARD/BILL/COMP, should be index into
# payment type table.
- 'payinfo', 'varchar', 'NULL', 16, #see cust_main above
+ 'payinfo', 'varchar', 'NULL', $char_d, #see cust_main above
'paybatch', 'varchar', 'NULL', $char_d, #for auditing purposes.
'closed', 'char', 'NULL', 1,
],
'otaker', 'varchar', '', 32,
'setup', @date_type,
'bill', @date_type,
+ 'last_bill', @date_type,
'susp', @date_type,
'cancel', @date_type,
'expire', @date_type,
'reason', 'varchar', '', $char_d,
'payby', 'char', '', 4, # CARD/BILL/COMP, should be index
# into payment type table.
- 'payinfo', 'varchar', 'NULL', 16, #see cust_main above
+ 'payinfo', 'varchar', 'NULL', $char_d, #see cust_main above
'paybatch', 'varchar', 'NULL', $char_d,
'closed', 'char', 'NULL', 1,
],
],
'primary_key' => 'pkgpart',
'unique' => [],
- 'index' => [],
+ 'index' => [ [ 'disabled' ], ],
},
# 'part_title' => {
],
'primary_key' => 'svcpart',
'unique' => [],
- 'index' => [],
+ 'index' => [ [ 'disabled' ] ],
},
'part_svc_column' => {
'columns' => [
'svcnum', 'int', '', '',
'username', 'varchar', '', $username_len, #unique (& remove dup code)
- '_password', 'varchar', '', 50, #13 for encryped pw's plus ' *SUSPENDED* (mp5 passwords can be 34)
+ '_password', 'varchar', '', 72, #13 for encryped pw's plus ' *SUSPENDED* (md5 passwords can be 34, blowfish 60)
'sec_phrase', 'varchar', 'NULL', $char_d,
'popnum', 'int', 'NULL', '',
'uid', 'int', 'NULL', '',
'columns' => [
'recnum', 'serial', '', '',
'svcnum', 'int', '', '',
- 'reczone', 'varchar', '', $char_d,
+ #'reczone', 'varchar', '', $char_d,
+ 'reczone', 'varchar', '', 255,
'recaf', 'char', '', 2,
- 'rectype', 'char', '', 5,
- 'recdata', 'varchar', '', $char_d,
+ 'rectype', 'varchar', '', 5,
+ #'recdata', 'varchar', '', $char_d,
+ 'recdata', 'varchar', '', 255,
],
'primary_key' => 'recnum',
'unique' => [],
'index' => [],
},
- 'ac_type' => {
+ 'router' => {
'columns' => [
- 'actypenum', 'serial', '', '',
- 'actypename', 'varchar', '', $char_d,
+ 'routernum', 'serial', '', '',
+ 'routername', 'varchar', '', $char_d,
+ 'svcnum', 'int', 'NULL', '',
],
- 'primary_key' => 'actypenum',
+ 'primary_key' => 'routernum',
'unique' => [],
'index' => [],
},
- 'ac' => {
- 'columns' => [
- 'acnum', 'serial', '', '',
- 'actypenum', 'int', '', '',
- 'acname', 'varchar', '', $char_d,
- ],
- 'primary_key' => 'acnum',
- 'unique' => [],
- 'index' => [ [ 'actypenum' ] ],
- },
-
- 'part_ac_field' => {
+ 'part_svc_router' => {
'columns' => [
- 'acfieldpart', 'serial', '', '',
- 'actypenum', 'int', '', '',
- 'name', 'varchar', '', $char_d,
- 'ut_type', 'varchar', '', $char_d,
- ],
- 'primary_key' => 'acfieldpart',
- 'unique' => [],
- 'index' => [ [ 'actypenum' ] ],
- },
-
- 'ac_field' => {
- 'columns' => [
- 'acfieldpart', 'int', '', '',
- 'acnum', 'int', '', '',
- 'value', 'text', '', '',
+ 'svcpart', 'int', '', '',
+ 'routernum', 'int', '', '',
],
'primary_key' => '',
- 'unique' => [ [ 'acfieldpart', 'acnum' ] ],
- 'index' => [ [ 'acnum' ] ],
+ 'unique' => [],
+ 'index' => [],
},
- 'ac_block' => {
+ 'addr_block' => {
'columns' => [
- 'acnum', 'int', '', '',
+ 'blocknum', 'serial', '', '',
+ 'routernum', 'int', '', '',
'ip_gateway', 'varchar', '', 15,
'ip_netmask', 'int', '', '',
],
- 'primary_key' => '',
- 'unique' => [],
- 'index' => [ [ 'acnum' ] ],
+ 'primary_key' => 'blocknum',
+ 'unique' => [ [ 'blocknum', 'routernum' ] ],
+ 'index' => [],
},
'svc_broadband' => {
'columns' => [
'svcnum', 'int', '', '',
- 'actypenum', 'int', '', '',
+ 'blocknum', 'int', '', '',
'speed_up', 'int', '', '',
'speed_down', 'int', '', '',
- 'acnum', 'int', '', '',
'ip_addr', 'varchar', '', 15,
- 'ip_netmask', 'int', '', '',
- 'mac_addr', 'char', '', 17,
- 'location', 'varchar', '', $char_d,
],
'primary_key' => 'svcnum',
'unique' => [],
- 'index' => [ [ 'actypenum' ] ],
+ 'index' => [],
+ },
+
+ 'part_virtual_field' => {
+ 'columns' => [
+ 'vfieldpart', 'int', '', '',
+ 'dbtable', 'varchar', '', 32,
+ 'name', 'varchar', '', 32,
+ 'check_block', 'text', 'NULL', '',
+ 'length', 'int', 'NULL', '',
+ 'list_source', 'text', 'NULL', '',
+ 'label', 'varchar', 'NULL', 80,
+ ],
+ 'primary_key' => 'vfieldpart',
+ 'unique' => [],
+ 'index' => [],
+ },
+
+ 'virtual_field' => {
+ 'columns' => [
+ 'recnum', 'int', '', '',
+ 'vfieldpart', 'int', '', '',
+ 'value', 'varchar', '', 128,
+ ],
+ 'primary_key' => '',
+ 'unique' => [ [ 'vfieldpart', 'recnum' ] ],
+ 'index' => [],
},
);