From: Florian Ragwitz Date: Mon, 15 Feb 2010 14:50:01 +0000 (+0000) Subject: Make sure overriding deployment_statements is possible from within schemas. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c66a805c9b17549f75f430cca287116dc5174625;p=dbsrgits%2FDBIx-Class-Historic.git Make sure overriding deployment_statements is possible from within schemas. --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 8fe1bfe..cc5aa4d 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -2442,7 +2442,7 @@ sub deploy { } $self->_query_end($line); }; - my @statements = $self->deployment_statements($schema, $type, undef, $dir, { %{ $sqltargs || {} }, no_comments => 1 } ); + my @statements = $schema->deployment_statements($type, undef, $dir, { %{ $sqltargs || {} }, no_comments => 1 } ); if (@statements > 1) { foreach my $statement (@statements) { $deploy->( $statement ); diff --git a/t/86sqlt.t b/t/86sqlt.t index 043aa95..3430cec 100644 --- a/t/86sqlt.t +++ b/t/86sqlt.t @@ -12,6 +12,14 @@ BEGIN { unless DBIx::Class::Optional::Dependencies->req_ok_for ('deploy') } +my $custom_deployment_statements_called = 0; + +sub DBICTest::Schema::deployment_statements { + $custom_deployment_statements_called = 1; + my $self = shift; + return $self->next::method(@_); +} + my $schema = DBICTest->init_schema (no_deploy => 1); @@ -69,6 +77,7 @@ my $schema = DBICTest->init_schema (no_deploy => 1); $schema->deploy; # do not remove, this fires the is() test in the callback above ok($deploy_hook_called, 'deploy hook got called'); + ok($custom_deployment_statements_called, '->deploy used the schemas deploy_statements method'); }