Skip to content

Commit

Permalink
deployment_statements() is also storage-dependent due to overrides
Browse files Browse the repository at this point in the history
We need some sort of generic test for this, so we stop dropping stuff
on the floor. The logic is something like "if a public method is overriden
in a DBI:: subclass - we need to mark it as for resolution". E.g.

rabbit@Thesaurus:~/devel/dbic/dbgit$ grep deployment_statements -r lib/DBIx/Class/Storage/DBI/
lib/DBIx/Class/Storage/DBI/Pg.pm:sub deployment_statements {
lib/DBIx/Class/Storage/DBI/Replicated.pm:    deployment_statements
lib/DBIx/Class/Storage/DBI/mysql.pm:sub deployment_statements {
lib/DBIx/Class/Storage/DBI/SQLite.pm:sub deployment_statements {
lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm:sub deployment_statements {
  • Loading branch information
ribasushi committed Apr 10, 2013
1 parent 58387a9 commit 3e33d1f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Revision history for DBIx::Class
resolving right-side ordered limited prefetch
- Stop erroneously considering order_by criteria from a join under
distinct => 1 (the distinct should apply to the main source only)
- Make sure deployment_statements is called on a resolved storage
subclass
- Even more robust behavior of GenericSubQuery limit dialect
- Stop Sybase ASE storage from generating invalid SQL in subselects
when a limit without offset is encountered
Expand Down
1 change: 1 addition & 0 deletions lib/DBIx/Class/Storage/DBI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ sub _determine_supports_join_optimizer { 1 };
# _determine_supports_X which obv. needs a correct driver as well
my @rdbms_specific_methods = qw/
sqlt_type
deployment_statements
sql_maker
cursor_class
Expand Down
10 changes: 8 additions & 2 deletions t/storage/deploy.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use warnings;

use Test::More;
use Test::Exception;
use Path::Class qw/dir/;

use lib qw(t/lib);
use DBICTest;
Expand All @@ -14,8 +15,13 @@ BEGIN {
unless DBIx::Class::Optional::Dependencies->req_ok_for ('deploy')
}

use File::Spec;
use Path::Class qw/dir/;
# this is how maint/gen_schema did it (connect() to force a storage
# instance, but no conninfo)
# there ought to be more code like this in the wild
like(
DBICTest::Schema->connect->deployment_statements('SQLite'),
qr/\bCREATE TABLE\b/i
);

lives_ok( sub {
my $parse_schema = DBICTest->init_schema(no_deploy => 1);
Expand Down

0 comments on commit 3e33d1f

Please sign in to comment.