Skip Menu |

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

Report information
The Basics
Id: 32293
Status: rejected
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: sven [...] sveneppler.de
Cc:
AdminCc:

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



Subject: Versioned schema skipps ALTER TABLE .* ADD Statements in first line
Date: Mon, 14 Jan 2008 15:17:37 +0100
To: bug-DBIx-Class [...] rt.cpan.org
From: Sven Eppler <sven [...] sveneppler.de>
Hello! I've played around with DBIx::Class::Schema::Versioned and figured out, that an ALTER TABLE column ADD Statement is only run by the upgrade process if it's not on top of all other Update-Statements to run. I have this diff-file created by create_ddl_file (wrapped the comment by hand): -- Convert schema 'upgrades/My-Schema-0.2-MySQL.sql' -- to 'upgrades/My-Schema-0.3-MySQL.sql': ALTER TABLE users ADD sometest VARCHAR(100); ALTER TABLE users CHANGE birthday birthday DATE NOT NULL; When running upgrade, only the ALTER TABLE users CHANGE Statement is run (watched at it with DBIC_TRACE=1). But the ALTER TABLE users ADD Statment is silently ignored. Even when overloading upgrade and set a RegExp that 100% matches the given statement, the statement is not executed. When changing the diff file by hand to: -- Convert schema 'upgrades/My-Schema-0.2-MySQL.sql' -- to 'upgrades/My-Schema-0.3-MySQL.sql': ALTER TABLE users CHANGE birthday birthday DATE NOT NULL; ALTER TABLE users ADD sometest VARCHAR(100); Everything just works out right. All statements get executed as expected, the databsase schema is updated and i can use the newly added column without any problems. I'm using the latest CPAN Release of DBIx::Class which is 0.08008. Hope this helps out so far. :) Greetings, Sven Eppler
Subject: Re: [rt.cpan.org #32293]
Date: Wed, 27 Feb 2008 21:26:11 +0100 (CET)
To: bug-DBIx-Class [...] rt.cpan.org
From: "Sven Eppler" <sven [...] sveneppler.de>
Today i reviewd this issue again and took a look into DBIx::Class::Schema::Versioned.pm and as far as i can oversee this, i found the problem around line 142 (not sure anymore, just edited too much blindly :D). The problem lies in the way the lines of the upgrade-file are splitted. In the original code you do: my @data = split(/;\n/, join('', <$fh>)); which tries to split the lines in $fh by the sequence of an semicolon followed by a newline. Probably meant was to split either on semicolon or on newline, so the pattern should look like this: my @data = split(/;|\n/, join('', <$fh>)); this works out fine for me now. Hopefully this helped out a little bit. :) Greetings, Sven
From: shane [...] eznettools.com
DBIx::Class::Storage::DBI::deploy has a similar problem: At line 1506 foreach my $line ( split(";\n", $statement)) { next if($line =~ /^--/); Has the same symptom of the first statement from the sql file being skipped when the file begins with comments.
Subject: Re: [rt.cpan.org #32293] Versioned schema skipps ALTER TABLE .* ADD Statements in first line
Date: Sat, 10 May 2008 15:22:49 +0100
To: Shane Corgatelli via RT <bug-DBIx-Class [...] rt.cpan.org>
From: Matt S Trout <mst [...] shadowcat.co.uk>
On Tue, May 06, 2008 at 03:34:02PM -0400, Shane Corgatelli via RT wrote: Show quoted text
> > Queue: DBIx-Class > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=32293 > > > DBIx::Class::Storage::DBI::deploy has a similar problem: > > At line 1506 > > foreach my $line ( split(";\n", $statement)) { > next if($line =~ /^--/); > > Has the same symptom of the first statement from the sql file being > skipped when the file begins with comments.
Do you guys actually care about this bug? If you do, please could you attach a failing test case rather than just keeping pointing out the line of code that I'll be changing when I fix it. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Director http://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
Marking ticket rejected in the absence of a failing test. If you wish to bring this back up again, please do so by posting a patch in diff -ur form to the DBIx::Class test suite to the dbix-class@lists.scsys.co.uk list.