[Dbix-class] Re: DBIx::Class::Schema::Loader::DBI::mysql is_auto_increment patch

Juan Camacho jc5826 at gmail.com
Sat Jun 7 16:52:23 BST 2008


On Fri, Jun 6, 2008 at 6:50 PM, Dagfinn Ilmari Mannsåker
<ilmari at ilmari.org> wrote:
> "Juan Camacho" <jc5826 at gmail.com> writes:
>
>> This is a patch for adding is_auto_increment flag when loading MySQL
>> schema.  The diff is against version 0.04005 of
>> DBIx::Class::Schema::Loader::DBI::mysql.
>
> This is already done (for all the supported databases) in the upcoming
> 0.05 release, available at
> <http://search.cpan.org/~ilmari/DBIx-Class-Schema-Loader-0.04999_05/>
>

Thanks. The new changes also adds more column information which is
great. FYI, one thing to probably add to the Makefile.PL requirements
is that a current version of DBD::msyql is needed for this to work.

I haven't done any significant testing and it seems like some is
really needed because I immediately came across two issues. The first
is with dates and sizes and the other is with the CURRENT_TIMESTAMP
default value. DATE(10) in the SQL generates an error and
CURRENT_TIMESTAMP is quoted.

I think fixing the CURRENT_TIMESTAMP quoting may be tricky since it
requires a change by DBIx::Class itself and not just the loader.

I'm losing a bit of confidence in my being able to use the Loader
module at this point. But, I'll be glad to assist in trying to get the
SQL file to look at close to what the mysldump command creates --
which is what I may end up resorting to instead for now.

The following sort of fixes the first problem I mentioned.

--- /home/twst/perl5/DBIx/Class/Schema/Loader/DBI/mysql.pm
2008-06-06 20:54:22.635755596 -0400
+++ /home/twst/tmp/DBIx-Class-Schema-Loader-0.04999_05/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm
       2008-04-13 20:21:53.000000000 -0400
@@ -135,11 +135,6 @@
         $extra_info{extra}{list} = $info->{mysql_values};
     }

-    $extra_info{size} = undef if uc($info->{TYPE_NAME}) eq 'DATE' ||
uc($info->{TYPE_NAME}) eq "DATETIME";
-
-    if ($info->{COLUMN_DEF} && $info->{COLUMN_DEF} eq 'CURRENT_TIMESTAMP') {
-        $extra_info{default_value} = undef; ## DBIx::Class probably
needs an enhancement here
-    }
     return \%extra_info;
 }



More information about the DBIx-Class mailing list