X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2Fbin%2Ffreeside-setup;h=8b7466222e3e25f248e66b3dcc607cdc36212471;hp=cb74e64c839debcbf61dedabd80e40236ee4147c;hb=b1d4c3b5b5a05d38a4baf9c49bd7fdfb6990531d;hpb=eb0d04842631ae16247c6246cc6a1d8896169ff9 diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index cb74e64c8..8b7466222 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -7,7 +7,7 @@ use strict; use vars qw($opt_s); use Getopt::Std; use DBI; -use DBIx::DBSchema 0.20; +use DBIx::DBSchema 0.21; use DBIx::DBSchema::Table; use DBIx::DBSchema::Column; use DBIx::DBSchema::ColGroup::Unique; @@ -111,8 +111,9 @@ my($dbdef) = new DBIx::DBSchema ( map { 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 @@ -189,7 +190,23 @@ foreach my $table ( grep { ! /^h_/ } $dbdef->tables ) { '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); @@ -397,9 +414,10 @@ sub tables_hash_hack { 'recur', @money_type, 'sdate', @date_type, 'edate', @date_type, + 'itemdesc', 'varchar', 'NULL', $char_d, ], 'primary_key' => '', - 'unique' => [ ['pkgnum', 'invnum'] ], + 'unique' => [], 'index' => [ ['invnum'] ], }, @@ -479,7 +497,9 @@ sub tables_hash_hack { 'primary_key' => 'custnum', 'unique' => [], #'index' => [ ['last'], ['company'] ], - 'index' => [ ['last'], [ 'company' ], [ 'referral_custnum' ] ], + 'index' => [ ['last'], [ 'company' ], [ 'referral_custnum' ], + [ 'daytime' ], [ 'night' ], [ 'fax' ], + ], }, 'cust_main_invoice' => { @@ -504,6 +524,7 @@ sub tables_hash_hack { 'taxclass', 'varchar', 'NULL', $char_d, 'exempt_amount', @money_type, 'tax', 'real', '', '', #tax % + 'taxname', 'varchar', 'NULL', $char_d, ], 'primary_key' => 'taxnum', 'unique' => [], @@ -520,7 +541,7 @@ sub tables_hash_hack { '_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, ], @@ -597,7 +618,7 @@ sub tables_hash_hack { '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, ], @@ -648,7 +669,7 @@ sub tables_hash_hack { ], 'primary_key' => 'pkgpart', 'unique' => [], - 'index' => [], + 'index' => [ [ disabled ], ], }, # 'part_title' => { @@ -691,7 +712,7 @@ sub tables_hash_hack { ], 'primary_key' => 'svcpart', 'unique' => [], - 'index' => [], + 'index' => [ [ 'disabled' ] ], }, 'part_svc_column' => { @@ -784,10 +805,12 @@ sub tables_hash_hack { '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, + #'recdata', 'varchar', '', $char_d, + 'recdata', 'varchar', '', 255, ], 'primary_key' => 'recnum', 'unique' => [],