Fork me on GitHub
#sql
<
2022-07-27
>
pinkfrog02:07:00

Regarding migratus, my pattern is running the migration logic inside the application. Since there are multiple concurrent application running, I’d like to know if migratus can guarantee only one will succeed? The database will always be postgres.

seancorfield02:07:15

Looking at the code, I think it is thread safe because it "locks" on the migration ID by insertion into a table -- so only one process can succeed -- and the process that succeeds gets to check whether to actually apply that migration ID.

seancorfield17:07:40

No, next.jdbc does not accept a hash map containing :connection-uri. It would accept a JDBC connection string directly, instead, but I don't know whether Migratus would accept that for :db?

seancorfield17:07:17

You should create an issue on the Migratus GH repo about that in the docs -- they probably just missed that when they switched from c.j.j to next.jdbc

seancorfield17:07:11

I am considering allowing next.jdbc to accept such hash maps (both :connection-uri and :datasource) to make migrations (from c.j.j) easier...

seancorfield17:07:14

Oh, looking at the Migratus docs further, they do accept a string for :db -- so you'd use that form instead of a hash map containing :connection-uri

seancorfield01:07:27

https://clojars.org/com.github.seancorfield/next.jdbc/versions/1.2.999-SNAPSHOT supports this -- I'll create an issue on the Migratus repo to let them know about this.

👍 1
pinkfrog02:07:47

I am using the jdbcUrl pluse the user and password method. Sounds like migratus supports db-spec flavour setting.

seancorfield02:07:11

I'm confused -- :jdbcUrl is not supported by clojure.java.jdbc -- I thought you were asking about the change in Migratus from c.j.j to next.jdbc?

seancorfield02:07:08

I would expect :db to just be passed straight through to next.jdbc, to be honest. Did you try specifying :db {:jdbcUrl ...} (with user and password)?

seancorfield02:07:34

See https://github.com/yogthos/migratus/issues/221 -- feel free to add comments if I haven't covered what you're asking about.

Eugen07:07:29

hi, I did port migratus to next.jdbc. It does pass the :db spec directly to next.jdbc. We do have a bug that it does not fully support passing in a Connection or a DataSource object. I got busy with $work and did not have time to fix this issue yet. I would like for us to have tests for db-spec, Connection and DataSource. If you want and can help, don't hesitate.

Eugen07:07:02

thanks for reporting and @U04V70XH6 for helping out by enhancing next.jdbc