duct

armed 2019-03-20T06:06:43.036500Z

Hello, how to completely disable ragtime migrations in duct?

urbis 2019-03-20T08:28:25.038400Z

Hello, could somebody put me on the right track please with congif.edn. I have a problem with adding migrations: https://imgur.com/HLBWrYZ Can't understand why I have this error

Execution error (ClassCastException) at duct.core/fold-modules$fn (core.clj:145).
duct.database.sql.Boundary cannot be cast to clojure.lang.IFn

2019-03-20T16:35:06.039300Z

@janis.urbis I think you should move migrations to profile.

2019-03-20T20:10:41.041500Z

Has anyone played with programmatically controlling the config.edn file? e.g., I want to write a utility script to generate the skeleton of a migration; that script might as well also read config.edn, add the necessary keys, and write config.edn back out.

2019-03-20T20:11:42.042100Z

A challenge is the evaluation of reader literals when reading the config

2019-03-20T21:02:07.042600Z

Why don’t you use duct.core/read-config? https://github.com/duct-framework/core/blob/master/src/duct/core.clj#L116

2019-03-20T21:13:16.044500Z

I was; the challenge was not having the literals evaluate, for example, turning a relative duct/resource file path into an absolute path in the output. Here was the solution I ended up with that resolves the issue. I ended up scrapping the idea entirely because writing the file back out leads to some not-so-human-friendly formatting (even using pprint, or fipp, etc).

(def config-literals ['duct/resource 'duct/env 'ig/ref])
(defn pair-literal [x]
  [x #(tagged-literal x %)])

(defn read-config-keep-literals [file]
  (duct/read-config
   file
   (into {} (map pair-literal config-literals))))

2019-03-20T22:44:10.045500Z

Maybe you can use code from duct.core but without default readers? Like

(some->> source slurp (ig/read-string {:readers {}}))))

2019-03-20T22:46:33.046300Z

But the formatting will still be an issue though.

2019-03-20T22:54:35.047200Z

The reader issue is resolved in my snippet, above, it’s really just the formatting issue that’s preventing programmatic control, which would be really nice for some interesting developer-experience tooling (auto registering migrations, new handlers, etc)