-
Notifications
You must be signed in to change notification settings - Fork 28
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
UNIQUE on the table #15
Comments
This is the ugly workaround: (let [unique-sql & _] (when unique-columns
(-> (apply sql/call :unique unique-columns)
(sql/format :parameterizer :postgresql)))
(str/replace table-stmt #"\)$" (str ", " unique-sql ")")) |
@krish8664 any advice/recommendation on this one? |
@arichiardi I think the idea would be to come up with a way to specify constraints outside of the inlined way it is possible right now. Let me think about this for a bit. (-> (create-table :films)
(with-columns [[:a :integer]
[:b :integer]
[:c :integer])
(constrain [:unique [:a :c]])) This should be possible to achieve. Alternatively if you have found a better way to do this, I would like to hear about that. P.S: Sorry about the extremely delayed response, I haven't been very active here on github for quite sometime. This would change going forward. |
Agree that what you wrote feels right, basically a way to add constraints to columns. I see inline would be difficult to make it work. PS.: Good to have you back! |
I would like to achieve the following (from here:
And I see that there is an
(sql/call :unique ...)
I can use, but the problem is that I don't really see how to achieve that, maybe because I don't know how to hook in that:with-columns
map.Any recommendation on how to do that?
The text was updated successfully, but these errors were encountered: