X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FDBI%2Fmysql.pm;h=966cec3a6597dfbe8390a2850eb2b95247a3c03e;hb=e42ec4ef998118c71f8bd66e765f597a6f74dd39;hp=1a20bcb335ad010754611cbc68ec3415d97f7c93;hpb=1fa1884903b09903ce89a3814e41bac9e91eea9d;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm b/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm index 1a20bcb..966cec3 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm @@ -6,7 +6,7 @@ use base 'DBIx::Class::Schema::Loader::DBI'; use Carp::Clan qw/^DBIx::Class/; use Class::C3; -our $VERSION = '0.04999_13'; +our $VERSION = '0.05003'; =head1 NAME @@ -77,7 +77,7 @@ sub _mysql_table_get_keys { if(!exists($self->{_cache}->{_mysql_keys}->{$table})) { my %keydata; my $dbh = $self->schema->storage->dbh; - my $sth = $dbh->prepare("SHOW INDEX FROM `$table`"); + my $sth = $dbh->prepare('SHOW INDEX FROM '.$self->_table_as_sql($table)); $sth->execute; while(my $row = $sth->fetchrow_hashref) { next if $row->{Non_unique}; @@ -129,9 +129,9 @@ sub _extra_column_info { if ($info->{mysql_values}) { $extra_info{extra}{list} = $info->{mysql_values}; } -# XXX we need to distinguish between DEFAULT CURRENT_TIMESTAMP and DEFAULT 'foo' -# somehow, but DBI column_info doesn't preserve quotes. - if ($info->{COLUMN_DEF} =~ /^CURRENT_TIMESTAMP\z/i) { + if ( $info->{COLUMN_DEF} =~ /^CURRENT_TIMESTAMP\z/i + && $info->{mysql_type_name} =~ /^TIMESTAMP\z/i) { + $extra_info{default_value} = \'CURRENT_TIMESTAMP'; }