diff options
Diffstat (limited to 'lib/query/create.ml')
| -rw-r--r-- | lib/query/create.ml | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/lib/query/create.ml b/lib/query/create.ml index ec1fb21..d34339b 100644 --- a/lib/query/create.ml +++ b/lib/query/create.ml @@ -79,9 +79,8 @@ let create_external_reference_table : Format.pp_print_flush format (); let request_str = Buffer.contents buff in let request = - Caqti_request.Infix.( - (Caqti_type.unit ->. Caqti_type.unit) ~oneshot:true) - request_str + let open Caqti.Templater in + direct T.(unit -->. unit) request_str in let module Db = (val db) in let* result = Db.exec request () in @@ -175,8 +174,8 @@ let rec create_table : Format.pp_print_flush format (); let request_str = Buffer.contents buff in let request = - Caqti_request.Infix.((Caqti_type.unit ->. Caqti_type.unit) ~oneshot:true) - request_str + let open Caqti.Templater in + direct T.(unit -->. unit) request_str in let module Db = (val db) in let* result = Db.exec request () in @@ -202,10 +201,8 @@ let add_foreign_statement : Caqti_lwt.connection -> foreign list -> unit Lwt.t = "ALTER TABLE ? ADD CONSTRAINT FOREIGN KEY(?) REFERENCES ?(?)" in let request = - Caqti_request.Infix.( - (Caqti_type.(t4 string string string string) ->. Caqti_type.unit) - ~oneshot:true) - request_str + let open Caqti.Templater in + direct T.(t4 string string string string -->. unit) request_str in let module Db = (val db) in let* () = @@ -238,8 +235,8 @@ let create : Caqti_lwt.connection -> Configuration.Ast.setting -> unit Lwt.t = | None -> create_table db acc content) ([], []) contents in - match Caqti_driver_info.dialect_tag Db.driver_info with - | `Sqlite -> + match Db.dialect with + | Caqti.Template.Dialect.Sqlite _ -> (* There is no way to add a foreign key to an existing table in sqlite, so we just stop the table creation here. @@ -248,4 +245,4 @@ let create : Caqti_lwt.connection -> Configuration.Ast.setting -> unit Lwt.t = *) ignore foreign; Lwt.return_unit - | `Pgsql | `Mysql | _ -> add_foreign_statement db foreign + | _ -> add_foreign_statement db foreign |
