use base 'DBIx::Class::Schema::Loader::DBI';
use mro 'c3';
use List::Util 'first';
+use Try::Tiny;
use namespace::clean;
our $VERSION = '0.07010';
$self->next::method(@_);
}
+sub _table_comment {
+ my ( $self, $table ) = @_;
+ my $comment = $self->next::method($table);
+ if (not $comment) {
+ ($comment) = try { $self->schema->storage->dbh->selectrow_array(
+ qq{SELECT table_comment
+ FROM information_schema.tables
+ WHERE table_schema = schema()
+ AND table_name = ?
+ }, undef, $table);
+ };
+ # InnoDB likes to auto-append crap.
+ if (not $comment) {
+ # Do nothing.
+ }
+ elsif ($comment =~ /^InnoDB free:/) {
+ $comment = undef;
+ }
+ else {
+ $comment =~ s/; InnoDB.*//;
+ }
+ }
+ return $comment;
+}
+
+sub _column_comment {
+ my ( $self, $table, $column_number, $column_name ) = @_;
+ my $comment = $self->next::method($table, $column_number, $column_name);
+ if (not $comment) {
+ ($comment) = try { $self->schema->storage->dbh->selectrow_array(
+ qq{SELECT column_comment
+ FROM information_schema.columns
+ WHERE table_schema = schema()
+ AND table_name = ?
+ AND column_name = ?
+ }, undef, $table, $column_name);
+ };
+ }
+ return $comment;
+}
+
=head1 SEE ALSO
L<DBIx::Class::Schema::Loader>, L<DBIx::Class::Schema::Loader::Base>,