From: Amiri Barksdale at Home Date: Tue, 15 Jun 2010 02:16:57 +0000 (-0700) Subject: Use fully-qualified result class names instead of source names in deploy_depends_on. X-Git-Tag: v0.08124~114^2~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0edbc8f0aab7586741d86c94b37fbf3b883361b2;p=dbsrgits%2FDBIx-Class.git Use fully-qualified result class names instead of source names in deploy_depends_on. --- diff --git a/lib/DBIx/Class/ResultSource/View.pm b/lib/DBIx/Class/ResultSource/View.pm index 5bb5e5d..4410563 100644 --- a/lib/DBIx/Class/ResultSource/View.pm +++ b/lib/DBIx/Class/ResultSource/View.pm @@ -132,11 +132,11 @@ syntaxes. =head2 deploy_depends_on __PACKAGE__->result_source_instance->deploy_depends_on( - ["Year","CD"] + ["MyDB::Schema::Result::Year","MyDB::Schema::Result::CD"] ); Specify the views (and only the views) that this view depends on. -Pass this an array reference of source names. +Pass this an array reference of fully qualified result classes. =head1 OVERRIDDEN METHODS diff --git a/lib/SQL/Translator/Parser/DBIx/Class.pm b/lib/SQL/Translator/Parser/DBIx/Class.pm index cbeaf86..b2ba72c 100644 --- a/lib/SQL/Translator/Parser/DBIx/Class.pm +++ b/lib/SQL/Translator/Parser/DBIx/Class.pm @@ -393,13 +393,13 @@ sub _resolve_view_deps { # copy and bump all deps by one (so we can reconstruct the chain) my %seen = map { $_ => $seen->{$_} + 1 } ( keys %$seen ); - $seen{ $view->source_name } = 1; + $seen{ $view->result_class } = 1; for my $dep ( keys %{ $view->{deploy_depends_on} } ) { if ( $seen->{$dep} ) { return {}; } my ($new_source_name) = - grep { $view->schema->source($_)->source_name eq $dep } + grep { $view->schema->source($_)->result_class eq $dep } @{ [ $view->schema->sources ] }; my $subdeps = _resolve_view_deps( $view->schema->source($new_source_name), diff --git a/t/lib/ViewDeps/Result/AbNameArtists.pm b/t/lib/ViewDeps/Result/AbNameArtists.pm index fab3a7c..3651a5b 100644 --- a/t/lib/ViewDeps/Result/AbNameArtists.pm +++ b/t/lib/ViewDeps/Result/AbNameArtists.pm @@ -11,7 +11,7 @@ __PACKAGE__->result_source_instance->view_definition( "SELECT id,name FROM a_name_artists WHERE name like 'ab%'" ); __PACKAGE__->result_source_instance->deploy_depends_on( - ["ANameArtists"] + ["ViewDeps::Result::ANameArtists"] ); __PACKAGE__->add_columns( diff --git a/t/lib/ViewDeps/Result/AbaNameArtists.pm b/t/lib/ViewDeps/Result/AbaNameArtists.pm index d0a1f04..fc989f6 100644 --- a/t/lib/ViewDeps/Result/AbaNameArtists.pm +++ b/t/lib/ViewDeps/Result/AbaNameArtists.pm @@ -10,7 +10,7 @@ __PACKAGE__->table('aba_name_artists'); __PACKAGE__->result_source_instance->view_definition( "SELECT id,name FROM ab_name_artists WHERE name like 'aba%'" ); __PACKAGE__->result_source_instance->deploy_depends_on( - ["AbNameArtists"] ); + ["ViewDeps::Result::AbNameArtists"] ); __PACKAGE__->add_columns( id => { data_type => 'integer', is_auto_increment => 1 }, diff --git a/t/lib/ViewDeps/Result/AbaNameArtistsAnd2010CDsWithManyTracks.pm b/t/lib/ViewDeps/Result/AbaNameArtistsAnd2010CDsWithManyTracks.pm index 4395923..83c651b 100644 --- a/t/lib/ViewDeps/Result/AbaNameArtistsAnd2010CDsWithManyTracks.pm +++ b/t/lib/ViewDeps/Result/AbaNameArtistsAnd2010CDsWithManyTracks.pm @@ -11,7 +11,7 @@ __PACKAGE__->result_source_instance->view_definition( "SELECT aba.id,aba.name,cd.title,cd.year,cd.number_tracks FROM aba_name_artists aba JOIN year_2010_cds_with_many_tracks cd on (aba.id = cd.artist)" ); __PACKAGE__->result_source_instance->deploy_depends_on( - ["AbNameArtists","Year2010CDsWithManyTracks"] ); + ["ViewDeps::Result::AbNameArtists","ViewDeps::Result::Year2010CDsWithManyTracks"] ); __PACKAGE__->add_columns( id => { data_type => 'integer', is_auto_increment => 1 }, diff --git a/t/lib/ViewDeps/Result/Year2010CDsWithManyTracks.pm b/t/lib/ViewDeps/Result/Year2010CDsWithManyTracks.pm index c7ccfcb..c6e4144 100644 --- a/t/lib/ViewDeps/Result/Year2010CDsWithManyTracks.pm +++ b/t/lib/ViewDeps/Result/Year2010CDsWithManyTracks.pm @@ -12,7 +12,7 @@ __PACKAGE__->result_source_instance->view_definition( ); __PACKAGE__->result_source_instance->deploy_depends_on( - ["Year2010CDs"] ); + ["ViewDeps::Result::Year2010CDs"] ); __PACKAGE__->add_columns( id => { data_type => 'integer', is_auto_increment => 1 }, diff --git a/t/lib/ViewDepsBad/Result/AbNameArtists.pm b/t/lib/ViewDepsBad/Result/AbNameArtists.pm index 358abaa..181d4ec 100644 --- a/t/lib/ViewDepsBad/Result/AbNameArtists.pm +++ b/t/lib/ViewDepsBad/Result/AbNameArtists.pm @@ -11,7 +11,7 @@ __PACKAGE__->result_source_instance->view_definition( "SELECT id,name FROM a_name_artists WHERE name like 'ab%'" ); __PACKAGE__->result_source_instance->deploy_depends_on( - ["ANameArtists"] + ["ViewDepsBad::Result::ANameArtists"] ); __PACKAGE__->add_columns( diff --git a/t/lib/ViewDepsBad/Result/AbaNameArtists.pm b/t/lib/ViewDepsBad/Result/AbaNameArtists.pm index c1e6239..715d56d 100644 --- a/t/lib/ViewDepsBad/Result/AbaNameArtists.pm +++ b/t/lib/ViewDepsBad/Result/AbaNameArtists.pm @@ -10,7 +10,7 @@ __PACKAGE__->table('aba_name_artists'); __PACKAGE__->result_source_instance->view_definition( "SELECT id,name FROM ab_name_artists WHERE name like 'aba%'" ); __PACKAGE__->result_source_instance->deploy_depends_on( - ["AbNameArtists", "AbaNameArtistsAnd2010CDsWithManyTracks"] ); + ["ViewDepsBad::Result::AbNameArtists", "ViewDepsBad::Result::AbaNameArtistsAnd2010CDsWithManyTracks"] ); __PACKAGE__->add_columns( id => { data_type => 'integer', is_auto_increment => 1 }, diff --git a/t/lib/ViewDepsBad/Result/AbaNameArtistsAnd2010CDsWithManyTracks.pm b/t/lib/ViewDepsBad/Result/AbaNameArtistsAnd2010CDsWithManyTracks.pm index b90669f..8751d57 100644 --- a/t/lib/ViewDepsBad/Result/AbaNameArtistsAnd2010CDsWithManyTracks.pm +++ b/t/lib/ViewDepsBad/Result/AbaNameArtistsAnd2010CDsWithManyTracks.pm @@ -11,7 +11,7 @@ __PACKAGE__->result_source_instance->view_definition( "SELECT aba.id,aba.name,cd.title,cd.year,cd.number_tracks FROM aba_name_artists aba JOIN year_2010_cds_with_many_tracks cd on (aba.id = cd.artist)" ); __PACKAGE__->result_source_instance->deploy_depends_on( - ["AbNameArtists","Year2010CDsWithManyTracks"] ); + ["ViewDepsBad::Result::AbNameArtists","ViewDepsBad::Result::Year2010CDsWithManyTracks"] ); __PACKAGE__->add_columns( id => { data_type => 'integer', is_auto_increment => 1 }, diff --git a/t/lib/ViewDepsBad/Result/Year2010CDsWithManyTracks.pm b/t/lib/ViewDepsBad/Result/Year2010CDsWithManyTracks.pm index 349addb..9a4900f 100644 --- a/t/lib/ViewDepsBad/Result/Year2010CDsWithManyTracks.pm +++ b/t/lib/ViewDepsBad/Result/Year2010CDsWithManyTracks.pm @@ -12,7 +12,7 @@ __PACKAGE__->result_source_instance->view_definition( ); __PACKAGE__->result_source_instance->deploy_depends_on( - ["Year2010CDs"] ); + ["ViewDepsBad::Result::Year2010CDs"] ); __PACKAGE__->add_columns( id => { data_type => 'integer', is_auto_increment => 1 },