use strict;
use warnings;
use base 'DBIx::Class::Schema::Loader::DBI';
-use Carp::Clan qw/^DBIx::Class/;
-use Class::C3;
+use mro 'c3';
+use List::Util 'first';
+use namespace::clean;
-our $VERSION = '0.07000';
+our $VERSION = '0.07010';
=head1 NAME
DBIx::Class::Schema::Loader::DBI::mysql - DBIx::Class::Schema::Loader::DBI mysql Implementation.
-=head1 SYNOPSIS
-
- package My::Schema;
- use base qw/DBIx::Class::Schema::Loader/;
-
- __PACKAGE__->loader_options( debug => 1 );
-
- 1;
-
=head1 DESCRIPTION
-See L<DBIx::Class::Schema::Loader::Base>.
+See L<DBIx::Class::Schema::Loader> and L<DBIx::Class::Schema::Loader::Base>.
=cut
sub _setup {
my $self = shift;
+ $self->schema->storage->sql_maker->quote_char("`");
+ $self->schema->storage->sql_maker->name_sep(".");
+
$self->next::method(@_);
if (not defined $self->preserve_case) {
my @f_cols = map { s/(?: \Q$self->{_quoter}\E | $qt )//x; $self->_lc($_) }
split(/$qt?\s*$qt?,$qt?\s*$qt?/, $f_cols);
+ my $remote_table = first { $_ =~ /^${f_table}\z/i } $self->_tables_list;
+
push(@rels, {
local_columns => \@cols,
remote_columns => \@f_cols,
- remote_table => $f_table
+ remote_table => $remote_table,
});
}
delete $info->{size};
}
}
+ elsif ($info->{data_type} =~ /^(?:date(?:time)?|timestamp)\z/) {
+ 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 ''
# for things that don't actually have or support that default (like ints.)
return \%extra_info;
}
+sub _dbh_column_info {
+ my $self = shift;
+
+ local $SIG{__WARN__} = sub { warn @_
+ unless $_[0] =~ /^column_info: unrecognized column type/ };
+
+ $self->next::method(@_);
+}
+
=head1 SEE ALSO
L<DBIx::Class::Schema::Loader>, L<DBIx::Class::Schema::Loader::Base>,