Skip Menu |

This queue is for tickets about the DBIx-Class-Schema-Loader CPAN distribution.

Report information
The Basics
Id: 26427
Status: resolved
Priority: 0/
Queue: DBIx-Class-Schema-Loader

People
Owner: blblack [...] gmail.com
Requestors: chromatic [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.03011
Fixed in: (no value)



Subject: PK Scan Warns about sqlite_sequence Table
When Schema::Loader scans SQLite tables for primary keys, it finds the sqlite_sequence table, which is apparently an internal table to enable autoincrement. Because this table has no primary key, the module warns about it. This patch cleans up the list of PKs. I didn't see an obvious way to test this, so the test suite performs as expected both with and without this patch. I'm using DBD::SQLite 1.13.
Subject: sqlite_sequence.patch
--- lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm~ 2007-04-16 17:24:30.000000000 -0700 +++ lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm 2007-04-16 17:39:22.000000000 -0700 @@ -149,6 +149,12 @@ return $self->{_sqlite_parse_data}->{$table}->{rels}; } +sub _table_pk_info { + my $self = shift; + my $info = $self->SUPER::_table_pk_info( @_ ); + return [ grep { $_ ne 'sqlite_sequence' } @$info ]; +} + sub _table_uniq_info { my ($self, $table) = @_;
On Mon Apr 16 20:46:04 2007, CHROMATIC wrote: Show quoted text
> When Schema::Loader scans SQLite tables for primary keys, it finds the > sqlite_sequence table, which is apparently an internal table to enable > autoincrement. Because this table has no primary key, the module warns > about it. > > This patch cleans up the list of PKs. > > I didn't see an obvious way to test this, so the test suite performs as > expected both with and without this patch. > > I'm using DBD::SQLite 1.13.
Actually, this patch is better. The same rule about the tests applies, however.
--- lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm~ 2007-04-16 17:24:30.000000000 -0700 +++ lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm 2007-04-16 17:48:26.000000000 -0700 @@ -167,6 +167,7 @@ my @tables; while ( my $row = $sth->fetchrow_hashref ) { next unless lc( $row->{type} ) eq 'table'; + next if $row->{tbl_name} =~ /^sqlite_/; push @tables, $row->{tbl_name}; } $sth->finish;
I've applied your second patch to trunk (and pulled to -current). It will be in the next releases.