Revision history for Perl extension DBIx::Class::Schema::Loader
- add datetime_undef_if_invalid => 1 for MySQL datetime data types
- (RT#64820)
+ (RT#64820) This behavior can be turned off by passing
+ datetime_undef_if_invalid=0 as a loader option
- added column_accessor_map option
- Preserve relationship names when redumping and another FK is added
(RT#62424)
preserve_case
col_collision_map
real_dump_directory
+ datetime_undef_if_invalid
/);
=head1 NAME
Sets the locale attribute for L<DBIx::Class::InflateColumn::DateTime> for all
columns with the DATE/DATETIME/TIMESTAMP data_types.
+=head2 datetime_undef_if_invalid
+
+Pass a C<0> for this option when using MySQL if you B<DON'T> want C<<
+datetime_undef_if_invalid => 1 >> in your column info for DATE, DATETIME and
+TIMESTAMP columns.
+
+The default is recommended to deal with data such as C<00/00/00> which
+sometimes ends up in such columns in MySQL.
+
=head2 config_file
File in Perl format, which should return a HASH reference, from which to read
for my $i (0 .. $#columns) {
my $column_info = {};
- $column_info->{data_type} = lc $sth->{TYPE}->[$i];
+ $column_info->{data_type} = lc $sth->{TYPE}[$i];
my $size = $sth->{PRECISION}[$i];
$column_info->{size} = $size;
}
- $column_info->{is_nullable} = $sth->{NULLABLE}->[$i] ? 1 : 0;
+ $column_info->{is_nullable} = $sth->{NULLABLE}[$i] ? 1 : 0;
if ($column_info->{data_type} =~ m/^(.*?)\((.*?)\)$/) {
$column_info->{data_type} = $1;
}
}
elsif ($info->{data_type} =~ /^(?:date(?:time)?|timestamp)\z/) {
- $info->{datetime_undef_if_invalid} = 1;
+ if (not (defined $self->datetime_undef_if_invalid && $self->datetime_undef_if_invalid == 0)) {
+ $info->{datetime_undef_if_invalid} = 1;
+ }
}
# Sometimes apparently there's a bug where default_value gets set to ''