[Bast-commits] r3879 - in DBIx-Class/0.08/trunk:
lib/DBIx/Class/Storage lib/SQL/Translator/Parser/DBIx t
t/lib/DBICTest
ash at dev.catalyst.perl.org
ash at dev.catalyst.perl.org
Thu Nov 15 12:49:53 GMT 2007
Author: ash
Date: 2007-11-15 12:49:53 +0000 (Thu, 15 Nov 2007)
New Revision: 3879
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/Statistics.pm
DBIx-Class/0.08/trunk/lib/SQL/Translator/Parser/DBIx/Class.pm
DBIx-Class/0.08/trunk/t/86sqlt.t
DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema.pm
Log:
Fix is_foreign_key_constraint - thanks Jon Schutz
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/Statistics.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/Statistics.pm 2007-11-14 13:14:07 UTC (rev 3878)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/Statistics.pm 2007-11-15 12:49:53 UTC (rev 3879)
@@ -3,6 +3,7 @@
use warnings;
use base qw/Class::Accessor::Grouped/;
+use IO::File;
__PACKAGE__->mk_group_accessors(simple => qw/callback debugfh/);
Modified: DBIx-Class/0.08/trunk/lib/SQL/Translator/Parser/DBIx/Class.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/SQL/Translator/Parser/DBIx/Class.pm 2007-11-14 13:14:07 UTC (rev 3878)
+++ DBIx-Class/0.08/trunk/lib/SQL/Translator/Parser/DBIx/Class.pm 2007-11-15 12:49:53 UTC (rev 3879)
@@ -149,10 +149,10 @@
# us to another table.
# OR: If is_foreign_key_constraint attr is explicity set (or set to false) on the relation
if ( ! exists $created_FK_rels{$rel_table}->{$key_test} &&
- ( exists $rel_info->{attrs}{is_foreign_key_constraint} &&
- $rel_info->{attrs}{is_foreign_key_constraint} ||
+ ( exists $rel_info->{attrs}{is_foreign_key_constraint} ?
+ $rel_info->{attrs}{is_foreign_key_constraint} :
!$source->compare_relationship_keys(\@keys, \@primary)
- )
+ )
)
{
$created_FK_rels{$rel_table}->{$key_test} = 1;
Modified: DBIx-Class/0.08/trunk/t/86sqlt.t
===================================================================
--- DBIx-Class/0.08/trunk/t/86sqlt.t 2007-11-14 13:14:07 UTC (rev 3878)
+++ DBIx-Class/0.08/trunk/t/86sqlt.t 2007-11-15 12:49:53 UTC (rev 3879)
@@ -10,7 +10,7 @@
my $schema = DBICTest->init_schema;
-plan tests => 56;
+plan tests => 60;
my $translator = SQL::Translator->new(
parser_args => {
@@ -176,6 +176,16 @@
on_delete => '', on_update => '',
},
],
+ # ForceForeign
+ forceforeign => [
+ {
+ 'display' => 'forceforeign->artist',
+ 'selftable' => 'forceforeign', 'foreigntable' => 'artist',
+ 'selfcols' => ['artist'], 'foreigncols' => ['artist_id'],
+ on_delete => '', on_update => '',
+ },
+ ],
+
);
my %unique_constraints = (
@@ -222,7 +232,6 @@
);
my $tschema = $translator->schema();
-
# Test that the $schema->sqlt_deploy_hook was called okay and that it removed
# the 'link' table
ok( !defined($tschema->get_table('link')), "Link table was removed by hook");
@@ -232,6 +241,8 @@
ok( !defined($constraint), 'nonexistent FOREIGN KEY constraint not found' );
$constraint = get_constraint('UNIQUE', 'cd', ['artist']);
ok( !defined($constraint), 'nonexistent UNIQUE constraint not found' );
+$constraint = get_constraint('FOREIGN KEY', 'forceforeign', ['cd'], 'cd', ['cdid']);
+ok( !defined($constraint), 'forced nonexistent FOREIGN KEY constraint not found' );
for my $expected_constraints (keys %fk_constraints) {
for my $expected_constraint (@{ $fk_constraints{$expected_constraints} }) {
Modified: DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema.pm
===================================================================
--- DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema.pm 2007-11-14 13:14:07 UTC (rev 3878)
+++ DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema.pm 2007-11-15 12:49:53 UTC (rev 3879)
@@ -36,7 +36,8 @@
),
qw/SelfRefAlias TreeLike TwoKeyTreeLike Event EventTZ NoPrimaryKey/,
qw/Collection CollectionObject TypedObject/,
- qw/Owners BooksInLibrary/
+ qw/Owners BooksInLibrary/,
+ qw/ForceForeign/
);
sub sqlt_deploy_hook {
More information about the Bast-commits
mailing list