Closed plexus closed 8 years ago
Code that generates SQL is a rabbit hole that I don't want to go down in Ragtime itself. However, as Ragtime is extensible, you could create your own library that parses that syntax and converts it into records or objects that satisfy the Migration
protocol.
Alright, good to know. Thanks for the speedy response!
This is a suggestion on how to extend Ragtime. I found myself using this in my own project. I'm not sure if this is in line with the design ideas of Ragtime, but if there is interest to add this then I'd be happy to cook up a proper PR.
The idea is, in EDN files, to allow not just strings of raw sql, but also structured expressions, so you get structural editing, syntax highlighting, etc.
The result looks like this
The syntax for the table name and fields is identical to what
clojure.java.jdbc/create-table-ddl
uses, in fact it just delegates tocreate-table-ddl
and friends.This is what my current implementation looks like. It uses a different file extension (
.migration
), but it could just as well replace the.edn
implementation, it would be backwards compatible.The code is a bit hack-ish (pokes into private vars), so it would need some cleanup.