use strict;
use warnings;
-use base qw/
- DBIx::Class::Schema::Loader::DBI::Component::QuotedDefault
- DBIx::Class::Schema::Loader::DBI
-/;
+use base 'DBIx::Class::Schema::Loader::DBI::Component::QuotedDefault';
use mro 'c3';
-our $VERSION = '0.07010';
+our $VERSION = '0.07025';
=head1 NAME
c.relname = ?}
);
- $uniq_sth->execute($table->schema, $table);
+ $uniq_sth->execute($table->schema, $table->name);
while(my $row = $uniq_sth->fetchrow_arrayref) {
my ($tableid, $indexname, $col_nums) = @$row;
$col_nums =~ s/^\s+//;
foreach (@col_nums) {
$attr_sth->execute($tableid, $_);
my $name_aref = $attr_sth->fetchrow_arrayref;
- push(@col_names, $name_aref->[0]) if $name_aref;
+ push(@col_names, $self->_lc($name_aref->[0])) if $name_aref;
}
if(!@col_names) {
# these types are fixed size
# XXX should this be a negative match?
if ($data_type =~
-/^(?:bigint|int8|bigserial|serial8|boolean|bool|box|bytea|cidr|circle|date|double precision|float8|inet|integer|int|int4|line|lseg|macaddr|money|path|point|polygon|real|float4|smallint|int2|serial|serial4|text)\z/i) {
+/^(?:bigint|int8|bigserial|serial8|bool(?:ean)?|box|bytea|cidr|circle|date|double precision|float8|inet|integer|int|int4|line|lseg|macaddr|money|path|point|polygon|real|float4|smallint|int2|serial|serial4|text)\z/i) {
delete $info->{size};
}
# for datetime types, check if it has a precision or not
}
my ($precision) = $self->schema->storage->dbh
- ->selectrow_array(<<EOF, {}, $table, $col);
+ ->selectrow_array(<<EOF, {}, $table->name, $col);
SELECT datetime_precision
FROM information_schema.columns
WHERE table_name = ? and column_name = ?
elsif ($data_type =~ /^(?:bit(?: varying)?|varbit)\z/i) {
$info->{data_type} = 'varbit' if $data_type =~ /var/i;
- my ($precision) = $self->dbh->selectrow_array(<<EOF, {}, $table, $col);
+ my ($precision) = $self->dbh->selectrow_array(<<EOF, {}, $table->name, $col);
SELECT character_maximum_length
FROM information_schema.columns
WHERE table_name = ? and column_name = ?
my $now = 'now()';
$info->{original}{default_value} = \$now;
}
+
+# detect 0/1 for booleans and rewrite
+ if ($data_type =~ /^bool/i && exists $info->{default_value}) {
+ if ($info->{default_value} eq '0') {
+ my $false = 'false';
+ $info->{default_value} = \$false;
+ }
+ elsif ($info->{default_value} eq '1') {
+ my $true = 'true';
+ $info->{default_value} = \$true;
+ }
+ }
}
return $result;