Skip to content

Commit

Permalink
Add warning about common sqlite scheme mistake (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
outkine authored Jul 2, 2021
1 parent 809835d commit b8a46f4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/sql/sql.ml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ let sql_pool ?size uri =
begin match !pool_cell with
| Some pool -> inner_handler (Dream.with_local pool_variable pool request)
| None ->
let parsed_uri = Uri.of_string uri in
if Uri.scheme parsed_uri = Some "sqlite" then
log.warning (fun log -> log ~request
"Dream.sql_pool: 'sqlite' is not a valid scheme; did you mean 'sqlite3'?");
let pool =
Caqti_lwt.connect_pool ?max_size:size ~post_connect (Uri.of_string uri) in
Caqti_lwt.connect_pool ?max_size:size ~post_connect parsed_uri in
match pool with
| Ok pool ->
pool_cell := Some pool;
Expand Down

0 comments on commit b8a46f4

Please sign in to comment.