DBIx::Skinny::Schema::Loader and views with no pk

5 views
Skip to first unread message

metaperl

unread,
May 4, 2010, 5:00:27 PM5/4/10
to DBIx::Skinny, ryo.s...@gmail.com
If you try to run ::Loader on the MySQL sakila sample database, it
dies because it cannot find the primary key for a VIEW

I've read
http://search.cpan.org/~nekoya/DBIx-Skinny-Schema-Loader-0.12/lib/DBIx/Skinny/Schema/Loader.pm#HOW_LOADER_FIND_PRIMARY_KEYS

and I understand it, but that refers to a TABLE and not a VIEW.

This small patch allowed me to load the Sakila database:



--- mysql.pm 2010-05-04 16:56:09.127088054 -0400
+++ mysql.pm~ 2009-10-06 11:22:35.000000000 -0400
@@ -8,7 +8,7 @@
my $self = shift;
my $quoter = $self->quoter;
my $namesep = $self->namesep;
- my @tables = $self->{ dbh }->tables(undef, undef, '', 'TABLE');
+ my @tables = $self->{ dbh }->tables(undef, undef, '', '');
s/\Q$quoter\E//g for @tables;
s/^.*\Q$namesep\E// for @tables;
return \@tables;

atsushi kobayashi

unread,
May 4, 2010, 9:33:21 PM5/4/10
to dbix-...@googlegroups.com
hi metaperl.

i repro it.
i accepted your patch.

http://github.com/nekoya/p5-dbix-skinny-schema-loader/commit/ce88467b9b735ffeb3b17234886d11525adcf226

thank you.

2010/5/5 metaperl <sche...@gmail.com>:
--
Atsushi Kobayashi
Reply all
Reply to author
Forward
0 new messages