Fork me on GitHub
#sql
<
2020-02-03
>
jwoods03:02:15

@seancorfield looking into next.jdbc I will let you know if I have questions Thanks for the help.

seancorfield04:02:23

Sure thing. We use it very heavily at work for MySQL. I maintain HoneySQL as well, these days, so I can answer Qs about that if you go that way (and there's a #honeysql channel). You'll run across clojure.java.jdbc in a lot of the books/tutorials which I maintained for eight years as the forerunner to next.jdbc.

🙂 4
jwoods04:02:02

@seancorfield db migrations are not a thing correct? I'm okay creating and updating a db I just want to try and do the standard thing.

seancorfield04:02:50

There are several migration libraries... Migratus is one that comes to mind (although I don't use any of them).

seancorfield04:02:03

We have our own custom migration code at work.

seancorfield04:02:19

One of those uses date/time stamps which is probably what we'd use at work if we were starting over.

seancorfield04:02:38

We went with a DB "version" number, which is what the other of those two libs does.

seancorfield04:02:22

Yeah, Migratus uses the timestamps. That's the one I was thinking of.

jwoods04:02:55

sweet thanks

dharrigan06:02:05

@jdwoodsy1 I use FlywayDB - super easy to use, althought nothing "native" for Clojure, the interop is trival. I use FlywayDB for my Kotlin projects too.

dharrigan06:02:57

Here is an example

jwoods14:02:44

Thanks I will look into this as well.

Ben Hammond17:02:07

hi guys I'm using Postgres advisory locks for a process that is inconveniently situated to squash into a single transaction. I'm also using Hikari Connection Pool, and I'm wondering if this is a bad combination. What are the chances of

pg_advisory_unlock
happening on a completely different connection to the one that acquired the lock. (5 in 6, I presume)

Ben Hammond17:02:26

Is there a body of wisdom about how to approach this?

Ben Hammond17:02:56

should I just use

jdbc/with-db-connection
for the entire process

Ben Hammond17:02:46

oh sorry, I though pinning was private

isak18:02:09

@U793EL04V I'm not an expert on this, but I see they use pg_backend_pid() in que (a ruby job system based on advisory locks)

Ben Hammond20:02:58

interesting. thanks

hiredman20:02:01

I worked on a project that at one point used advisory locks in a job queue kind of thing, I don't recall if that was just an initial design or it went to production with it. You definitely need to be careful mixing them with a connection pool (which it sounds like what your question was). You'll want to get a connection from the pool and keep it and not return it to the pool until you unlock

👍 4