Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: LEEJO [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.07045
Fixed in: (no value)



Subject: data_type => "varchar( 255 )" should be data_type => 'varchar', size => 255
riba asked me to report this, full convo follows: <ribasushi> data_type => "varchar( 255 )", <ribasushi> <-- wrong (well, non-best-practice) <ribasushi> data_type => 'varchar', size => 255 <Lee> hmm, that came out of schema::loader - missing an option perhaps? <ribasushi> bizarre... shouldn't have happened <ribasushi> I'd vote "bug" <Lee> yep, just grepped the gen'd classes and it's the same <ribasushi> recent S::L ? <Lee> 0.07045 <Lee> most recent <ribasushi> yeah, please throw a bug when time permits <ribasushi> this is definitely wrong
Subject: Re: [rt.cpan.org #115462] data_type => "varchar( 255 )" should be data_type => 'varchar', size => 255
Date: Sun, 19 Jun 2016 21:07:55 +0100
To: bug-DBIx-Class-Schema-Loader [...] rt.cpan.org
From: ilmari [...] ilmari.org (Dagfinn Ilmari Mannsåker)
"Lee Johnson via RT" <bug-DBIx-Class-Schema-Loader@rt.cpan.org> writes: Show quoted text
> riba asked me to report this, full convo follows: > > <ribasushi> data_type => "varchar( 255 )", > <ribasushi> <-- wrong (well, non-best-practice) > <ribasushi> data_type => 'varchar', size => 255 > <Lee> hmm, that came out of schema::loader - missing an option perhaps?
That should definitely work and is heavily tested. Which database are you using, and can you show the CREATE TABLE statement or table definition dump from the database as well as the full Schema::Loader invocation? -- "The surreality of the universe tends towards a maximum" -- Skud's Law "Never formulate a law or axiom that you're not prepared to live with the consequences of." -- Skud's Meta-Law
Subject: Re: [rt.cpan.org #115462] data_type => "varchar( 255 )" should be data_type => 'varchar', size => 255
Date: Sun, 19 Jun 2016 16:31:56 -0400
To: bug-DBIx-Class-Schema-Loader [...] rt.cpan.org
From: Lee J <leejo.65535 [...] gmail.com>
On 19 June 2016 at 16:08, (Dagfinn Ilmari Mannsåker) via RT < bug-DBIx-Class-Schema-Loader@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=115462 > > > "Lee Johnson via RT" <bug-DBIx-Class-Schema-Loader@rt.cpan.org> writes: >
> > riba asked me to report this, full convo follows: > > > > <ribasushi> data_type => "varchar( 255 )", > > <ribasushi> <-- wrong (well, non-best-practice) > > <ribasushi> data_type => 'varchar', size => 255 > > <Lee> hmm, that came out of schema::loader - missing an option perhaps?
> > That should definitely work and is heavily tested. Which database are > you using, and can you show the CREATE TABLE statement or table > definition dump from the database as well as the full Schema::Loader > invocation?
Yep, Using sqlite, Schema: https://github.com/leejo/battling_a_legacy_schema_with_dbic/blob/master/examples/db/legacy/updates/000_schema.sql Generating the sqlite db: https://github.com/leejo/battling_a_legacy_schema_with_dbic/blob/master/examples/db/legacy/rebuild.sh Loader script: https://github.com/leejo/battling_a_legacy_schema_with_dbic/blob/master/examples/db/gen_dbic_classes_legacy.sh (perl 5.24.0) Ta! Lee.
CC: undisclosed-recipients:;
Subject: Re: [rt.cpan.org #115462] data_type => "varchar( 255 )" should be data_type => 'varchar', size => 255
Date: Sun, 19 Jun 2016 21:34:11 +0100
To: bug-DBIx-Class-Schema-Loader [...] rt.cpan.org
From: ilmari [...] ilmari.org (Dagfinn Ilmari Mannsåker)
""(Dagfinn Ilmari Mannsåker)" via RT" <bug-DBIx-Class-Schema-Loader@rt.cpan.org> writes: Show quoted text
> "Lee Johnson via RT" <bug-DBIx-Class-Schema-Loader@rt.cpan.org> writes: >
>> riba asked me to report this, full convo follows: >> >> <ribasushi> data_type => "varchar( 255 )",
[…] Show quoted text
> That should definitely work and is heavily tested.
Turns out none of the tests use spaces inside the parens … Show quoted text
> Which database are you using,
… which breaks DBD::SQLite's ->column_info: Show quoted text
> my $dbh = DBI->connect('dbi:SQLite:')
bless( {}, 'DBI::db' ) Show quoted text
> $dbh->do('create table foo (bar varchar(10), baz varchar( 10 ))')
'0E0' Show quoted text
> +{ map +($_->{COLUMN_NAME} => { $_->{TYPE_NAME} => $_->{COLUMN_SIZE} }), > $dbh->column_info(undef, undef, 'foo', '%')->fetchall_arrayref({})->@* }
{ 'bar' => { 'varchar' => '10' }, 'baz' => { 'varchar( 10 )' => undef }, } We may have to add a workaround for that in the SQLite loader, but for now you can just remove the spaces inside the parens in your CREATE TABLE statements. -- "I use RMS as a guide in the same way that a boat captain would use a lighthouse. It's good to know where it is, but you generally don't want to find yourself in the same spot." - Tollef Fog Heen
This was reported to DBD::SQLite as https://rt.cpan.org/Ticket/Display.html?id=115465, and fixed in https://metacpan.org/release/ISHIGAKI/DBD-SQLite-1.52, so closing this ticket. - ilmari