-
Notifications
You must be signed in to change notification settings - Fork 85
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
Parameters in JDBC Migration #112
Comments
Could you tell me a little more about your use-case? At first glance this seems fine, but I'd like to know a little more about what circumstances this is used for. It seems like it's quite a niche bit of functionality. |
Sure. In my case, I know that a few very similar migrations will be coming up repeatedly in the future. So, to make the chore a bit more bearable, I'm programatically generating them from a declarative input format that looks similar to the following: {:add-relationships
{"a" "b"
"b" "c"}
:remove-relationships
{"g" "h"}} My program then produces a migration akin to: (ragtime.jdbc/sql-migration
{:id "some-id"
:up [["INSERT INTO relationships (from, to) VALUES (?, ?)" "a" "b"]
["INSERT INTO relationships (from, to) VALUES (?, ?)" "b" "c"]
["DELETE FROM relationships WHERE from = ? AND to = ?" "g" "h"]]
:down [["DELETE FROM relationships WHERE from = ? AND to = ?" "a" "b"]
["DELETE FROM relationships WHERE from = ? AND to = ?" "b" "c"]
["INSERT INTO relationships (from, to) VALUES (?, ?)" "g" "h"]]}) Of course, one could argue the use case (which is more data management than database management), but allowing use of SQL query vectors has the following advantages for me:
The latter two apply to the already existing EDN JDBC migrations, as well, IMO. |
Using the EDN-based JDBC migrations – which I'm trying to create on-the-fly from a non-SQL specification – I'd like to do the following:
ragtime.jdbc/execute-sql!
currently can't handle this. This could be added in a completely backwards-compatible manner and I'd be happy to supply a patch if desired.The text was updated successfully, but these errors were encountered: