@seancorfield looking into next.jdbc I will let you know if I have questions Thanks for the help.
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
.
@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.
There are several migration libraries... Migratus is one that comes to mind (although I don't use any of them).
We have our own custom migration code at work.
One of those uses date/time stamps which is probably what we'd use at work if we were starting over.
We went with a DB "version" number, which is what the other of those two libs does.
Yeah, Migratus uses the timestamps. That's the one I was thinking of.
sweet thanks
migratus is nice
@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.
Here is an example <https://git.sr.ht/~dharrigan/startrek/tree/master/src/startrek/migration.clj>
Thanks I will look into this as well.
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)Is there a body of wisdom about how to approach this?
should I just use
jdbc/with-db-connection
for the entire processoh sorry, I though pinning was private
@ben.hammond 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)
https://github.com/que-rb/que/blob/1736d3a30612f90a6839c5f98f622c9585e51784/lib/que/locker.rb
interesting. thanks
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