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

Header comment on stored procedure #1362

Closed
andrey-poltavskiy opened this issue Jul 13, 2016 · 7 comments
Closed

Header comment on stored procedure #1362

andrey-poltavskiy opened this issue Jul 13, 2016 · 7 comments

Comments

@andrey-poltavskiy
Copy link

@andrey-poltavskiy andrey-poltavskiy commented Jul 13, 2016

What version of Flyway are you using?

4.0.3

What database are you using (type & version)?

Microsoft SQL Server 2014 - 12.0.4100.1 (X64)

What operating system are you using?

Microsoft Windows [Version 10.0.10586]

What did you do?

-- =============================================
-- Description: ...
-- =============================================
CREATE PROCEDURE dwh.p_address_save () AS
BEGIN
...
END;
After compile this procedure in Managment Studio i see comment in DDL statment. After Flyway disapear.

What did you expect to see?
What did you see instead?
@maxiwheat
Copy link

@maxiwheat maxiwheat commented Dec 7, 2016

+1 for this one, Can be worked around by making header comments inside procedures, but with a DB with hundreds of Stored Proc it's a little more annoying.

@clabnet
Copy link

@clabnet clabnet commented Mar 13, 2017

What version of Flyway are you using?
Flyway 4.1.0

What database are you using (type & version)?
Microsoft SQL Server 2012 (SP3) (KB3072779) - 11.0.6020.0 (X64)
Oct 20 2015 15:36:27
Copyright (c) Microsoft Corporation
Standard Edition (64-bit) on Windows NT 6.2 (Build 9200: ) (Hypervisor)

What operating system are you using?
WIN 10 PRO EN

The same issue as above.

@kzibreg
Copy link

@kzibreg kzibreg commented Mar 19, 2017

What version of Flyway are you using?
Flyway 4.1.2
What database are you using (type & version)?
Microsoft SQL Server 2008 (SP4) - 10.0.6241.0 (X64) Standard Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1) (VM)

What operating system are you using?
Windows 8.1 Enterprise

The same issue as above (with Stored procedures, Functions, Views) .

@jaygurnani
Copy link

@jaygurnani jaygurnani commented Apr 21, 2017

What version of Flyway are you using?
Flyway 4.0.3

What database are you using (type & version)?
Microsoft SQL Server 2014 (SP2) (KB3171021) - 12.0.5000.0 (X64)

What operating system are you using?
Windows 10

The same issue as above with stored procs

@jaygurnani
Copy link

@jaygurnani jaygurnani commented Apr 26, 2017

This seems to be deliberate by design?

/** * @return Whether the current statement is only closed comments so far and can be discarded. */ public boolean canDiscard() { return !insideAlternateQuoteStringLiteral && !insideQuoteStringLiteral && insideMultiLineComment && !nonCommentStatementPartSeen; }

If this is the case, we could override what exists for the SQLServer class so that the nonCommentStatementPartSeen returns true (although this is a messy solution). From my understanding, the problem is that multiple lines starting with "--" are treated as single line comments rather than the multi-line comments they are. Flyway, will then discard them. @axelfontaine, can you please advise? Thanks,

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Apr 4, 2018

This has now been implemented. Headers comments are now properly preserved.

@vxavictor513
Copy link

@vxavictor513 vxavictor513 commented Jul 20, 2018

@axelfontaine: This fix has caused a new issue. Single-line comments that start with -- but not followed by a whitespace would cause migration to fail.

Prior to the fix (version 5.0.7 and below), comments like this are discarded.

Example:

--Hello
CREATE TABLE `products` (
  `product_code` VARCHAR(10) NOT NULL,
  `product_type` VARCHAR(1) NOT NULL,
  PRIMARY KEY (`product_code`));

See #2081

dohrayme pushed a commit to dohrayme/flyway that referenced this issue Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants