juxt

2016-07-19T06:41:10.000009Z

@jonathanj why not use a file based one? then instead of having a totally fresh one each time you can down migrate and up migrate, thus testing your down migrators too

2016-07-19T06:42:10.000010Z

i do that here (wtih h2, but it used to use sqlite) https://github.com/oliyh/slacky/blob/master/src/slacky/db.clj#L61

2016-07-19T06:54:48.000012Z

or - give it a name, jdbc:sqlite::memory:my-test and i think that will work too

2016-07-19T06:55:08.000013Z

Contrary to the vast knowledge of Stack Overflow that’s not actually giving it a name.

2016-07-19T06:55:24.000014Z

That’s using an on disk file that is ./:memory:my-test.

2016-07-19T06:55:35.000015Z

(I found this out the hard way.)

2016-07-19T06:55:47.000016Z

yes

2016-07-19T06:55:59.000017Z

is there a reason you don't want to do that?

2016-07-19T06:56:41.000018Z

Well because I want to just build the file up from nothing each time without having to worry about what state I did or did not remember to reset.

2016-07-19T06:56:58.000019Z

@oliy: I think that a new temporary file or your method is probably the best choice, thanks for the code sample.

2016-07-19T06:57:18.000020Z

@oliy: You do make a good point about testing the down migrators too, I hadn’t thought of that aspect of it.

2016-07-19T06:57:51.000021Z

I’m just concerned that tests might pass even if everything didn’t go successfully and that some piece of database state is left lying around causing false negatives in my tests.

2016-07-19T06:58:16.000022Z

you could give it a random name each time then

2016-07-19T06:58:30.000023Z

i agree you don't want ambiguity in your tests

2016-07-19T06:59:21.000024Z

I thought an in-memory database would be the easiest way to actually do this but it was only after the weird errors that I realised the database is being recreated multiple times per test because the connection is not retained and reused.

2016-07-19T07:00:43.000025Z

there's possibly a way to give joplin a db connection instead of just a url - i can't remember if that ever got implemented. then you never relinquish it while you migrate

2016-07-19T07:00:54.000026Z

I couldn’t find out how.

2016-07-19T07:01:34.000027Z

Looking through the joplin.jdbc.database source I couldn’t see anything that would not try to construct a db-spec from a URL.

2016-07-19T07:02:49.000028Z

I think ragtime supports this though.

2016-07-19T07:10:57.000031Z

i guess for now you'll need to try one of the other approaches, or PRs welcome 🙂

2016-07-19T07:11:40.000032Z

Where can I learn about these jdbc db-spec maps?

2016-07-19T07:13:02.000033Z

I was trying to merge a connection and the (:db target) map but it didn’t produce any useful results and I’m not quite sure why since I don’t really understand all these different db-spec forms.

2016-07-19T07:13:16.000035Z

probably clojure.java.jdbc

mpenet 2016-07-19T09:46:13.000036Z

any thoughts about spec in the context of juxt librairies (since you use schema quite heavily) ?

malcolmsparks 2016-07-19T19:04:41.000037Z

Yes, yada will most likely move towards it but probably after 1.9 is released

👍 2