-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
Metadata in migrations files? #136
Comments
The metadata approach is reasonable, and I'm already using |
So it would probably be preferable to use (by which I mean |
Yup, and that would also be in line with HugSQL syntax. |
Here are the HugSQL docs on it: https://www.hugsql.org/#sql-file Is this still being worked on? |
I haven't been working on it, but I'm open to the idea. There is already some ad hoc metadata parsing happening, so it would probably make sense to turn it into a multimethod. I'm also leaning towards declaring metadata at the top of the SQL statement as opposed to doing it inline. One idea could be to to just put EDN in a multi-line comment below the
Then the API would need to be extended to provide the list of migrations along with the metadata. Perhaps each migration could be represented as a map: {:id "..." ; migration id
:meta {...} ; map with the metadata
:status :complete ; :complete/:pending
:sql "..." ; migration string
} |
As you know I'm working on parsing Migratus migrations and using that parse-tree to build a complete application skeleton wrapping the database. Obviously also there is information required to build an application which isn't present in the raw SQL. Consequently I'm wondering about adding metadata into the files, and I want to be sure the way I'm considering doing that won't get in the way of anything you're planning.
What I'm thinking is something like this:
In summary, metadata would immediately follow the syntactic element it relates to, would start with the string
-- meta
, would be restricted to a single line, and would have a Clojure map as its value.Would this cause any problems for you?
The text was updated successfully, but these errors were encountered: