X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema.pm;h=ce2a026c131b87bea212f876fae0b3f9c6211c76;hb=93e4d41aa44fd36ed994e899e9cc3146ca41587d;hp=7e18f5859c4174d46a601bf77d5752cd5d961fc7;hpb=0e2c68097a6c35e41ad9daee61957ca0ed871cdd;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index 7e18f58..ce2a026 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -613,19 +613,6 @@ sub compose_namespace { return $schema; } -=head2 setup_connection_class - -=over 4 - -=item Arguments: $target, @info - -=back - -Sets up a database connection class to inject between the schema and the -subclasses that the schema creates. - -=cut - sub setup_connection_class { my ($class, $target, @info) = @_; $class->inject_base($target => 'DBIx::Class::DB'); @@ -1118,11 +1105,11 @@ sub create_ddl_dir { =over 4 -=item Arguments: $directory, $database-type, $version, $preversion +=item Arguments: $database-type, $version, $directory, $preversion =back - my $filename = $table->ddl_filename($type, $dir, $version, $preversion) + my $filename = $table->ddl_filename($type, $version, $dir, $preversion) This method is called by C to compose a file name out of the supplied directory, database type and version number. The default file @@ -1134,14 +1121,14 @@ format. =cut sub ddl_filename { - my ($self, $type, $dir, $version, $pversion) = @_; + my ($self, $type, $version, $dir, $preversion) = @_; - my $filename = ref($self); - $filename =~ s/::/-/g; - $filename = File::Spec->catfile($dir, "$filename-$version-$type.sql"); - $filename =~ s/$version/$pversion-$version/ if($pversion); - - return $filename; + my $filename = ref($self); + $filename =~ s/::/-/g; + $filename = File::Spec->catfile($dir, "$filename-$version-$type.sql"); + $filename =~ s/$version/$preversion-$version/ if($preversion); + + return $filename; } =head2 sqlt_deploy_hook($sqlt_schema) @@ -1191,6 +1178,29 @@ sub dclone { return Storable::dclone($obj); } +=head2 schema_version + +Returns the current schema class' $VERSION + +=cut + +sub schema_version { + my ($self) = @_; + my $class = ref($self)||$self; + + # does -not- use $schema->VERSION + # since that varies in results depending on if version.pm is installed, and if + # so the perl or XS versions. If you want this to change, bug the version.pm + # author to make vpp and vxs behave the same. + + my $version; + { + no strict 'refs'; + $version = ${"${class}::VERSION"}; + } + return $version; +} + 1; =head1 AUTHORS