{"action":"created","issue":{"url":"https://api.github.com/repos/ato/clojars-web/issues/396","labels_url":"https://api.github.com/repos/ato/clojars-web/issues/396/labels{/name}","comments_url":"https://api.github.com/repos/ato/clojars-web/issues/396/comments","events_url":"https://api.github.com/repos/ato/clojars-web/issues/396/events","html_url":"https://github.com/ato/clojars-web/pull/396","id":112496438,"number":396,"title":"Replace korma with yesql+HikariCP","user":{"login":"xeqi","id":51907,"avatar_url":"https://avatars.githubusercontent.com/u/51907?v=3","gravatar_id":"","url":"https://api.github.com/users/xeqi","html_url":"https://github.com/xeqi","followers_url":"https://api.github.com/users/xeqi/followers","following_url":"https://api.github.com/users/xeqi/following{/other_user}","gists_url":"https://api.github.com/users/xeqi/gists{/gist_id}","starred_url":"https://api.github.com/users/xeqi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xeqi/subscriptions","organizations_url":"https://api.github.com/users/xeqi/orgs","repos_url":"https://api.github.com/users/xeqi/repos","events_url":"https://api.github.com/users/xeqi/events{/privacy}","received_events_url":"https://api.github.com/users/xeqi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-10-21T02:05:54Z","updated_at":"2015-10-27T04:30:53Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ato/clojars-web/pulls/396","html_url":"https://github.com/ato/clojars-web/pull/396","diff_url":"https://github.com/ato/clojars-web/pull/396.diff","patch_url":"https://github.com/ato/clojars-web/pull/396.patch"},"body":"DB access drops down to sql in serveral places. Korma does not appear to be providing a good abstraction. This PR removes korma and replaces it with yesql + HikariCP. Using yesql allows sql to be in sql without the string concatenation that raw clojure.jdbc would require.\r\n\r\nThe tests see significant changes to account for the new apis. Additionally the fixtures change to allow keeping one connection to the database per test, and an in memory database is used.\r\n\r\nThe clojars admin namespace contains a dynamic var for its database connection.  The nrepl server uses some middleware to populate that var for connections.\r\n\r\nThe one off tasks (migrations,setup) are changed to use the new apis.\r\n\r\nUnfortunatly `lein ring` no longer works as a database needs to be passed to the handler. I plan for a reloaded repl based workflow to replace the \"dev server\" functionality.\r\n\r\nThe majority of the line changes are for threading the database throughout the app. This allows the removal of one of the pieces of global state. It is a bit ugly as it shows some places that are using the database that could be done differently. Additionally, making it explicit is a step towards eventual component-ization of the app.\r\n\r\nI believe this commit to be in a state that could be merged. However, changing out the db abstraction should be a consensus decision, so interested to hear comments on it."},"comment":{"url":"https://api.github.com/repos/ato/clojars-web/issues/comments/151372016","html_url":"https://github.com/ato/clojars-web/pull/396#issuecomment-151372016","issue_url":"https://api.github.com/repos/ato/clojars-web/issues/396","id":151372016,"user":{"login":"ato","id":10588,"avatar_url":"https://avatars.githubusercontent.com/u/10588?v=3","gravatar_id":"","url":"https://api.github.com/users/ato","html_url":"https://github.com/ato","followers_url":"https://api.github.com/users/ato/followers","following_url":"https://api.github.com/users/ato/following{/other_user}","gists_url":"https://api.github.com/users/ato/gists{/gist_id}","starred_url":"https://api.github.com/users/ato/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ato/subscriptions","organizations_url":"https://api.github.com/users/ato/orgs","repos_url":"https://api.github.com/users/ato/repos","events_url":"https://api.github.com/users/ato/events{/privacy}","received_events_url":"https://api.github.com/users/ato/received_events","type":"User","site_admin":false},"created_at":"2015-10-27T04:30:53Z","updated_at":"2015-10-27T04:30:53Z","body":"sqlite-jdbc [synchronizes](https://github.com/xerial/sqlite-jdbc/blob/b17609c0b36c37c010e7a8599bd7b930de9f1af6/src/main/java/org/sqlite/core/DB.java#L822) per-connection. So it's safe to use from multiple threads (as long as you don't use multi-statement operations like transactions!) but there's no read-parallelism. Using a connection pool also seems the correct choice to me."}}