From ca12a227e21d6d2597f2dce860604aea02257621 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 21 Jun 2011 02:55:43 +0000 Subject: [PATCH] remove unnecessary/bloating indices on h_cust_event, RT#13337 --- FS/FS/Schema.pm | 62 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 978a9bff6..65ec2a8b7 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -197,34 +197,42 @@ sub dbdef_dist { my $tableobj = $dbdef->table($table) or die "unknown table $table"; - my %indices = $tableobj->indices; + my %h_indices = (); + + unless ( $table eq 'cust_event' ) { #others? + + my %indices = $tableobj->indices; - my %h_indices = map { - ( "h_$_" => - DBIx::DBSchema::Index->new({ - 'name' => 'h_'. $indices{$_}->name, - 'unique' => 0, - 'columns' => [ @{$indices{$_}->columns} ], - }) - ); - } - keys %indices; - - $h_indices{"h_${table}_srckey"} = DBIx::DBSchema::Index->new({ - 'name' => "h_${table}_srckey", - 'unique' => 0, - 'columns' => [ 'history_action', #right? - $tableobj->primary_key, - ], - }); - - $h_indices{"h_${table}_srckey2"} = DBIx::DBSchema::Index->new({ - 'name' => "h_${table}_srckey2", - 'unique' => 0, - 'columns' => [ 'history_date', - $tableobj->primary_key, - ], - }); + %h_indices = map { + ( "h_$_" => + DBIx::DBSchema::Index->new({ + 'name' => 'h_'. $indices{$_}->name, + 'unique' => 0, + 'columns' => [ @{$indices{$_}->columns} ], + }) + ); + } + keys %indices; + + $h_indices{"h_${table}_srckey"} = + DBIx::DBSchema::Index->new({ + 'name' => "h_${table}_srckey", + 'unique' => 0, + 'columns' => [ 'history_action', #right? + $tableobj->primary_key, + ], + }); + + $h_indices{"h_${table}_srckey2"} = + DBIx::DBSchema::Index->new({ + 'name' => "h_${table}_srckey2", + 'unique' => 0, + 'columns' => [ 'history_date', + $tableobj->primary_key, + ], + }); + + } my $h_tableobj = DBIx::DBSchema::Table->new( { 'name' => "h_$table", -- 2.11.0