From: Amiri Barksdale at Home Date: Tue, 28 Dec 2010 15:26:32 +0000 (-0800) Subject: Debugging why sqlt deployment order of views is wrong. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3365fc706727255c3c5c55a2070ef847d4b5e87c;p=dbsrgits%2FDBIx-Class-ResultSource-MultipleTableInheritance.git Debugging why sqlt deployment order of views is wrong. --- diff --git a/lib/DBIx/Class/ResultSource/MultipleTableInheritance.pm b/lib/DBIx/Class/ResultSource/MultipleTableInheritance.pm index cfeb9c0..ba2ec52 100644 --- a/lib/DBIx/Class/ResultSource/MultipleTableInheritance.pm +++ b/lib/DBIx/Class/ResultSource/MultipleTableInheritance.pm @@ -155,9 +155,6 @@ method attach_additional_sources () { ); $self->deploy_depends_on->{$add->result_class} = 1; } - - # add every column that's actually a concrete part of us - $table->add_columns( map { ($_ => { %{$self->column_info($_)} }) } grep { $self->column_info($_)->{originally_defined_in} eq $self->name } diff --git a/t/02view_def.t b/t/02view_def.t index f188e18..19cfc59 100644 --- a/t/02view_def.t +++ b/t/02view_def.t @@ -5,6 +5,7 @@ use File::Temp; use Test::More qw(no_plan); use Test::Exception; use LoadTest; +use Devel::Dwarn; BEGIN { $ENV{DBIC_TRACE} = 0; @@ -31,3 +32,16 @@ lives_ok { $schema->deploy( { add_drop_table => 1, add_drop_view => 1, } ); } "It's also OK to deploy the schema"; + +my $sqlt_object = $schema->{sqlt}; + +is_deeply( + [ map { $_->name } $sqlt_object->get_views ], + [ qw/ + foo + bar + / + ], + "SQLT view order triumphantly matches our order." +); + diff --git a/t/03insert.t b/t/03insert.t index add074e..f25270c 100644 --- a/t/03insert.t +++ b/t/03insert.t @@ -43,3 +43,15 @@ lives_ok { } "I can do it for the other view, too"; +my $sqlt_object = $schema->{sqlt}; + +is_deeply( + [ map { $_->name } $sqlt_object->get_views ], + [ qw/ + coffee + sumatra + / + ], + "SQLT view order triumphantly matches our order." +); + diff --git a/t/lib/CafeInsertion.pm b/t/lib/CafeInsertion.pm index 73ff34f..034dbdb 100644 --- a/t/lib/CafeInsertion.pm +++ b/t/lib/CafeInsertion.pm @@ -1,4 +1,5 @@ -package CafeInsertion; +package # hide from PAUSE + CafeInsertion; use strict; use warnings; @@ -11,4 +12,9 @@ for my $p (__PACKAGE__) { for grep $_->isa(MTIView), map $p->source($_), $p->sources; } +sub sqlt_deploy_hook { + my $self = shift; + $self->{sqlt} = shift; +} + 1; diff --git a/t/lib/CafeInsertion/Result/Coffee.pm b/t/lib/CafeInsertion/Result/Coffee.pm index 4b4fdce..625c949 100644 --- a/t/lib/CafeInsertion/Result/Coffee.pm +++ b/t/lib/CafeInsertion/Result/Coffee.pm @@ -1,4 +1,5 @@ -package CafeInsertion::Result::Coffee; +package # hide from PAUSE + CafeInsertion::Result::Coffee; use strict; use warnings; diff --git a/t/lib/CafeInsertion/Result/Sugar.pm b/t/lib/CafeInsertion/Result/Sugar.pm index e2cf4b1..31001ae 100644 --- a/t/lib/CafeInsertion/Result/Sugar.pm +++ b/t/lib/CafeInsertion/Result/Sugar.pm @@ -1,4 +1,5 @@ -package CafeInsertion::Result::Sugar; +package # hide from PAUSE + CafeInsertion::Result::Sugar; use strict; use warnings; diff --git a/t/lib/CafeInsertion/Result/Sumatra.pm b/t/lib/CafeInsertion/Result/Sumatra.pm index 17e4606..04403fa 100644 --- a/t/lib/CafeInsertion/Result/Sumatra.pm +++ b/t/lib/CafeInsertion/Result/Sumatra.pm @@ -1,4 +1,5 @@ -package CafeInsertion::Result::Sumatra; +package # hide from PAUSE + CafeInsertion::Result::Sumatra; use strict; use warnings; diff --git a/t/lib/LoadTest.pm b/t/lib/LoadTest.pm index 012b3e1..e0b627c 100644 --- a/t/lib/LoadTest.pm +++ b/t/lib/LoadTest.pm @@ -1,4 +1,5 @@ -package LoadTest; +package # hide from PAUSE + LoadTest; use strict; use warnings; @@ -11,4 +12,9 @@ for my $p (__PACKAGE__) { for grep $_->isa(MTIView), map $p->source($_), $p->sources; } +sub sqlt_deploy_hook { + my $self = shift; + $self->{sqlt} = shift; +} + 1; diff --git a/t/lib/LoadTest/Result/Bar.pm b/t/lib/LoadTest/Result/Bar.pm index 0712ac9..ed6a506 100644 --- a/t/lib/LoadTest/Result/Bar.pm +++ b/t/lib/LoadTest/Result/Bar.pm @@ -1,8 +1,9 @@ -package LoadTest::Result::Bar; +package # hide from PAUSE + LoadTest::Result::Bar; use strict; use warnings; -use parent qw(LoadTest::Result::Foo); +use parent 'LoadTest::Result::Foo'; require LoadTest::Result::Mixin; @@ -16,16 +17,16 @@ __PACKAGE__->add_columns( b => { data_type => 'integer' } ); -__PACKAGE__->belongs_to( - 'b_thang', - 'LoadTest::Result::JustATable', - { 'foreign.id' => 'self.b' }, -); - -__PACKAGE__->has_many( - 'foos', - 'LoadTest::Result::Foo', - { 'foreign.a' => 'self.id' } -); +#__PACKAGE__->belongs_to( + #'b_thang', + #'LoadTest::Result::JustATable', + #{ 'foreign.id' => 'self.b' }, +#); + +#__PACKAGE__->has_many( + #'foos', + #'LoadTest::Result::Foo', + #{ 'foreign.a' => 'self.id' } +#); 1; diff --git a/t/lib/LoadTest/Result/Foo.pm b/t/lib/LoadTest/Result/Foo.pm index a14a209..7b20e1b 100644 --- a/t/lib/LoadTest/Result/Foo.pm +++ b/t/lib/LoadTest/Result/Foo.pm @@ -1,4 +1,5 @@ -package LoadTest::Result::Foo; +package # hide from PAUSE + LoadTest::Result::Foo; use strict; use warnings; @@ -16,10 +17,10 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key('id'); -__PACKAGE__->belongs_to( - 'bar', - 'LoadTest::Result::Bar', - { 'foreign.id' => 'self.a' } -); +#__PACKAGE__->belongs_to( + #'bar', + #'LoadTest::Result::Bar', + #{ 'foreign.id' => 'self.a' } +#); 1; diff --git a/t/lib/LoadTest/Result/JustATable.pm b/t/lib/LoadTest/Result/JustATable.pm index a73838c..1bf4e54 100644 --- a/t/lib/LoadTest/Result/JustATable.pm +++ b/t/lib/LoadTest/Result/JustATable.pm @@ -1,4 +1,5 @@ -package LoadTest::Result::JustATable; +package # hide from PAUSE + LoadTest::Result::JustATable; use base qw(DBIx::Class::Core); diff --git a/t/lib/LoadTest/Result/Mixin.pm b/t/lib/LoadTest/Result/Mixin.pm index eac1158..95a9007 100644 --- a/t/lib/LoadTest/Result/Mixin.pm +++ b/t/lib/LoadTest/Result/Mixin.pm @@ -1,4 +1,5 @@ -package LoadTest::Result::Mixin; +package # hide from PAUSE + LoadTest::Result::Mixin; use strict; use warnings; diff --git a/t/lib/NoSequenceSalad.pm b/t/lib/NoSequenceSalad.pm index 012354c..00d7930 100644 --- a/t/lib/NoSequenceSalad.pm +++ b/t/lib/NoSequenceSalad.pm @@ -1,4 +1,5 @@ -package NoSequenceSalad; +package # hide from PAUSE + NoSequenceSalad; use strict; use warnings; @@ -11,4 +12,9 @@ for my $p (__PACKAGE__) { for grep $_->isa(MTIView), map $p->source($_), $p->sources; } +sub sqlt_deploy_hook { + my $self = shift; + $self->{sqlt} = shift; +} + 1; diff --git a/t/lib/NoSequenceSalad/Result/Dressing.pm b/t/lib/NoSequenceSalad/Result/Dressing.pm index 77b3d61..0eeb746 100644 --- a/t/lib/NoSequenceSalad/Result/Dressing.pm +++ b/t/lib/NoSequenceSalad/Result/Dressing.pm @@ -1,4 +1,5 @@ -package NoSequenceSalad::Result::Dressing; +package # hide from PAUSE + NoSequenceSalad::Result::Dressing; use strict; use warnings; diff --git a/t/lib/NoSequenceSalad/Result/Mesclun.pm b/t/lib/NoSequenceSalad/Result/Mesclun.pm index 6e35e3a..e36e42a 100644 --- a/t/lib/NoSequenceSalad/Result/Mesclun.pm +++ b/t/lib/NoSequenceSalad/Result/Mesclun.pm @@ -1,4 +1,5 @@ -package NoSequenceSalad::Result::Mesclun; +package # hide from PAUSE + NoSequenceSalad::Result::Mesclun; use strict; use warnings; diff --git a/t/lib/NoSequenceSalad/Result/Salad.pm b/t/lib/NoSequenceSalad/Result/Salad.pm index 9dcd913..85236c5 100644 --- a/t/lib/NoSequenceSalad/Result/Salad.pm +++ b/t/lib/NoSequenceSalad/Result/Salad.pm @@ -1,4 +1,5 @@ -package NoSequenceSalad::Result::Salad; +package # hide from PAUSE + NoSequenceSalad::Result::Salad; use strict; use warnings;