frioux/DBIx-Class-DeploymentHandler — pull request #15 by columbusmonkey (2013-05-07 19:47:00+00:00)
Title:  _split_sql_chunk() can break user defined SQL for VIEWs that contain blank lines

If I have a view that starts with a newline, then DBIC generates something like the following:

CREATE
VIEW `view1` ( `col1` ) AS

SELECT
cola...

...and then _split_sql_chunk() will join the AS and the SELECT into ASSELECT and break the deployment. (Tested on MySQL.)

This is the (over zealous?) trimming:

# trim whitespaces
s/^\s+|\s+$//mg;

Is there a reason to do this trim?

(The pull request adds a test to show the problem, but not yet a solution.)