[Dbix-class] Fix for problem with create_ddl_dir

Jess Robinson castaway at desert-island.demon.co.uk
Thu Mar 1 12:19:06 GMT 2007



On Wed, 28 Feb 2007, Carl Vincent wrote:

> Hi,
>
> I know it's marked EXPERIMENTAL, but I've been brave and had a go with
> the deploy stuff in DBIx::Class::Schema.
>
> Works fine for me for SQLite which helps me no end with tests. It's a
> bit less reliable with MySQL.
>
> I hit a problem with long package names:
>
> If your schema class is "Company::Project::Schema"
> $schema->create_ddl_dir produces sql in a file named
> "Company-Project::Schema-0.01-SQLite.sql"
>
> Those colons upset my Fedora Core 6 box, and completely foxed my windows
> box!
>
> I've made a fix to the regexp that creates the filename:
>
> $ svn diff lib/DBIx/Class/Schema.pm
> Index: lib/DBIx/Class/Schema.pm
> ===================================================================
> --- lib/DBIx/Class/Schema.pm    (revision 3105)
> +++ lib/DBIx/Class/Schema.pm    (working copy)
> @@ -788,7 +788,7 @@
>     my ($self, $type, $dir, $version) = @_;
>
>     my $filename = ref($self);
> -    $filename =~ s/::/-/;
> +    $filename =~ s/::/-/g;
>     $filename = "$dir$filename-$version-$type.sql";
>
>     return $filename;
>
>
>
> I'm taking the cowards line with respect to the tests - there doesn't
> seem to be any for the deploy code... If I'm mistaken I'll look at
> updating tests if someone points me the right way.
>

Hi Carl,

Woops, thanks for that, I'll update it.

Hmm, are there really no tests? The versioning tests in -current test it, 
but if theres none just for deploy, maybe we need some.

Jess




More information about the Dbix-class mailing list