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

Add comment support #15 #32

Conversation

mookjp
Copy link

@mookjp mookjp commented Jul 26, 2020

WHAT

  • Add supports comments in DDL; only manual addition
    • I know there's already issue to store the comments both in importing and exporting on Preserve comments for schema.sql #15, but it supports only manual addition of comments so that we can leave some comments and restored them on local if they are missed by other wrench operation, temporarily

WHY

  • Supporting comments on DDL is helpful, if it is only manual addition temporarily

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@mookjp
Copy link
Author

mookjp commented Jul 26, 2020

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@mookjp mookjp marked this pull request as ready for review July 26, 2020 11:31
@mookjp
Copy link
Author

mookjp commented Jul 27, 2020

I will think about the better approach like #15 and left this PR until then!

@vvakame
Copy link
Collaborator

vvakame commented Aug 7, 2021

@110y how about this PR? I need comment support 😉

@mookjp mookjp force-pushed the add-support-to-have-comments-in-sql branch from e370ad3 to 67b5c48 Compare October 4, 2021 11:59
@halmai
Copy link
Contributor

halmai commented Oct 8, 2021

I would also need to add comments to the scripts but unfortunately, a regexp-based solution is not reliable enough.

For example, if there is a command like this in the script:

INSERT INTO mytable (field) VALUES ('-- hello --')

it will become wrong:

INSERT INTO mytable (field) VALUES ('

illustration: https://play.golang.org/p/28ELu7ugA2D

I think a more careful parsing is needed.

I am happy to implement it but don't want to take it out from your hand either. Please, let me know if you have time for it, otherwise I will start working on it.

Another note: maybe not everybody is happy with a breaking change how wrench works. Therefore, I would be more conservative and would add a command-line option to turn ON the comment removal. The default behaviour should be the original behaviour.

110y
110y previously approved these changes Jul 17, 2022
@110y 110y dismissed their stale review July 17, 2022 09:19

consider this: #32 (comment)

@110y
Copy link
Collaborator

110y commented Jul 27, 2022

@mookjp @halmai

Sorry for tooooo late, but now wrench support writing comments to DDL/DML files by this PR: #54, which parses DDL/DML and ignore comments by using spansql.

So, let me close this PR, thank you so much 🙏

@110y 110y closed this Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants