use caqti infix
This commit is contained in:
parent
d57c359b1f
commit
6b5bfcd144
5 changed files with 102 additions and 121 deletions
|
|
@ -1,3 +1,5 @@
|
|||
open Caqti_request.Infix
|
||||
|
||||
let db_root = App.data_dir
|
||||
|
||||
let () =
|
||||
|
|
@ -16,14 +18,14 @@ module Db =
|
|||
|
||||
let () =
|
||||
let set_foreign_keys_on =
|
||||
Caqti_request.exec Caqti_type.unit "PRAGMA foreign_keys = ON;"
|
||||
(Caqti_type.unit ->. Caqti_type.unit) "PRAGMA foreign_keys = ON;"
|
||||
in
|
||||
if Result.is_error (Db.exec set_foreign_keys_on ()) then
|
||||
Dream.error (fun log -> log "can't set foreign_keys on")
|
||||
|
||||
let () =
|
||||
let query =
|
||||
Caqti_request.exec Caqti_type.unit
|
||||
(Caqti_type.unit ->. Caqti_type.unit)
|
||||
"CREATE TABLE IF NOT EXISTS dream_session (id TEXT PRIMARY KEY, label \
|
||||
TEXT NOT NULL, expires_at REAL NOT NULL, payload TEXT NOT NULL);"
|
||||
in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue