Fork me on GitHub
Dave Simmons19:03:18

Hi all. I'm pretty new to Duct but really enjoying it. I've come across an issue and I'm not sure if it is user error or not. I have the following ragtime migration defined in my config.edn:

Dave Simmons19:03:40

; Migrations :duct.migrator/ragtime {:migrations [#ig/ref :guestbook.migration/create-guestbook]} [:duct.migrator.ragtime/sql :guestbook.migration/create-guestbook] {:up [#duct/resource "migrations/wibble.up.sql"] :down [#duct/resource "migrations/wibble.down.sql"]}

Dave Simmons19:03:58

but when I run (go) or (reset) I get

Dave Simmons19:03:26

Execution error (IllegalArgumentException) at duct.core.resource.Resource/make_reader (resource.clj:13).

Dave Simmons19:03:41

Cannot open <nil> as an InputStream.


That usually indicates that the resource cannot be found. Do you have a file at: resources/migrations/wibble.up.sql?

Dave Simmons19:03:28

I'm guessing it can't find my external migration file but they are definately in resources/migrations. Am I missing something here?

Dave Simmons19:03:24

Hi @weavejester - I did. Just to check should that be resources/<project name>/migrations ?

Dave Simmons19:03:30

or resources/migrations.


In your earlier example, you just used resources/migrations.

Dave Simmons20:03:05

I did but I've noticed resources has a sub directory with my project (so resource/guestbook) if that makes sense.


Yes; ideally you’d use guestbook/migrations rather than just migrations, but that’s just convention.

Dave Simmons20:03:15

I'll give this a go and let you know how I get on (thanks for the awesome work you've done BTW).


You could also try going to your REPL and seeing if (io/resource "migrations/wibble.up.sql") returns anything.


Although I doubt this is the issue; If you're using the lein template, then the sql module is probably outdated. [duct/module.sql "0.6.0"] Is the latest. iirc there's also an update for ragtime in there. Just an FYI


The new ragtime version also allows you to automatically include migrations, instead of having to write all of them in your config:

 {:migrations #ig/ref :duct.migrator.ragtime/resources
  :database #ig/ref :duct.database/sql}

 :duct.migrator.ragtime/resources {:path "myapp/migrations"}

lol 1

I should probably update the template with the new version.


I think that would be nice. The current template is also still on 0.7.0. And if you update to 0.8.0 it breaks because the hawk dependency is missing


Which is fixed in the latest commit of the template

Dave Simmons20:03:00

thanks for all the tips everyone. I'll give these a try and get back to you on how I get on. cheers.

Dave Simmons20:03:15

Getting a bit further 🙂. I changed the resource path to "guestbook/migrations/wibble.up.sql" and now I get a db-spec null is missing a required parameter.


If you’re not doing anything proprietary, perhaps post up your repo?

Dave Simmons20:03:11

Sure no problem - I'm just playing around so no problem. I'll post up a smaller app which also displays the problem.


I don’t see anything obviously wrong with that… when the exception occurs, can you (pst) it? What happens if you lein clean and restart your REPL?


Shouldn't the [:duct.migrator.ragtime/sql :foo.migration/wibble] be inside the base profile?

Dave Simmons20:03:18

Ah - thank you - this has caught me out before on something else. Huge thanks to all. Appreciate the help.


I think there’s a PR for duct/core to make these errors more obvious. I should probably look into merging that!


@weavejester That PR is still open about checking the module keys 🙂


I’ve been busy with a contract recently and with Clojurist’s Together funding of Ring, so I haven’t had a chance to look into Duct I’m afraid.


Yeah that's understandable. Looking forward to Ring 2.0 👍

Dave Simmons20:03:10

Actually @weavejester - while you are online - there is a video of you talking about integrant at Skills Matter but their site seems to be down. Do you know if there are any other links to the presentation?


No, but Skills Matter should have their site back up at some point, as they got investor backing… although maybe they won’t be able to weather COVID-19.

Dave Simmons07:03:11

Ah ok. Thanks anyway.


The SkillsMatter site is back up and the videos are available again (with a free login as before)

Dave Simmons09:03:43

@U05254DQM - just noticed your message - many thanks for the update.