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

Multi-command .sql migrations #110

Open
armstnp opened this issue Jan 25, 2023 · 0 comments
Open

Multi-command .sql migrations #110

armstnp opened this issue Jan 25, 2023 · 0 comments

Comments

@armstnp
Copy link
Contributor

armstnp commented Jan 25, 2023

Currently, .sql migration files do not support multiple commands. The entire string is passed in to clojure.java.jdbc/db-do-commands. According to the changelog, as of 2016:

db-do-commands now expects multiple commands to be be wrapped in a vector JDBC-122. The single command form is unchanged (but may be wrapped in a vector).

This behaviour is reflected when multi-command migrations are run: only the first command takes effect, and the rest are silently skipped.

One way to mitigate this could be to require sentry lines between subcommands of a given migration direction, in a similar way to how up and down direction pragmas are implemented.


On a similar vein, unfortunately, there also seems to be issues that I can't quite pin down in the application of split Clojure migrations. When running a migration with up and down functions, coast db migrate seems to be trying to pick and run the down migration instead of the up. What's odd is that the code and docs don't seem to have this wrong, so I'm not sure why this is. After digging a bit further, I think I have an idea of the culprit, dealt with in #111.

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

No branches or pull requests

1 participant