Unwrap exception and use sql/execute! instead of do-do-commands


1. Unwrap exception 

    Tries to replace the current exception with .getNextException in the SQL case.
    With the postgres adapater only getNextException will show something helpful. 

2. sql/execute!

    This enables to load sql-files like:

          (defn up [] [(slurp "migrations_sql/create-links.up.sql")])

    Imho sql-files are much more convenient for pure DDL statements. 
On 11.06.14 18:30, Christopher Kuttruff wrote:
> Thomas, figured this might be the case; thanks for the explanation.
>
> you mind pushing up a new commit to rectify this?
>
Yes, will do. It might take a few days.
>
> http://stackoverflow.com/a/17503741/1566623
> ^This is how I've worked with local modifications of leiningen
> projects in the past without having to mess with clojars at all.
>
Yes, I figured that too. I use the lein-localrepo plugin which
simplifies the process a bit.

However, in this case, I needed the plugin on several remote machines;
therefore clojars.
>
> —
>
> <https://github.com/ckuttruff/clj-sql-up/pull/4/files#r13659058>
>
There is one more thing. The DB configuration inside `project.clj` is
not very practical for
running the migrations via some tools (ansible e.g.) on remote machines
where the configuration
is diverse. I would require to mange `project.clj` too.

What I do now is something like:

 :clj-sql-up {:database ~(slurp "jdbc_conf.txt")

However, there are some quirks with that (somehow the file must look to
slurp like a binary, otherwise
it will mess up the configuration by escaping slashes and so on ...).

Is there a way to declare a external configuration file?  Actually, a
read the code and it seem not.
Do you have an opinion on how it should be done?



Best wishes

Thomas Schank

-- 

http://drtom.schank.ch/

+ 41 76 264 76 10	

Dr. Thomas Schank
Brüggliweg 2
6300 Zug
Switzerland