Created
November 1, 2010 17:13
-
-
Save davidsantiago/658517 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn ensure-database-exists | |
[request db-name & rest] | |
(-> request | |
(resource-when/resource-when | |
(= 0 @(psql "-t -c" | |
~(format "\"select count(1) from pg_database where datname='%s'\"" | |
db-name))) | |
(apply create-database request db-name rest)))) | |
;; Throws a stack trace complaining about too many args (5) to PersistentHashMap. | |
;; It will compile with the apply removed, but that is obviously wrong. | |
;; I cannot make it in any way do an if statement in the generated shell script. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment