New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQL Flyway parse error caused by comment block containing flyway configuration items #3862
Comments
Hi @Phil-Factor , I looked into the issue posted and here are my findings:
|
My sample somehow got mangled during the paste-in process, The code used to work fine and hasn't changed. All I did was to upgrade flyway. Obviously, when the error happened, I removed the initial comment block and it then worked fine.
|
{ |
Hi @Phil-Factor , I have copied the exact new text format you posted, but I couldn't reproduce this error. |
It looks like it's been fixed then. I'll upgrade to Flyway 10.11.1 and try it again |
Many thanks @Phil-Factor. I will keep this ticket open for a while and welcome to raise any questions if this issue persists. |
Which version and edition of Flyway are you using?
10.10.1
Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)
CLI
Which database are you using? (Type & version)
SQL Server 2017
Which operating system are you using?
Windows 10
What did you expect to see?
I have a SQL Callback called afterInfo__Toggle.sql 'that used to work fine but now triggers an error
What did you see instead?
flyway : ERROR: Unable to parse statement in .\migrations\Callbacks\afterInfo__Toggle.sql at line 1 col 1. See https://rd.gt/3ipi7Pm for more
information. Input length = 1
At line:1 char:1
flyway info
Caused by: java.nio.charset.MalformedInputException: Input length = 1
What did you do? (Please include the content causing the issue, any relevant configuration settings, the SQL statement(s) that failed (if any), and the command you ran)
It was a callback that used to run I expected it to run without an error as it used to in a previous version
/*
Before this code can be used in a callback, you must have the following
default value for flyway.placeholders.Toggle set in the project flyway.conf
otherwise you'll get an error.
flyway.placeholders.Toggle=Yes
To turn the toggle on, use flyway.placeholders.Turnit=on otherwise
flyway.placeholders.Turnit=on
in the commandline, this will look like …
flyway info '-placeholders.Toggle=Yes' '-placeholders.Turnit=on'
You will, of course, need to add the DCL code that adds or removes
membership of the users roles (e.g. HR, Accounts) to the role that
allows access
*/
IF ('${Toggle}' = 'Yes')
BEGIN --only execute this if flyway.placeholders.Toggle=Yes
IF ('on' = '${TurnIt}') --if flyway.placeholders.Turnit=on
BEGIN /* the start of the block that you excecute to switch
the toggle on */ SELECT 'We have executed the code for turning the feature on'; END; ELSE IF ('off' = '${TurnIt}')--if flyway.placeholders.Turnit=off BEGIN /* the start of the block that you excecute to switch
the toggle off */
SELECT 'We have executed the code for turning the feature off';
END;
ELSE
BEGIN
SELECT 'We couldn''t recognise your ''${TurnIt}'' instructiions';
END;
END;
What did you expect to see?
A callback executed as usual
What did you see instead?
The error message reproduced above
The text was updated successfully, but these errors were encountered: