Fork me on GitHub

@myguidingstar we could say that we have Clojure on Duct as similar to Ruby on Rails hehehehehehe. Duct is awesome. 😄


totally agree 😄


I'm trying to setup ragtime migrations in my project - looking at I really don't want to write my sql scripts inside the config.edn file. There's a mention that URLs are possible:

Migrations built in this way expect an :up and a :down key that contain vectors of SQL, either as strings, or URLs to resources on the classpath.


However, I'm having a hard time to figure out how to do that. I've tried this:

 {:migrations [#ig/ref :my-app.migrations/init]}

 [:duct.migrator.ragtime/sql :my-app.migrations/init]
 {:up ["migrations/2018-13-03-init.sql"]
  :down []}

but got sql exception:
Caused by org.postgresql.util.PSQLException
   ERROR: syntax error at or near "migrations" Position: 1


How people usually do that? I can't imagine that putting all those scripts into a config is a manageable way to do that... Ideally, I'd like to just configure the directory that contains all db migration scripts and everything else will be handled automatically without any need to always add a new config when new migration script is added.


@jumar try :up [#duct/resource "migrations/2018-13-03-init.sql"]


@mariusz_jachimowicz great, that indeed seems to work - thanks! Any ideas about automating migrations handling (i.e. without having to update config.edn every time I add new migration script)


you can try my module if you don't want to write migrations references each time.


Will look into that - thanks.


@weavejester do you use the manual approach by writing the migrations inside the config file?


@jumar you can also look on if you want more advanced migrations - as an clj files. Just include the namespace.