[Bast-commits] r8367 - in DBIx-Class/0.08/branches/no_duplicate_indexes_for_pk_cols: lib/SQL/Translator/Parser/DBIx t

abraxxa at dev.catalyst.perl.org abraxxa at dev.catalyst.perl.org
Mon Jan 18 15:04:38 GMT 2010


Author: abraxxa
Date: 2010-01-18 15:04:34 +0000 (Mon, 18 Jan 2010)
New Revision: 8367

Modified:
   DBIx-Class/0.08/branches/no_duplicate_indexes_for_pk_cols/lib/SQL/Translator/Parser/DBIx/Class.pm
   DBIx-Class/0.08/branches/no_duplicate_indexes_for_pk_cols/t/99dbic_sqlt_parser.t
Log:
test and pod fixes


Modified: DBIx-Class/0.08/branches/no_duplicate_indexes_for_pk_cols/lib/SQL/Translator/Parser/DBIx/Class.pm
===================================================================
--- DBIx-Class/0.08/branches/no_duplicate_indexes_for_pk_cols/lib/SQL/Translator/Parser/DBIx/Class.pm	2010-01-18 14:53:08 UTC (rev 8366)
+++ DBIx-Class/0.08/branches/no_duplicate_indexes_for_pk_cols/lib/SQL/Translator/Parser/DBIx/Class.pm	2010-01-18 15:04:34 UTC (rev 8367)
@@ -428,7 +428,7 @@
 
 =over 4
 
-=item Arguments: @classes
+=item Arguments: \@class_names
 
 =back
 

Modified: DBIx-Class/0.08/branches/no_duplicate_indexes_for_pk_cols/t/99dbic_sqlt_parser.t
===================================================================
--- DBIx-Class/0.08/branches/no_duplicate_indexes_for_pk_cols/t/99dbic_sqlt_parser.t	2010-01-18 14:53:08 UTC (rev 8366)
+++ DBIx-Class/0.08/branches/no_duplicate_indexes_for_pk_cols/t/99dbic_sqlt_parser.t	2010-01-18 15:04:34 UTC (rev 8367)
@@ -35,6 +35,12 @@
   $schema->sources
 ;
 
+my $idx_exceptions = {
+    'Artwork'       => -1,
+    'ForceForeign'  => -1,
+    'LinerNotes'    => -1,
+};
+
 { 
   my $sqlt_schema = create_schema({ schema => $schema, args => { parser_args => { } } });
 
@@ -42,6 +48,7 @@
     my $table = get_table($sqlt_schema, $schema, $source_name);
 
     my $fk_count = scalar(grep { $_->type eq 'FOREIGN KEY' } $table->get_constraints);
+    $fk_count += $idx_exceptions->{$source_name} || 0;
     my @indices = $table->get_indices;
 
     my $index_count = scalar(@indices);
@@ -60,14 +67,15 @@
 { 
   my $sqlt_schema = create_schema({ schema => $schema, args => { parser_args => { add_fk_index => 1 } } });
 
-  foreach my $source (@sources) {
-    my $table = get_table($sqlt_schema, $schema, $source);
+  foreach my $source_name (@sources) {
+    my $table = get_table($sqlt_schema, $schema, $source_name);
 
     my $fk_count = scalar(grep { $_->type eq 'FOREIGN KEY' } $table->get_constraints);
+    $fk_count += $idx_exceptions->{$source_name} || 0;
     my @indices = $table->get_indices;
     my $index_count = scalar(@indices);
-    $index_count++ if ($source eq 'TwoKeys'); # TwoKeys has the index turned off on the rel def
-    is($index_count, $fk_count, "correct number of indices for $source with add_fk_index => 1");
+    $index_count++ if ($source_name eq 'TwoKeys'); # TwoKeys has the index turned off on the rel def
+    is($index_count, $fk_count, "correct number of indices for $source_name with add_fk_index => 1");
   }
 }
 




More information about the Bast-commits mailing list