Thanks John!
Yes, the generated DDL can be quite ugly, which is why I reformatted it
in the first place ( the full file that caused the error is longer and
it looked really unreadable at first).
For that reason, I think it would be good to mention the problem as
peope could well be tempted to re-format the DDL and then get this
completely cryptic error.
Yes, your modules are incredibly useful to me - I still owe you a little
write-up of my experiences so far. Haven't forgotten, just didn't have
the time yet...
Cheers,
Frank
On 12/06/12 14:24, jjn1056@yahoo.com via RT wrote:
Show quoted text> <URL:
https://rt.cpan.org/Ticket/Display.html?id=77777>
>
> Hi,
>
> I've noticed that the code that chops up a DDL to execute can be a little cranky. I would love to get a test case, although in the end I might end up transfering the issue to DBIC:DH, which is the framework that does all the heavy lifting.
>
> A failing test case would definitely help and also prevent regressions (my guess is that the job of chopping up and executing the ddl is a bit more tricky than might be desired.
>
> I think also I want to take a second look at how SQLT generates some of this DDL code. The output is far from clean.
>
> Thanks for bringing this to my attention, and hope the DBIC:M has been otherwise useful to you.
>
> Johnn
>
>
>> ________________________________
>> From: Frank Schwach via RT<bug-DBIx-Class-Migration@rt.cpan.org>
>> To:
>> Sent: Tuesday, June 12, 2012 9:16 AM
>> Subject: [rt.cpan.org #77777] Suggestion for documentation regarding whitespace in DDL files
>>
>> Tue Jun 12 09:16:02 2012: Request 77777 was acted upon.
>> Transaction: Ticket created by fschwach
>> Queue: DBIx-Class-Migration
>> Subject: Suggestion for documentation regarding whitespace in DDL files
>> Broken in: 0.024
>> Severity: Wishlist
>> Owner: Nobody
>> Requestors: fs5@sanger.ac.uk
>> Status: new
>> Ticket<URL:
https://rt.cpan.org/Ticket/Display.html?id=77777>
>>
>>
>> I just came across some unexpected behaviour that took me some time to
>> figure out. The issue is not caused by DBIC::Migration but it would be
>> good to mention it in the docs as a possible gotcha.
>>
>> It seems that the SQL::Translator has a problem with leading whitespace
>> in DDL files, even if the statement is actually syntactically correct.
>>
>> The following migration throws and error:
>>
>> BEGIN;
>> ;
>> ALTER TABLE addresses DROP PRIMARY KEY ,
>> ADD COLUMN organization VARCHAR(100) NOT NULL,
>> ADD PRIMARY KEY (id)
>>
>> ;
>>
>> COMMIT;
>>
>> The error is:
>> DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::__ANON__():
>> DBI Exception: DBD::mysql::db do failed: Query was empty [for Statement ""]
>>
>> I have:
>> DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator
>> version 0.002100
>>
>> and
>> SQL::Translator
>> Version: 0.11010
>>
>> But removing all leading whitespace results in a successful migration,
>> so this works:
>>
>> BEGIN;
>> ;
>> ALTER TABLE addresses DROP PRIMARY KEY ,
>> ADD COLUMN organization VARCHAR(100) NOT NULL,
>> ADD PRIMARY KEY (id)
>>
>> ;
>>
>> COMMIT;
>>
>> But the first version works in a mysql shell with the leading
>> whitespace, so it is surprising that the migration fails.
>>
>> The leading whitespace in my case is the result of auto-formatting (in
>> vim) the DDL file that was auto-generated by the
>> dbic-migration prepare
>> command.
>>
>> I can try to write this up for your docs and submit a patch if you want
>> to include this.
>>
>>
>>
>>
>>
>>
--
The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.