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

Suggestion: print a warning if a command might contain multiple statements #258

Open
aviflax opened this issue Dec 6, 2023 · 3 comments

Comments

@aviflax
Copy link

aviflax commented Dec 6, 2023

My Clojure is a little rusty so I can’t open a PR for this right now, but I’d like to at least make this suggestion because I just lost an hour trying to debug why my giant migration wasn’t working… turns out my migration contained dozens of statements as a single “command” — i.e. it wasn’t using the delimiter that is required as per the readme.

My rationale for this suggestion is that:

  • This just cost me an hour, and while I am rusty with Clojure, I am pretty experienced
  • I’ve found multiple other issues opened by people who encountered this problem over the years
    • it’s just very easy to miss that bit in the readme
    • especially since some other migrations frameworks do support multiple statements in a single .sql file
  • I would think it could be fairly easy to implement
    • e.g. something as simple as checking whether a command contains two or more instances of a semicolon followed by a linefeed might be helpful
@yogthos
Copy link
Owner

yogthos commented Dec 6, 2023

That sounds reasonable to me, could do a a heuristic check on the sql file content to see if it looks like it has multiple statements in it and warn. I've been bitten by this myself before actually, so I definitely understand the pain here. :)

@Gwonwoo-Nam
Copy link
Contributor

@yogthos I encountered a similar issue myself, and I’d like to fix it by implementing the solution discussed here. Would it be okay if I submitted a PR to address this? Please let me know if that works!

@yogthos
Copy link
Owner

yogthos commented Oct 2, 2024

Absolutely, a PR would be very welcome.

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