Skip to content
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

Line break settings are not respected (Windows) #1420

Closed
jdoose opened this issue Sep 6, 2016 · 2 comments
Closed

Line break settings are not respected (Windows) #1420

jdoose opened this issue Sep 6, 2016 · 2 comments

Comments

@jdoose
Copy link

jdoose commented Sep 6, 2016

What version of Flyway are you using?

Flyway 4.0-4.0.3

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin, SBT plugin, ANT tasks)

Command Line

What database are you using (type & version)?

MS SQL Server 12

What operating system are you using?

Windows 10

What did you do?

(Please include the content causing the issue, any relevant configuration settings, and the command you ran)

I created the following sql script:

CREATE PROCEDURE CreatePriceData
AS 
BEGIN
 PRINT 'Test'
END

with the settings UTF-8, Windows Line Endings (CR/LF) and named it V1_0__initial.sql.

Then I executed flyway: flyway migrate

What did you expect to see?

I expected flyway to recreate the stored procedure exactly as I specified it in the sql script file.
In my case this is essential since I want to use the Schema Compare Tool of Visual Studio to find any changes I made compared to a productive version of the database.

What did you see instead?

When I opened Microsoft SQL Server Management Studio and tried to modify the stored procedure there was an error box complaining about inconsistent line breaks and offering to repair it.

Since I am usually not doing any Java projects I do want to submit a pr, but I think I found the responsible line in the code:
flyway/flyway-core/src/main/java/org/flywaydb/core/internal/dbsupport/SqlStatementBuilder.java, line 178: statement.append("\n");

This should not use a hardcoded \n but

  1. either the used line endings of the script file (preferrably)
  2. make the used line endings configurable

I can provide more info or test changes if you need anything.

@maxiwheat
Copy link

+1

@axelfontaine axelfontaine added this to the Flyway 5.1.0 milestone Nov 27, 2017
@axelfontaine
Copy link
Contributor

This has now been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants